question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specifying minimum/maximum for date/date-time

See original GitHub issue

We 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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
EricWittmanncommented, Feb 25, 2020

OK - sorry for making a suggestion that didn’t work! But at least we’ve identified a problem in SmallRye that we can fix!

image

0reactions
MikeEdgarcommented, Feb 27, 2022

Closing, as there is no further action to take from a MicroProfile OpenAPI perspective.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you set a minimum and maximum date in Python to ...
If you want a min and max use the mn_year and mx_year as above. You don't need to cast to ints, you can...
Read more >
datetime — Basic date and time types — Python 3.11.1 ...
MAXYEAR is 9999 . Alias for the UTC timezone singleton datetime.timezone.utc . New in version 3.11.
Read more >
Javascript Date & Time Min & max values Example - Mobiscroll
Configuring minimum and maximum selectable values is great for reducing mistakes. Help people by limiting the selections for the task at hand. ...
Read more >
Working with Date and Time in C# - TutorialsTeacher
The default and the lowest value of a DateTime object is January 1, 0001 00:00:00 (midnight). The maximum value can be December 31,...
Read more >
DateTime.MinValue Field (System) - Microsoft Learn
MinValue defines the date and time that is assigned to an uninitialized DateTime variable. The following example illustrates this. C# Copy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found