Skip to content

Remove the missing_ok parameter from metadata.validate()#422

Open
candleindark wants to merge 1 commit into
masterfrom
rf-remove-missing-ok
Open

Remove the missing_ok parameter from metadata.validate()#422
candleindark wants to merge 1 commit into
masterfrom
rf-remove-missing-ok

Conversation

@candleindark

Copy link
Copy Markdown
Member

Closes #421.

Removes the missing_ok parameter from dandischema.metadata.validate(). As detailed in #421, missing_ok is 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 a jsonschema message) and is unused outside this repo's own tests.

Changes

  • Remove the missing_ok parameter from validate() and its error-filtering branch.
  • Delete the _validate_obj_json() helper, which became a pure pass-through to validate_json() once missing_ok was gone; its four callers now call validate_json() directly.
  • Remove the associated tests (test_missing_ok, test_missing_ok_error, and the TestValidateObjJson class, whose subject is gone; validate_json is already covered in test_utils.py).

This is a breaking change to the public validate() signature. The usage survey in #421 found no caller passing missing_ok outside this repo's tests, so this is a hard removal rather than a deprecation.

Diffstat
 dandischema/metadata.py            |  52 ++--------
 dandischema/tests/test_metadata.py | 201 +------------------------------------
 2 files changed, 7 insertions(+), 246 deletions(-)

Test plan

  • tox -e typing,lint
  • python -m pytest dandischema (258 passed, 19 skipped; skips are network/instance-name gated)

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

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.53%. Comparing base (d752738) to head (e9f93a9).

Files with missing lines Patch % Lines
dandischema/metadata.py 0.00% 6 Missing ⚠️
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     
Flag Coverage Δ
unittests 47.53% <14.28%> (-0.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@candleindark candleindark added the patch Increment the patch version when merged label Jun 17, 2026
@candleindark candleindark requested a review from yarikoptic June 17, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the missing_ok parameter from metadata.validate()

1 participant