diff --git a/README.md b/README.md index c6756f5..09d464e 100644 --- a/README.md +++ b/README.md @@ -357,6 +357,19 @@ cd /root/of/this/repo conda activate ./env ``` +### How to release + +1. Checkout branch +2. Update version X.Y.Z.YYYYMMDD in `pyproject.toml` + - Bump X.Y.Z according to semantic versioning 2.0.0 + - Set YYYYMMDD according to current UTC date +4. Update `poetry.lock` with `poetry update` +5. Push changes +6. Merge with main +7. Create release with title and tag `vX.Y.Z.YYYYMMDD` (prepend `v` in both) +8. PyPI is automatically published + + ### Paradigms #### Use the top-level `__init__.py` to declare a 'public' API for the module diff --git a/jsonschema_fill_default/jsonschema_fill_default.py b/jsonschema_fill_default/jsonschema_fill_default.py index c6534ba..debabd0 100644 --- a/jsonschema_fill_default/jsonschema_fill_default.py +++ b/jsonschema_fill_default/jsonschema_fill_default.py @@ -136,8 +136,9 @@ def _fill_properties(instance: dict, schema: dict): if _property not in instance: instance[_property] = dict() fill_default(instance[_property], subschema) - if len(instance[_property]) == 0: # No default found inside - del instance[_property] + if isinstance(instance[_property], (list, tuple, dict, set)): + if len(instance[_property]) == 0: # No default found inside + del instance[_property] if _property not in instance \ and "default" in subschema: instance[_property] = subschema["default"] diff --git a/pyproject.toml b/pyproject.toml index 56e6b78..2bb8afe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jsonschema-fill-default" -version = "0.1.1.20250130" +version = "0.1.2.20250130" description = "Fill a JSON instance with the missing defaults from its JSON Schema Draft 2020-12-valid schema" authors = ["Lars Maxfield"] readme = "README.md" diff --git a/tests/unit/test_validate_and_fill.py b/tests/unit/test_validate_and_fill.py index 03ac64f..06e004e 100644 --- a/tests/unit/test_validate_and_fill.py +++ b/tests/unit/test_validate_and_fill.py @@ -703,7 +703,7 @@ } } ] - }, + } }