I need that a field on my JSON scheme to be either date or datetime. It can have any of those formats. Using the format property, is it possible to use both formats?
1 Answer
In OpenAPI 3.x, you can use anyOf:
type: string
anyOf:
- format: date
- format: date-time
OpenAPI 2.0 (swagger: '2.0') does not support anyOf, but as a workaround you can provide a custom regex pattern instead of the format.
datetimeand analldayboolean flag instead? I am not sure, its 50:50, maybe you can give me a better opinion on that.