Remove the missing_ok parameter from metadata.validate()#422
Open
candleindark wants to merge 1 commit into
Open
Remove the missing_ok parameter from metadata.validate()#422candleindark wants to merge 1 commit into
missing_ok parameter from metadata.validate()#422candleindark wants to merge 1 commit into
Conversation
missing_ok was a brittle feature that did not reliably do what it claimed and was unused outside this repo's own tests. It tried to suppress "missing field" errors in two layers keyed off different signals: a fragile substring match on the jsonschema message "is a required property" (not a stable contract), and a stable Pydantic type == "missing" check that nonetheless misses required fields enforced via custom validators (those surface as value_error, and nothing about a custom validator reaches the JSON Schema layer). Drop the parameter from validate(), delete the now-trivial _validate_obj_json() helper (its four callers now call validate_json directly), and remove the associated tests. Closes #421 Co-Authored-By: Claude Code 2.1.179 / Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #422 +/- ##
==========================================
- Coverage 48.31% 47.53% -0.79%
==========================================
Files 19 19
Lines 2434 2371 -63
==========================================
- Hits 1176 1127 -49
+ Misses 1258 1244 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #421.
Removes the
missing_okparameter fromdandischema.metadata.validate(). As detailed in #421,missing_okis a brittle feature that does not reliably suppress "missing field" errors (it misses required fields enforced by custom validators, and otherwise relies on substring-matching ajsonschemamessage) and is unused outside this repo's own tests.Changes
missing_okparameter fromvalidate()and its error-filtering branch._validate_obj_json()helper, which became a pure pass-through tovalidate_json()oncemissing_okwas gone; its four callers now callvalidate_json()directly.test_missing_ok,test_missing_ok_error, and theTestValidateObjJsonclass, whose subject is gone;validate_jsonis already covered intest_utils.py).This is a breaking change to the public
validate()signature. The usage survey in #421 found no caller passingmissing_okoutside this repo's tests, so this is a hard removal rather than a deprecation.Diffstat
Test plan
tox -e typing,lintpython -m pytest dandischema(258 passed, 19 skipped; skips are network/instance-name gated)