Skip to content

fixed propertyDependencies $schema & $id; removed invalid test cases #624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 14, 2022

Conversation

gregsdennis
Copy link
Member

@gregsdennis gregsdennis commented Dec 14, 2022

Found these while working on my implementation.

  • $schema & $id values should have "draft next" instead of "2020-12"
  • Removed tests are invalid because when expectedTypes is missing, nothing in the schema is referring to #/$defs/inner that would trigger the $dynamicRef to need resolving.

I'll also update based on the result of this conversation in Slack, if needed. (Update: the test was wrong; updated here.)

@gregsdennis gregsdennis requested a review from a team as a code owner December 14, 2022 02:21
Copy link
Member

@jdesrosiers jdesrosiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing the way the schema is defined,

{
"description": "expected integers - additional property as integer is valid",
"data": {
"expectedTypes": "integers",
"anotherProperty": 42
},
"valid": true
},
.

I suggest changing "inner" to the following so it works as intended.

"inner": {
  "$id": "inner",
  "$dynamicAnchor": "foo",
  "type": "object",
  "properties": {
    "expectedTypes": true
  },
  "additionalProperties": {
    "$dynamicRef": "#foo"
  }
}

Without declaring properties, the additionalProperties will apply to "expectedTypes" as well and expect it to be an integer, which is impossible (it can't be the string "integers" and an integer at the same time).

@gregsdennis
Copy link
Member Author

This test is failing the way the schema is defined

Yeah, it seems the "2020-12" issue is causing my validator to ignore propertyDependencies. Changing this locally causes that problem. I'll update.

@gregsdennis gregsdennis merged commit 6b3cac4 into main Dec 14, 2022
@gregsdennis gregsdennis deleted the gregsdennis/propertyDependencies-fixups branch December 14, 2022 21:17
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.

2 participants