You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a route, if I use a query parameter with a name that corresponds to a Rust keyword (e.g. type), the openapi attribute macro fails to match the query parameter to the function argument. Presumably this is because the function argument has to be prepended with r# in order for rust to consider it as a raw identifier instead of the type keyword, and then the macro cant tell that type == r#type.
It appears this was an issue for rocket that was resolved a few years ago rwf2/Rocket#881. I'm certain that this is issue is with the openapi attribute, as if I use #[openapi(skip)] then everything works as expected.
I used your example as a new test and fixed this issue.
So this should work with the next version of this crate.
Thanks for creating an issue for this.
When creating a route, if I use a query parameter with a name that corresponds to a Rust keyword (e.g.
type
), theopenapi
attribute macro fails to match the query parameter to the function argument. Presumably this is because the function argument has to be prepended withr#
in order for rust to consider it as a raw identifier instead of thetype
keyword, and then the macro cant tell thattype == r#type
.It appears this was an issue for rocket that was resolved a few years ago rwf2/Rocket#881. I'm certain that this is issue is with the
openapi
attribute, as if I use#[openapi(skip)]
then everything works as expected.I've created a branch with a new example demonstrating the problem: https://github.com/alexjpayne/okapi/tree/openapi_fails_to_match_raw_identifier_to_query_param
See: https://github.com/alexjpayne/okapi/blob/openapi_fails_to_match_raw_identifier_to_query_param/examples/raw_indentifiers/src/main.rs
The text was updated successfully, but these errors were encountered: