fix: fixes invalid subobject required #61
Reference in New Issue
Block a user
Delete Branch "fix/object-invalid-required"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Solves #60
This pull request introduces an improvement to the handling of default values for object properties in the parser, as well as a new test to validate the behavior when required fields are specified incorrectly in object schemas. These changes help ensure that optional object properties are correctly initialized and that schema conversion adheres to expected requirements logic.
Object property defaults and schema validation:
jambo/parser/object_type_parser.pyto ensure that if a property is not marked as required, itsdefault_factoryis set to returnNoneunless a default value is provided. This change improves the handling of optional fields by making sure they default toNonewhen not required or not explicitly given a default value.Testing schema conversion edge cases:
test_object_invalid_requireintests/test_schema_converter.pyto verify that object properties not listed as required are correctly treated as optional, even when nested within other properties. This test checks that thedescriptionfield is not required, helping to catch potential issues with required field logic in schema conversion.