-
Notifications
You must be signed in to change notification settings - Fork 65
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
Can't insert property defaults when using definitions #173
Comments
It does not depend on |
Thanks for opening this, @rquant! Looks like refs aren't followed when checking for |
davishmcclurg
added a commit
that referenced
this issue
Feb 25, 2024
This resolves any `ref_schema` keywords (`$ref`, `$dynamicRef`, `$recursiveRef`) when looking for `default` keywords for `insert_property_defaults`. It follows the keyword order defined in the vocabulary (`$ref` first, then `$dynamicRef`/`$recursiveRef` depending on the meta schema) and searches depth-first (ie, follows a `$ref` chain until a leaf schema before moving on to a sibling `$dynamicRef`). The first `default` keyword found is used, meaning a `$ref` default can be overwritten by the including schema, eg: ```json { "properties": { "example": { "$ref": "#/$defs/ref", "default": "override!" } }, "$defs": { "ref": { "default": "overridden" } } } ``` Closes: #173
davishmcclurg
added a commit
that referenced
this issue
Mar 2, 2024
davishmcclurg
added a commit
that referenced
this issue
Mar 2, 2024
Merged
Fix has been merge and will be released shortly in 2.2.0. Original example works now:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi I am trying to create a re-usable definition in my schema, that contains some property defaults. Here is an example of my schema:
The issue is it doesn't appear the references are being resolved, and I'm not seeing default values being inserted into my empty hash:
Any idea on why this doesn't work? Do I need to provide a custom
ref_resolver
?Thanks!
The text was updated successfully, but these errors were encountered: