bcgov / ppr-deprecated

deprecated-Personal Property Registry
Apache License 2.0
2 stars 10 forks source link

Only perform validation on write operation #889

Open jguertin opened 4 years ago

jguertin commented 4 years ago

Due to historical data it is possible that there may be data in the database that does not conform with our validation business rules. Retrieving existing data through the API should not cause an error. However, since we're using pydantic for both validation and generating our output, currently this scenario will cause an error.

Update the implementation so that validation of schema objects only occurs on write operation, such as an incoming POST of a schema object. There may be a few ways to approach this, though one suggestion can be found here: https://github.com/samuelcolvin/pydantic/issues/559#issuecomment-496538989