Closed j7nw4r closed 6 months ago
Hey, thanks for your issue. You're right, I'll look into it.
As a workaround, you can write #[openapi()] (with the parentheses).
Hmm. That doesn't seem to work for me either. I'll continue manually adding for now.
Thanks for your help.
The thing I'm 100% sur works is to add a description and info field since it's what is in the tests and what I use in other projects.
#[openapi(info(title = "Percentage API", version = "1.0.0"))]
I'll try to fix it when I can
However, can you clarify what do you mean when you say that '#[openapi()]' doesn't work ? For me it works...
In my bug example, when I do:
#[utoipauto(paths = "./src")]
#[derive(OpenApi)]
#[openapi()]
struct ApiDoc;
I get a:
`derive` can only be applied to structs, enums, and unions [E0774]
from the compiler. I do not get the same error when I remove the #[utoipauto(paths = "./src")]
macro. It seems that the first level macro expansion for the utoipauto
macro is:
#[derive(OpenApi)]
#[openapi()]
struct ApiDoc;
So I'm not sure what's the actual issue.
I'm using rustrover, if that helps.
Hmm as I look into it more. Your suggestion (#[openapi()]
) works. I think the issue with suggestion actually lies with RustRover interpretation of the code. I will use your suggestion. Thank you.
The first issue still stands though.
@ProbablyClem If you can point me in a direction, I can fix it.
There's the update_openapi_macro_attributes function in utoipauto-core that'sformating the output
@ProbablyClem Can you look at this PR please? https://github.com/ProbablyClem/utoipauto/pull/17
@ProbablyClem I realized I snuck a change in that accidentally changed functionality. Fix is here: https://github.com/ProbablyClem/utoipauto/pull/18
Hello. Given this simple example: https://github.com/j7nw4r/utoipauto-bug the macro expansion seems to be broken. It fails with the error message:
error: unexpected attribute, expected any of: handlers, components, modifiers, security, tags, external_docs, servers, expected identifier
at the#[utoipauto(paths = "./src")]
annotation.I believe this is because the expansion mistakenly expands to the below and includes an erroneous
# [ openapi ]
.I'm not super familiar with proc-macros, but if pointed in the correct direction, maybe I can look into it.