Dont run validates_schema if individual fields were invalid
See original GitHub issueI just discovered that validates_schema runs if individual fields have failed validation. I kinda expected otherwise.
I want a way to prevent validates_schema from being run if individual fields have failed validation. Please confirm if my way of comparing original and processed data is sufficient or that there is a simpler alternative.
@validates_schema(pass_original=True)
def validate_schema(self, data, original):
# dont run below tests if validation on individual fields failed:
if sorted(data.keys()) != sorted(original.keys()):
return
...tests that presume individual fields are valid
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
java - Validating Schema using RestAssured ...
OK. The problem is as I suspected, you are providing JSON data as opposed to a JSON Schema. Generating the Schema from your...
Read more >Invalid schema causes "should have required property '$ref ...
When an OpenAPI v3 Response Object contains a schema which has invalid schemas, an error is thrown saying: should have a required $ref...
Read more >How to Fix Schema Validation Errors
The most common schema validation error is "either "offers", "review", or "aggregate rating" should be specified." Here's how to fix it.
Read more >How To Use Schema Validation in MongoDB - DigitalOcean
This tutorial was validated using a server running Ubuntu 20.04, ... In MongoDB, schema validation works on individual collections by ...
Read more >Kubernetes Schema Validation | Datree.io
Running schema validation tests is important, and the sooner the better. ... Are you sure you don't have any invalid data types?
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
The
skip_on_field_errors
parameter has been added tovalidates_schema
in 2.4.0.Perhaps an alternative would be to properly expose the errors that have been captured during unmarshalling. At the moment you have to go through
self._unmarshal.errors
. Individual validate_schema methods would either check for errors before running of the decorator could be modified to automatically do this check if configured. Of course, I could be missing something and these errors might be already getting exposed at a more desirable location.