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

Fix find actual request body TypeTree #977

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented Jul 24, 2024

Prior to this commit the find actual request body did not work for uknown types. This PR changes the implmentation so that it does not care about the uknown wrapper types and will try to search from it's children if it has generics.

The example demostrates Validated<T> custom wrapper type being used on body type as an out most wrapper. Before this gave a bad error but is now supported.

 #[utoipa::path()]
 #[post("/item")]
 async fn post_item(_body: Validated<Json<Item>>) -> Json<Item> {
     Json(Item(String::new()))
 }

Fixes #976

Relates to ranger-ross/actix-web-validation#16

Prior to this commit the find actual request body did not work for
uknown types. This PR changes the implmentation so that it does not care
about the uknown wrapper types and will try to search from it's children
if it has generics.

The example demostrates `Validated<T>` custom wrapper type being used on
body type as an out most wrapper. Before this gave a bad error but is
now supported.

```rust
 #[utoipa::path()]
 #[post("/item")]
 async fn post_item(_body: Validated<Json<Item>>) -> Json<Item> {
     Json(Item(String::new()))
 }
```
@juhaku juhaku added the bug Something isn't working label Jul 24, 2024
@juhaku juhaku merged commit cc78e38 into master Jul 24, 2024
16 checks passed
@juhaku juhaku deleted the fix-find-body-request-body branch July 24, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Problems with multiple generics in actix?
1 participant