danielgtaylor / danielgtaylor/huma
Override ErrorModel for single operations
- Dominant language
- Go
- Stars
- 4.4k
- Forks
- 285
- Avg merge
- 40m
- Merged PRs (30d)
- 1
Description
Currently the default error model can be [overridden globally for the API](https://huma.rocks/features/response-errors/#custom-errors). 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.