Closed alexjpayne closed 1 year ago
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.
Thank you for fixing this, I appreciate it :slightly_smiling_face:
No problem :) The new release was created the same day. So hope it works now, let me know if you find any other problems.
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 https://github.com/SergioBenitez/Rocket/issues/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