Skip to content

Draft-07 labels minContains unsupported while still applying it #122

Description

@MicroMilo

Summary

On the draft-07 public compile/validate path, adding minContains:2 to {contains:{}} makes [0] invalid even though the compiler simultaneously reports minContains as not valid for draft-07. An unsupported newer-draft keyword therefore changes ordinary validation results in an older draft.

Validation source commit: 1cc2a3045f615ef67104f02449c6fd58afebeb6a.

Code path

  • README.md:118-120: README defines schemaAnnotations as keywords not belonging to the selected draft.
  • src/errors/errors.ts:80-85: Repository error contract for unknown-keyword-warning.
  • src/validateSchema.test.ts:309-321: Test requires new keywords used with old drafts to be returned as annotations.
  • src/draft07.ts:54-101: Draft-07 registers contains but no minContains keyword role.
  • src/SchemaNode.ts:629-656: Compiler classifies unregistered schema keys as unknown-keyword-warning annotations.
  • src/keywords/contains.ts:46-86: Shared contains validator says min/max handling is for draft >=2019-09 but reads minContains without a draft guard.
  • Repository-local validation artifact: Minimized differential replay against the bundled browser product.

Steps to reproduce

This report is based on a source-control-flow validation against the commit above.

  1. Check out the source commit listed in this report.
  2. Inspect the code path and contract anchors listed above.
  3. Exercise the described boundary/state path: Draft-07 labels minContains unsupported while still applying it.
  4. Compare the observed behavior with the expected contract below.

Validation note: The minimized replay reports draft-07, baselineWithoutMinContains.valid=true, compilerAnnotation.message="Keyword 'minContains' is not a valid keyword to draft 'draft-07'", and validatorResult.valid=false with errorCodes=["contains-min-error"].

Expected behavior

The implementation should preserve the repository contract described by the documentation, public type, parser, serializer, or sibling implementation anchors above.

Actual behavior

On the draft-07 public compile/validate path, adding minContains:2 to {contains:{}} makes [0] invalid even though the compiler simultaneously reports minContains as not valid for draft-07. An unsupported newer-draft keyword therefore changes ordinary validation results in an older draft.

Existing coverage

I did not find an existing issue or PR title that appears to cover this exact root cause in the pre-submission check.

Suggested fix

Prevent unsupported minContains from affecting draft-07 validation.

Suggested tests

  • Add a regression test for: Draft-07 labels minContains unsupported while still applying it.
  • Include the boundary value or state transition described above so the old behavior fails before the fix.

Submitted with Codex.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions