huma icon indicating copy to clipboard operation
huma copied to clipboard

Override ErrorModel for single operations

Open lsdch opened this issue 2 months ago • 6 comments

Currently the default error model can be overridden globally for the API. Would you consider adding a feature to set a custom error model at the level of operations ?

As far as I understand, it is already kinda possible to do so by setting the Operation.Responses, but this is cumbersome since one must provide Schema definitions instead of simply providing a Go struct type.

Operation could be extended with an ErrorModel field which would implement the StatusError interface. I am willing to try and submit a PR if this idea finds approval.

lsdch avatar Apr 22 '24 09:04 lsdch