[Feature request] Global validation error model override
See original GitHub issueIt would be really cool to not only be able to override the validation_error_status
globally but also the validation error model. e.g.
spectree.spec.SpecTree(..., validation_error_model=MyPydanticErrorModel)
What do you think? I would be happy to contribute.
BR
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:11 (9 by maintainers)
Top Results From Across the Web
[FEATURE] Allow customization of validation error · Issue #1376
I'd like to globally customize validation errors by changing (overriding) the HTTPValidationError / ValidationError and the 422 status code. The ...
Read more >Request Validation - Preventing Script Attacks - Microsoft Learn
This paper describes the request validation feature of ASP.NET where, by default, the application is prevented from processing unencoded ...
Read more >Handling Errors - FastAPI
To override it, import the RequestValidationError and use it with @app. exception_handler(RequestValidationError) to decorate the exception handler. The ...
Read more >Step 4. Add Validation and Error Handling
Add the Validate size operation to the hello-world project: ... Value: Click the fx button to change from literal mode to expression mode,...
Read more >Validating form input - Angular
Every time the value of a form control changes, Angular runs validation and generates either a list of validation errors that results in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No this is not what I mean 😄 Sorry, for the confusion. I try to explain in a different way: This line adds the validation error to the responses which is later used in
spec._generate_spec
. So the api docs for every endpoint (not overriding 422 response) will look like this:So I want to tell spectree to use a custom model by default instead of the standard validation error.
Does this make it clearer? Thanks for your answers.
Awesome thanks!