-
Notifications
You must be signed in to change notification settings - Fork 191
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
Defining Headers in Specific APIs #919
Comments
@abdullahabro Yes you can, only way to do this for now is via tuple style E.g. define Header parameter as follows. params(
("x-custom-header" = String, Header, description = "This is a custom header value"),
...
)
Above is from the docs. This might be quite easy to skip over if one is not reading throughoughtly the docs and is quickly seeking the example for it. The docs could be improved a bit whereas the format of the tuple style params was made explicitly clear. |
This commit adds support for OpenAPI links https://spec.openapis.org/oas/latest.html#link-object in `#[utoipa::path(...)]` response object. Also improve documentation as mentioned in issue #919 Closes #551 Closes #919
How can we define required headers by a specific API route?
What I mean exactly is, let's say I have xx-orderSig-header, required by /createOrder, that is basically it will be hash generated by taking sha-256 of request body payload. And there can be many such other headers like xx-order-timestamp.
I am able to define req body type and APi response type and register them as schemas in Utoipa. I also see support for adding security headers by using a security tag (JWT, API keys).
But for defining normal headers, I can not find any example in the repo or docs.
I think i can use params tag some how to define headers, but currently there no option to tell utoipa that a param defined is actually a header not a request path or query param.
i want this to be generated
Instead of this
The text was updated successfully, but these errors were encountered: