feat: adds support for list of types #66
Reference in New Issue
Block a user
Delete Branch "feature/support-type-list"
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 #59
This pull request improves the handling and parsing of JSON Schema
typedefinitions, especially when thetypefield is a list, and adds corresponding tests to ensure correctness. The main changes include normalizing thetypeproperty in schemas, updating type annotations, and enhancing test coverage for edge cases.JSON Schema type normalization and parsing improvements
_normalize_propertiesstatic method injambo/parser/_type_parser.pyto standardize thetypefield in schema properties, handling cases wheretypeis a string, a list with one item, a list with multiple items (converted toanyOf), or an empty list (raisesInvalidSchemaException).typeannotation injambo/types/json_schema_type.pyto accept both a single type and a list of types, reflecting the normalization logic.Test coverage for type parsing edge cases
tests/test_schema_converter.pyto verify correct parsing when thetypefield is a list with multiple values, a list with a single value, and to ensure an error is raised for an empty list.Codecov Report
❌ Patch coverage is
95.00000%with1 linein your changes missing coverage. Please review.📢 Thoughts on this report? Let us know!