What is the correct way to declare a date in an OpenAPI / Swagger-file?

后端 未结 3 1265
盖世英雄少女心
盖世英雄少女心 2020-12-15 15:31

What is the correct way to declare a date in a swagger-file object? I would think it is:

  startDate:
    type: string
    description: Start date
    exampl         


        
3条回答
  •  余生分开走
    2020-12-15 16:30

    A correct example of declaring date in an Open API swagger file:

        properties:
          releaseDate:
            type: date
            pattern: /([0-9]{4})-(?:[0-9]{2})-([0-9]{2})/
            example: "2019-05-17"
    

提交回复
热议问题