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
Is your feature request related to a problem? Please describe.
Whilst I quite like this project, i found a problem arises with the rust enums. This arises when you have error enums which have no fields, such as in the pet store example:
responses:
400:
description: Invalid ID supplied404:
description: Pet not found405:
description: Validation exception
With the error codes 400, 404 and 405 since they have no content they will fail to convert into the enumerated response generated and so instead will have to be accessed via a response error.
Describe the solution you'd like
Rather than using #[serde(untagged)] I think it might be better to work based of status code. It might also be good to implement Display and Error on the error type using the description field.
Describe alternatives you've considered
So far in my project I have just been using the ResponseError sub variant instead, but this is clunky. Another option would be to separate the functionality mentioned above into an additional feature.
In addition a trait could be made such as DesieralizeWithStatusCode to ease the project.
Anyhow, many thanks with this project, it is so much easier than manually creating a reqwest library!
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Whilst I quite like this project, i found a problem arises with the rust enums. This arises when you have error enums which have no fields, such as in the pet store example:
With the error codes 400, 404 and 405 since they have no content they will fail to convert into the enumerated response generated and so instead will have to be accessed via a response error.
Describe the solution you'd like
Rather than using
#[serde(untagged)]
I think it might be better to work based of status code. It might also be good to implementDisplay
andError
on the error type using thedescription
field.Describe alternatives you've considered
So far in my project I have just been using the
ResponseError
sub variant instead, but this is clunky. Another option would be to separate the functionality mentioned above into an additional feature.In addition a trait could be made such as
DesieralizeWithStatusCode
to ease the project.Anyhow, many thanks with this project, it is so much easier than manually creating a
reqwest
library!The text was updated successfully, but these errors were encountered: