Skip to content

fix: report false schemas under propertyNames - #303

Open
MohitSAGAR11 wants to merge 1 commit into
hyperjump-io:mainfrom
MohitSAGAR11:fix-propertynames-false
Open

MohitSAGAR11 wants to merge 1 commit into
hyperjump-io:mainfrom
MohitSAGAR11:fix-propertynames-false

Conversation

@MohitSAGAR11

Copy link
Copy Markdown
Contributor

Fixes #302

A false schema under propertyNames now produces an error.

The error index stores property name locations without the * (#*/foo is indexed as #/foo). Keywords already looked errors up that way, but boolean schemas used the location as is, so they found nothing and were treated as passing. The star-stripped location is now computed once in evaluateSchema and used for both.

Tests

Added to src/test-suite/tests/propertyNames.json:

  • propertyNames false
  • propertyNames with a false schema in allOf
  • propertyNames with a $ref to a false schema
  • propertyNames false in anyOf: the first alternative used to be empty.

All 4 fail without the fix (24 runs across dialects). npm test (2200 passed), npm run type-check and npm run lint pass.

The error index stores property name locations without the "*" ("#*/foo" is indexed as "#/foo"). Keywords looked errors up that way, but boolean schemas used the location as is, so a false schema under propertyNames was treated as passing and produced no error.

Fixes hyperjump-io#302

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

propertyNames: false produces no error message

1 participant