Repository navigation
Releases
Releases · CSharplie/pyjeb
v1.3.0
What's Changed
- Enhance expression support and add conditional rules by @CSharplie in #32
- feat: integrate commitizen for automatic versioning by @CSharplie in #33
- Configure CI for Commitizen bump and versioning updates by @CSharplie in #34
- Enhance documentation structure and sync with wiki by @CSharplie in #35
- Enhance expression support, versioning, and documentation structure by @CSharplie in #36
- fix(controls): resolve conditional default checks to accept types other than string by @Rd-Massou in #37
- Fix conditional default checks to support multiple types by @CSharplie in #38
New Contributors
- @Rd-Massou made their first contribution in #37
Full Changelog: v1.0.5...v1.3.0
v1.0.5
v1.0.4
new features
alow single value in list
It's now possible to provide a single value in list
Exemple :
controls = [
{ "name": "vehicles", "type": "dict" },
{ "name": "vehicles.cars", "type": "list" },
{ "name": "vehicles.cars.color", "validset": ["red", "blue", r"^#(?:[0-9a-fA-F]{3}){1,2}$"] },
{ "name": "vehicles.cars.is_broken", "type": "boolean", "default": False },
{ "name": "vehicles.cars.buy_date" },
{ "name": "vehicles.cars.type", "default": "usual", "expressions": ["if color == 'red' return 'sportive'"] }
]
# before the only way to provide a single value was to use a dict
# data = {
# "vehicles": {
# "cars": [
# {
# "color": "red",
# "is_broken": False,
# "buy_date": "2021-01-01"
# }
# ]
# }
# }
# now it's possible to provide a single value in list
data = {
"vehicles": {
"cars": {
"color": "red",
"is_broken": False,
"buy_date": "2021-01-01"
}
}
}
control_and_setup(controls, data)
print (data)Output:
if a single value is provided then the value is converted to a list
{
"vehicles": {
"cars": [
{
"color": "red",
"is_broken": false,
"buy_date": "2021-01-01",
"type": "sportive"
}
]
}
}v1.0.3
new features
regex on validset
It's now possible to setup a validset with value and regex.
Exemple :
controls = [
{ "name": "vehicles", "type": "dict" },
{ "name": "vehicles.cars", "type": "list" },
# The validset allow value "red", "bleue" and hexadecimal color (like #FFBB19)
{ "name": "vehicles.cars.color", "validset": ["red", "blue", r"^#(?:[0-9a-fA-F]{3}){1,2}$"] },
{ "name": "vehicles.cars.is_broken", "type": "boolean", "default": False },
{ "name": "vehicles.cars.buy_date" },
{ "name": "vehicles.cars.type", "default": "usual", "expressions": ["if color == 'red' return 'sportive'"] }
]