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
It seems that rocket::http::Status does not implement OpenApiResponder, so that simple route will fail:
use rocket::http::Status;#[get("/")]fnfunc() -> Status{Status::Ok}
It's quite tricky, because the interface is not supposed to have access to the object itself, only type. As a temporary workaround l4l@9206ab2 may work, though I don't really think it's a good idea to merge it.
Maybe some wrapper should be considered for statuses? Procedural macros cannot properly determine whether the item is particular type or not in general, afaik, although they may emit warnings for a wrapper hinting.
The text was updated successfully, but these errors were encountered:
I think that it is safe to assume that if a route return's type is a rocket::http::Status when everything goes as expected the returned status will be Status::Ok. If not, I think that implementing something like #[okapi(return_code = "404")] would be the best course of action, altough I do not have a clue if it would be hard doing so...
This is a screenshot of the example: https://github.com/GREsau/okapi/blob/master/examples/special-types/src/main.rs#L17
It also works with just the rocket::http::Status (or other combination you might expect, like Result<Json<()>, rocket::http::Status>)
The documentation for these endpoint might be a bit scarce, because there is not much info that can be displayed.
It seems that
rocket::http::Status
does not implementOpenApiResponder
, so that simple route will fail:It's quite tricky, because the interface is not supposed to have access to the object itself, only type. As a temporary workaround l4l@9206ab2 may work, though I don't really think it's a good idea to merge it.
Maybe some wrapper should be considered for statuses? Procedural macros cannot properly determine whether the item is particular type or not in general, afaik, although they may emit warnings for a wrapper hinting.
The text was updated successfully, but these errors were encountered: