aglio icon indicating copy to clipboard operation
aglio copied to clipboard

Cannot use dash in data structure

Open hckhanh opened this issue 9 years ago • 2 comments

I have a structure like this.

Data Structures

UserData

  • _id: 571a28adb94555081fa84671 (required, string) - Unique identifier
  • email: [email protected] (required, string) - User email
  • secret: notasecret (required, string) - User password
  • name: User 1 (required, string) - User name
  • created_at: 2016-04-22T13:35:41.600Z (required, string) - create time

But here is the result:

Body

{
  "_id": "571a28adb94555081fa84671",
  "email": "[email protected]",
  "secret": "notasecret",
  "name": "User 1",
  "created_at": "2016"
}

Schema

{
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "description": "Unique identifier"
    },
    "email": {
      "type": "string",
      "description": "User email"
    },
    "secret": {
      "type": "string",
      "description": "User password"
    },
    "name": {
      "type": "string",
      "description": "User name"
    },
    "created_at": {
      "type": "string",
      "description": "04-22T13:35:41.600Z (required, string) - create time"
    }
  },
  "required": [
    "_id",
    "email",
    "secret",
    "name"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

You can see the created_at has some problem. I cannot add the string with dashes.

hckhanh avatar May 26 '16 10:05 hckhanh

I think you have to escape it. Like this: created_at: 2016-04-22T13:35:41.600Z (required, string) - create time

jyggen avatar Jun 14 '16 23:06 jyggen

You need to escape it with backticks (`) like @jyggen pointed out as per the MSON specification.

jackbentley avatar Mar 03 '17 23:03 jackbentley