Better Internat Static Typing #46
Reference in New Issue
Block a user
Delete Branch "feature/better-internal-typing"
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 refactors the type parsing logic across several parser modules to consistently use the
JSONSchematype for schema properties. It also improves type safety and clarity, adds missing type annotations, and introduces better error handling for$refparsing. The changes affect the core type parser, as well as theallOf,enum,object,oneOf, and$reftype parsers.Type annotation and type safety improvements:
GenericTypeParserand all derived parsers (allOf,enum,object,$ref) to use theJSONSchematype for schema properties, replacing genericdict[str, Any]usage. This ensures consistent type checking and better IDE support. [1] [2] [3] [4] [5]Annotationalias for clarity in theoneOfparser. [1] [2] [3] [4]Error handling and logic improvements:
$refparsing inRefTypeParserby adding explicit error handling for unsupported or invalid references, and refactored cache logic to handle missing references more robustly. [1] [2] [3] [4] [5]required=Trueflag when building object types in the schema converter, ensuring required fields are properly handled.Miscellaneous fixes and improvements:
# type: ignorecomments where necessary to suppress type checker warnings for dynamic or runtime behaviors, such as dynamic enum creation and model generation. [1] [2] [3] [4]These changes collectively make the codebase more robust, easier to maintain, and safer for future development.
Codecov Report
✅ All modified and coverable lines are covered by tests.
📢 Thoughts on this report? Let us know!