danielgtaylor / danielgtaylor/huma

Override ErrorModel for single operations

Open
#401 6 comments 0 reactions 0 assignees View on GitHub
question
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.