3

I am getting below warning/error while specifying the data type for date and time in swagger spec for loopback. Below is my loopback user.json file

"properties": {
    "schedule": {
      "type": "dateTime",
      "required": true
    },
 }

Swagger: skipping unknown type "dateTime"

Please may I know what is the relevant data type for date and time in swagger?

Hemadri Dasari
  • 32,666
  • 37
  • 119
  • 162
  • Possible duplicate of [What is the correct way to declare a date in a OpenAPI / Swagger-file?](https://stackoverflow.com/questions/49379006/what-is-the-correct-way-to-declare-a-date-in-a-openapi-swagger-file) – Helen Oct 01 '18 at 10:02

1 Answers1

9

Specify the type as string and format as date-time:

"properties": { "schedule": { "type": "string", "format": "date-time", "required": true }, }

[ https://swagger.io/specification/#dataTypes ]

stdob--
  • 28,222
  • 5
  • 58
  • 73