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

Incompatible with utoipa crate #16

Closed
DenuxPlays opened this issue Jul 23, 2024 · 8 comments
Closed

Incompatible with utoipa crate #16

DenuxPlays opened this issue Jul 23, 2024 · 8 comments

Comments

@DenuxPlays
Copy link

Hey,

I wanted to implement this crate into my backend.
We use the utoipa crate to generate OpenAPI documentation but unfortunately this validation library is not compatible with utoipa.
I am not sure if the issue should be opened here or at utoipa but other validation libraries seem to work with it completely fine.

Error:

image

How to reproduce

  1. Checkout: https://github.com/jt-foss/financrr-app/tree/backend/feature/new-validation-library/backend
  2. run cargo build
  3. take a look at the first error (other errors are all related to the macro failing.)
@ranger-ross
Copy link
Owner

Thanks for the report. Yeah, I would like very much for this library to be compatible with utoipa. I don't know which crate would need to make a change yet. I will look into the implementation details this weekend.

@DenuxPlays
Copy link
Author

Hey,

I opened an issue at utoipa as ai am not sure if the issue is here or at the other library.

@juhaku
Copy link

juhaku commented Jul 24, 2024

If the syntax in your code is something like in the example in the README.md then I believe that the issue lies in the utoipa since I guess it might not be able to correctly parse the Validated<Json<Example>> wrappper.

async fn hello(Validated(Json(payload)): Validated<Json<Example>>) -> impl Responder {
    HttpResponse::Ok().body(format!("Hello {}", payload.name))
}

I am now implementing a fix for this here juhaku/utoipa#977

@juhaku
Copy link

juhaku commented Jul 24, 2024

Though the fix is not expected to be released separately but will eventually land in utoipa 5.0.0. For time being you can reference in your Cargo.toml to the latest commit on master which will have the fix. The 5.0.0 will have some breaking changes and one of them is upgrading to OpenAPI 3.1. But for now it is still in 3.0

@DenuxPlays
Copy link
Author

Though the fix is not expected to be released separately but will eventually land in utoipa 5.0.0. For time being you can reference in your Cargo.toml to the latest commit on master which will have the fix. The 5.0.0 will have some breaking changes and one of them is upgrading to OpenAPI 3.1. But for now it is still in 3.0

Hey,

would it be possible to release a v5.0.0-beta.1 that includes this fix?

@DenuxPlays
Copy link
Author

I think this can be closed now.

Wasn't an issue with this crate.

@juhaku
Copy link

juhaku commented Jul 25, 2024

Hey,

would it be possible to release a v5.0.0-beta.1 that includes this fix?

I'll see if I could release a patch release for the 4.x.x serie. Though I could release the 5.0.0.alpha.1 as soon as I get my current work ready for PR and possibly even to master.

@juhaku
Copy link

juhaku commented Jul 27, 2024

@DenuxPlays Published another pre-release with the fix: juhaku/utoipa#976 (comment)

https://github.com/juhaku/utoipa/releases/tag/utoipa-5.0.0-alpha.1

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

3 participants