Skip to content

Conversation

@LukasGold
Copy link
Contributor

Prior to the here committed changes, load_entity does raise a validation error, if the JSON data loaded for an entity does not fit with the model created from the JSON schema associated with the JSON data (instance of).

Here I introduce the "model_to_use" parameter to allow the handover of a (Pydantic) model which is tolerant to the deviation of the JSON data, with respect to the valid JSON schema. This tolerant model is a child of the actual target model, but doesn't cause a validation error on the deviating attribute. With this model, the JSON data can be used to create an instance, which then can be transformed to fit the original target model.

@LukasGold LukasGold added the enhancement New feature or request label Feb 20, 2025
@LukasGold LukasGold self-assigned this Feb 20, 2025
@coveralls
Copy link

coveralls commented Feb 20, 2025

Pull Request Test Coverage Report for Build 13433052289

Details

  • 8 of 15 (53.33%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 53.272%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/osw/core.py 8 15 53.33%
Files with Coverage Reduction New Missed Lines %
src/osw/core.py 1 75.39%
Totals Coverage Status
Change from base Build 13418807436: 0.04%
Covered Lines: 3162
Relevant Lines: 5579

💛 - Coveralls

@simontaurus simontaurus marked this pull request as ready for review February 20, 2025 13:36
@simontaurus simontaurus merged commit 925d545 into main Feb 20, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants