juhaku / utoipa

Simple, Fast, Code first and Compile time generated OpenAPI documentation for Rust
Apache License 2.0
2.47k stars 193 forks source link

Support RFC-7807 through schemas for `problemdetails` or `http-api-problem` #590

Open mettekou opened 1 year ago

mettekou commented 1 year ago

RFC-7807 is a popular standard for HTTP API error response bodies. Both the problemdetails and http-api-problem crates implement this standard. Would it be a good idea to implement schemas for the relevant types from these crates?

juhaku commented 1 year ago

Sure why not. The possibilities of how to integrate / implement such capability to utoipa can be explored in future. Though it might be better if the support is directly implemented to the corresponding crates, so whenever they change the changes are reflected to utoipa as well. Otherwise utoipa must be able to keep track of possible changes in the spec and act accordingly. However if, and most likely so, the spec is not going to be changed frequently which would help to keep the maintenance overhead low. But the manual implementation of schemas would need duplicate work for declaring the properties of the possible types.

mettekou commented 1 year ago

Sure why not. The possibilities of how to integrate / implement such capability to utoipa can be explored in future. Though it might be better if the support is directly implemented to the corresponding crates, so whenever they change the changes are reflected to utoipa as well. Otherwise utoipa must be able to keep track of possible changes in the spec and act accordingly. However if, and most likely so, the spec is not going to be changed frequently which would help to keep the maintenance overhead low. But the manual implementation of schemas would need duplicate work for declaring the properties of the possible types.

EDIT: @juhaku I have reached out to the authors of those libraries about integration with utoipa.