danielgtaylor / aglio

An API Blueprint renderer with theme support that outputs static HTML
4.75k stars 482 forks source link

Cannot use dash in data structure #263

Open hckhanh opened 8 years ago

hckhanh commented 8 years ago

I have a structure like this.

Data Structures

UserData

But here is the result:

Body

{
  "_id": "571a28adb94555081fa84671",
  "email": "email@example.com",
  "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.

jyggen commented 8 years ago

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

jackbentley commented 7 years ago

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