make 'utoipa' an optional feature in 'utoipa-axum' #1337
woshilapin
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the project I work on, we use
utoipa
to generate the OpenAPI file as a sub-command of the main application: it's not exposed anywhere in the webserver. But this sub-command is rarely modified. We mostly work on the web server part that don't need all theutoipa
annotations, only theaxum::Router
part. Therefore, we pay the price of code generation ofutoipa::ToSchema
andutoipa::path
on each and every compilation orrust-analyzer
iteration, but we mostly need theaxum::Router
to be defined, not the entire OpenAPI schema.Would it make sense to make
utoipa
a[feature]
(enabled by default) ofutoipa-axum
? Is this a wild idea, or does it make sense?I've started looking around for how to technically realize this kind of thing... and if I understand correctly, that would not be trivial to implement. As far as I can understand, the
axum::Router
is based on the implementation ofutoipa::Path
on the handlers, which means that disablingutoipa
means losing the necessary metadata to build the router. So I guess we would need an intermediate representation forOpenApiRouter
that doesn't depend onutoipa
directly. I'm taking any idea, hint, warning, I might try to explore that.And sorry if there was already a similar discussion/issue, I tried to find related topics but couldn't, for lack of good keywords ("optional", "feature"?).
Beta Was this translation helpful? Give feedback.
All reactions