I made a PyPI package that fills all missing defaults of an instance with its schema #1324
larsmaxfield
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I created the function
fill_default
packaged injsonschema-fill-default
which fills all missing defaults in an existing instance with its schema:The filling is done recursively for all missing and nested defaults. It works with all combinations of
"properties"
,"allOf"
,"anyOf"
,"oneOf"
,"dependentSchemas"
,"if-then(-else)"
,"prefixItems"
, and"items"
keywords.Note:
See Examples on the project's GitHub for details.
I created this because the need shows up in discussions online, along with there being a gap in a solution that works with more than just the "properties" keyword.
Beta Was this translation helpful? Give feedback.
All reactions