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

Schema based query codecs including validation (#2937) #2991

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

987Nabil
Copy link
Contributor

fixes #2937
/claim #2937

@987Nabil
Copy link
Contributor Author

@jdegoes PR was already big enough. But there is some follow up work to do.

  1. Integrate the validation information in OpenAPI. I started with this for the bodies already. The PR is blocked by a zio-schema bug. But now queries needs it too. I will open a new issue.
  2. I modified the TextBinaryCodec, so it works for Records with exactly one field. This is used in query codec, but only works if the user gives the query param name. To improve this, we should add that one can define a case class and the query codec looks for query params that fit all field names HttpCodec.query[Params] where case class Params(perPage: Int, page: Int) to read two query params

@jdegoes
Copy link
Member

jdegoes commented Aug 1, 2024

To improve this, we should add that one can define a case class and the query codec looks for query params that fit all field names HttpCodec.query[Params] where case class Params(perPage: Int, page: Int) to read two query params

It would be nice to get this one done as part of this PR, if possible.

@jdegoes jdegoes merged commit b1a4f9d into zio:main Aug 2, 2024
34 checks passed
@987Nabil
Copy link
Contributor Author

987Nabil commented Aug 7, 2024

I just realized, this fixes #2945 as well
/claim #2945

@anqit
Copy link

anqit commented Aug 10, 2024

It'd be great if user-facing changes like this included doc updates as well

@987Nabil
Copy link
Contributor Author

987Nabil commented Aug 10, 2024

@anqit we will check and update all docs before the final 3.0 release.
Also, there are no API changes.
Take a look at this for API changes including adjusted docs. https://github.com/zio/zio-http/pull/3000/files#diff-af8fd425043c6947f3e6b86e9b2fb5fdefa737968e9b63458fe6ceb8938ce5ce

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

Successfully merging this pull request may close these issues.

Endpoint: add query codec validation for max/min length and regex
3 participants