Java OpenApi format date #2924
-
Hello, I am using OpenApi in my Java project. In my yaml file I used type string and format date. But I am facing one issue with the year. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
20223131 is a valid year, albeit not very likely to be the correct value in your application. You could add an extra check like |
Beta Was this translation helpful? Give feedback.
-
Closing as answered - if that |
Beta Was this translation helpful? Give feedback.
20223131 is a valid year, albeit not very likely to be the correct value in your application.
You could add an extra check like
"maxLength": 10"
or"pattern": "^\d{4}-\d{2}-\d{2}$"
to ensure that you get four-digit years.