Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSON specifying a date-time

How can the following MSON output a schema with "format":"date-time", similar to the stated below?

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)

Obtained Json Schema:

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

Desired Schema (Note the "format" field):

{
  "type": "object",
  "properties": {
    "CreatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "CreatedAt"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#"
}
like image 491
user1990009 Avatar asked Feb 17 '26 20:02

user1990009


1 Answers

AFAIK unfortunately there is no way to specify some format on string fields yet.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!