3

以下 MSON 如何输出具有“格式”:“日期时间”的模式,类似于下面所述?

女士:

FORMAT: 1A
# Some API

## series [/api/v1/series]

Returns a list of  series.

### View all series [GET]

+ Response 200 (application/json; charset=utf-8)
    + Attributes
        + CreatedAt (required, string)

获得的 Json Schema:

{
  "type": "object",
  "properties": {
    "CreatedAt": {
      "type": "string"
    }
  },
  "required": [
    "CreatedAt"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}

所需的模式(注意“格式”字段):

{
  "type": "object",
  "properties": {
    "CreatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "CreatedAt"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}
4

1 回答 1

2

不幸的是,AFAIK 还没有办法在字符串字段上指定某种格式。

于 2015-09-23T09:09:15.640 回答