feature: adds example keywork #56
Reference in New Issue
Block a user
Delete Branch "feature/adds-example-keywork"
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?
This pull request adds support for handling and validating the
examplesproperty in type parsers, ensuring that example values are correctly parsed and validated according to their type and format. It also introduces comprehensive tests forexamplesacross multiple type parsers, and updates dependencies to support new features.Feature: Support for
examplesproperty in type parsersexamplesto thedefault_mappingsand implemented_validate_examplesand_is_valid_valuemethods inGenericTypeParser, enabling validation of example values for all types. (jambo/parser/_type_parser.py) [1] [2] [3]examplesinConstTypeParser, ensuring examples are mapped and validated for constant values. (jambo/parser/const_type_parser.py)EnumTypeParserto convert example values to enum members, ensuring type correctness. (jambo/parser/enum_type_parser.py)StringTypeParserto parse examples according to their format (e.g., date, time, uuid, ip), including a new_parse_examplehelper method. (jambo/parser/string_type_parser.py)Testing: Comprehensive tests for
examplessupportexamplesin boolean, const, enum, float, int, null, and string type parsers, covering various formats and edge cases. (tests/parser/test_bool_type_parser.py,tests/parser/test_const_type_parser.py,tests/parser/test_enum_type_parser.py,tests/parser/test_float_type_parser.py,tests/parser/test_int_type_parser.py,tests/parser/test_null_type_parser.py,tests/parser/test_string_type_parser.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]Dependency updates
pydanticto version2.12.4for improved type validation compatibility. (pyproject.toml)Miscellaneous
jambo/parser/string_type_parser.py,tests/parser/test_string_type_parser.py) [1] [2]Codecov Report
❌ Patch coverage is
96.66667%with1 linein your changes missing coverage. Please review.📢 Thoughts on this report? Let us know!
Pull request closed