Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date format should check 'yyyy-MM-dd' as stated in OpenAPI definition #157

Open
paoesco opened this issue Mar 31, 2022 · 0 comments
Open

Comments

@paoesco
Copy link

paoesco commented Mar 31, 2022

Hello,

It seems date and date-time formats are both treated as date-time in the validation, but date should accept date only values like 2022-01-01.

According to OpenAPI documentation:

An optional format modifier serves as a hint at the contents and format of the string. OpenAPI defines the following built-in string formats:
date – full-date notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6), for example, 2017-07-21
date-time – the date-time notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6), for example, 2017-07-21T17:32:28Z

Culprit is in check.ts

  if ((expect.format === 'date' || expect.format === 'date-time') && !validator.isRFC3339(val)) return { is: false };

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant