Closed open-schnick closed 2 years ago
I would have to look further into this. But this looks definitely like something worth looking into more.
I think the ignore
approach also looks good. I will see if I can quickly get this solved.
Solved in master
, see https://github.com/GREsau/okapi/blob/master/examples/openapi_attributes/src/main.rs#L14 for an example.
I'll document it and other derive attributes later.
Right now it works on everything except path parameters because I think this would always give unwanted results.
It will also give compiler errors when the argument does not exist and when it is a path parameter.
Multiple attributes can also be ignored using: #[openapi(ignore = "db", ignore = "log")]
See if this solves your problem. If not or you find a bug, let me know so I can fix it before the next release.
Very cool thank you for implementing that <3
In cases where a crate provides a type and a request-guard implementation it is not possible to document endpoints using that type. This was an error for the
rocket_db_pools::Connection<T>
type and fixed by implementing that trait in this crate in pr #104. I have the same error now with a different type. Obviously we cannot do that for every crate that interacts with rocket. The only way to fix this would be to be able to skip some parameters in the route definition. This was already requested in #85. Sadly i am currently not able to create a pr for that but i would imagine it like so:My really stupid, but working workaround is to define the same route again, documenting it, and removing the not working parameter.
Obviously that is not really cool. The only way is see to fix this would implement said ignore attributes. What do you think?