Specifying minimum/maximum for date/date-time
See original GitHub issueWe are using micoprofile openApi for generating an API description for our REST endpoints, and have a date type property on one of our request objects, which is required to be later than a specific date (2010-01-01 in our case), however if we set minimum to “2010-01-01” on @Schema we get a NumberFormatException.
We already realized that OpenApi specification itself is based on the JSON Schema draft which explicitly specifies minimum/maximum as number and does not have any other property for this (maybe there will be once with some vocabulary: https://github.com/json-schema-org/json-schema-spec/issues/116).
(Note: our dto-s are defined and validated by xsd-s, in which we can specify minimum for date ie.:
<xsd:simpleType name="RestrictedDateType">
<xsd:restriction base="xsd:date">
<xsd:minInclusive value="2010-01-01"/>
</xsd:restriction>
</xsd:simpleType>
Our goal is to include this restriction in the openAPI definition as well.)
Do you have any suggestions (or workaround) to imply the given property has a minimum/maximum date in the API specification?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
OK - sorry for making a suggestion that didn’t work! But at least we’ve identified a problem in SmallRye that we can fix!
Closing, as there is no further action to take from a MicroProfile OpenAPI perspective.