Can Axum request bodies be inferred by the path macro? #1465
Unanswered
BrianHicks
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey! I see in the docs that inferring
request_body
is not available for all libraries, but I'm not sure how to find out which ones it's supported for. It's not working for me with Axum, but I'm not sure whether that's because it's unsupported or because I'm holding it wrong somehow. Here's what I have right now:This doesn't result in any information about the request body in the generated spec. However, if I change it to this, it works:
#[utoipa::path(post, path = "/api/v1/register", request_body = RegisterRequest)]
This makes sense, to a certain extent. There are a couple reasons I'm not sure if I'm just doing something wrong, though:
request_body = Json<RegisterRequest>
, compilation fails becauseJson<a>
doesn't implementToSchema
. But maybe there's something else I need to use?Beta Was this translation helpful? Give feedback.
All reactions