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

Accept dates and datetimes in formatted string schemas #524

Merged
merged 2 commits into from
Feb 7, 2023

Conversation

zorbash
Copy link
Contributor

@zorbash zorbash commented Feb 6, 2023

Currently trying to cast a %Date{} or %DateTime{} as a String with format: :"date-time" or format: :"date" returns a validation error.

With this PR we can improve the consistency of casting and validations by being a little more flexible in the types of inputs accepted OpenApiSpex.Cast.String already accepts the following non JSON or OpenAPI primitives:

  • Plug.Upload
  • atoms

Benefits

A schema can be validated, casted, transformed and then validated again.

Copy link
Collaborator

@mbuhot mbuhot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

ubuntu-latest now points to 22.04 for which hex.pm does not have
older OTP builds.

See:

* https://repo.hex.pm/builds/otp/ubuntu-22.04/builds.txt
* https://repo.hex.pm/builds/otp/ubuntu-20.04/builds.txt
@zorbash zorbash merged commit 5df065e into master Feb 7, 2023
@zorbash zorbash deleted the datetime-validations branch February 7, 2023 10:47
@@ -61,7 +61,7 @@ jobs:
run: mix do deps.get, test

test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ubuntu-latest now points to 22.04 for which hex.pm does not have older OTP builds.

See:

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

Successfully merging this pull request may close these issues.

2 participants