(improvement): Adds More Type Formats to String Parser #42

Merged
HideyoshiNakazone merged 2 commits from improvement/better-string-validations into main 2025-08-20 03:31:46 +00:00
HideyoshiNakazone commented 2025-08-20 03:25:25 +00:00 (Migrated from github.com)

This pull request updates how string formats are parsed and validated, aligning the implementation with the latest pydantic types and improving standards compliance. The changes include switching from generic types to more specific ones for URLs and IP addresses, updating the corresponding parser logic, and adjusting the tests to match these changes.

Parser improvements and standards compliance:

  • Updated StringTypeParser to use AnyUrl instead of HttpUrl for the "uri" format, and to use IPv4Address/IPv6Address instead of IPvAnyAddress for "ipv4" and "ipv6" formats. The "uuid" format is also now supported using the UUID type. (jambo/parser/string_type_parser.py) [1] [2]

Test updates:

  • Updated tests to expect AnyUrl instead of HttpUrl for URI formats and to expect IPv4Address/IPv6Address instead of IPvAnyAddress for IP formats. (tests/parser/test_string_type_parser.py, tests/test_schema_converter.py) [1] [2] [3] [4] [5]
This pull request updates how string formats are parsed and validated, aligning the implementation with the latest pydantic types and improving standards compliance. The changes include switching from generic types to more specific ones for URLs and IP addresses, updating the corresponding parser logic, and adjusting the tests to match these changes. **Parser improvements and standards compliance:** * Updated `StringTypeParser` to use `AnyUrl` instead of `HttpUrl` for the `"uri"` format, and to use `IPv4Address`/`IPv6Address` instead of `IPvAnyAddress` for `"ipv4"` and `"ipv6"` formats. The `"uuid"` format is also now supported using the `UUID` type. (`jambo/parser/string_type_parser.py`) [[1]](diffhunk://#diff-c015f8e8aa329bed6e1ef3b8f808ef126f8fc98cbcda76ce1fef73dffa32f7e4L4-R9) [[2]](diffhunk://#diff-c015f8e8aa329bed6e1ef3b8f808ef126f8fc98cbcda76ce1fef73dffa32f7e4L23-R40) **Test updates:** * Updated tests to expect `AnyUrl` instead of `HttpUrl` for URI formats and to expect `IPv4Address`/`IPv6Address` instead of `IPvAnyAddress` for IP formats. (`tests/parser/test_string_type_parser.py`, `tests/test_schema_converter.py`) [[1]](diffhunk://#diff-a04dd229fa580e9b8381b07750c65b2aff073ce3d5d5e0932e37216efc6af738L3-R6) [[2]](diffhunk://#diff-a04dd229fa580e9b8381b07750c65b2aff073ce3d5d5e0932e37216efc6af738L114-R122) [[3]](diffhunk://#diff-a04dd229fa580e9b8381b07750c65b2aff073ce3d5d5e0932e37216efc6af738L129-R132) [[4]](diffhunk://#diff-04f19b964ef1fadc9b51ecb3b8ddff05392ba340be55cccf56c5a8ca49c11d5aL3-R3) [[5]](diffhunk://#diff-04f19b964ef1fadc9b51ecb3b8ddff05392ba340be55cccf56c5a8ca49c11d5aL466-R466)
codecov-commenter commented 2025-08-20 03:31:24 +00:00 (Migrated from github.com)

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

:warning: Please install the !['codecov app svg image'](https://github.com/codecov/engineering-team/assets/152432831/e90313f4-9d3a-4b63-8b54-cfe14e7ec20d) to ensure uploads and comments are reliably processed by Codecov. ## [Codecov](https://app.codecov.io/gh/HideyoshiNakazone/jambo/pull/42?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vitor+Hideyoshi) Report :white_check_mark: All modified and coverable lines are covered by tests. :loudspeaker: Thoughts on this report? [Let us know!](https://github.com/codecov/feedback/issues/255)
Sign in to join this conversation.