What is the correct way to declare a date in an OpenAPI / Swagger-file?
问题 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 example: "2017-01-01" format: date But I see a lot of declarations like these: startDate: type: string description: Start date example: "2017-01-01" format: date pattern: "YYYY-MM-DD" minLength: 0 maxLength: 10 Thanks. 回答1: The OpenAPI Specification says that you should use: type: string format: date # or date-time The pattern to use is defined in RFC 3339,