toumorokoshi / jsonschema-extractor

Extract jsonschema from various Python objects
MIT License
26 stars 9 forks source link

fix typing extractor not handling IntEnum handler #10

Closed toumorokoshi closed 2 years ago

toumorokoshi commented 2 years ago

Addresses GitHub #9.

Adding a custom handler for IntEnum in TypingExtractor resulted in the int handler still being used, due to the handler resolver logic iterating through a list and checking for matches via seeing if the passed type is a subclass, rather than looking for the most granular match to the type it can.

Refactoring the logic to iterate the mro and find a match, which means it'll check for the most granular match first.