-
Is it possible to access the associated OpenAPI definition from within the associated handler? For example, in the following example, I would like to access the
Is this possible? |
Beta Was this translation helpful? Give feedback.
Answered by
juhaku
Sep 26, 2024
Replies: 1 comment 2 replies
-
There are 2 ways around this.
Only way to change the content is to access via |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
bachp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are 2 ways around this.
OpenApi
type by some means. E.g. via global state or whatever state mechanism your framework will support.#[utoipa::path(...)]
macro will create a meta struct called__path_get_hello
for the annotated function. In general in form of__path_{function_name}
. Thus you could directly call this struct with__path_get_hello::operation()
to get the generated operation schema to access it's content. However there is no way to change this content here.Only way to change the content is to access via
OpenApi
directly or registeredModify
trait.