Swagger-editor: date and dateTime considered as Errors?

Created on 16 Apr 2015  路  3Comments  路  Source: swagger-api/swagger-editor

This specification:

parameters:
        -
          name: gender
          in: formData
          description: "User's gender"
          required: true
          type: string
          enum: [m, f]
          default: m
        -
          name: birthday
          in: formData
          description: "User's birth date"
          required: true
          type: date

Results in this:
image

When changing the type from date to string , the error message disappears.

question

Most helpful comment

You _can_ do that, but no third party tool will currently render that.
The proper way to do it would be:

type: string
format: date

You have more information here to see what that format(s) that would support. If you need a specific format, you'd have to use the pattern property which accepts a regex.

All 3 comments

date and date-time are not applicable types. If you want to use them, you can use them as format type alongside with a string type.

so just

type: string
format: YYYY-mm-dd

for example?

You _can_ do that, but no third party tool will currently render that.
The proper way to do it would be:

type: string
format: date

You have more information here to see what that format(s) that would support. If you need a specific format, you'd have to use the pattern property which accepts a regex.

Was this page helpful?
0 / 5 - 0 ratings