-
Hi, is it possible to pass an array for the paths? #[derive(OpenApi)] Is it possible to acheive? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey, This is not supported and it was never designed such way. It only expects a comma separated varargs or type paths of handler functions. Implementing such support would not be a simple task. But could be considered in future. Perhaps in some form of trait that need be implemented for the array etc. It is hard if not impossible to locate the actual array in compile time to read it's content. This also adds some limitations to to what is possible. For what can be added as derive macro attributes must be available in compile time. No vecs filled during runtime can be used unless the whole OpenAPI is constructed during runtime. |
Beta Was this translation helpful? Give feedback.
Hey,
This is not supported and it was never designed such way. It only expects a comma separated varargs or type paths of handler functions.
#[openapi(paths(path::to::handler, path::to::handler2)...)]
Implementing such support would not be a simple task. But could be considered in future. Perhaps in some form of trait that need be implemented for the array etc. It is hard if not impossible to locate the actual array in compile time to read it's content. This also adds some limitations to to what is possible. For what can be added as derive macro attributes must be available in compile time. No vecs filled during runtime can be used unless the whole OpenAPI is constructed during runtime.