Skip to content

Resolve #22, #24 #25

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 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions jsonschema_fill_default/jsonschema_fill_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_validate_and_fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@
}
}
]
},
}
}


Expand Down