dbt-labs / hologram

A library for automatically generating Draft 7 JSON Schemas from Python dataclasses
MIT License
9 stars 13 forks source link

Add a NewPatternProperties that reutrns a type that implements patternProperties #13

Closed beckjake closed 5 years ago

beckjake commented 5 years ago

Fixes #10

This goes a bit further and allows you to define a generic type that is a patternProperties object, rather than just containing one (skipping the outer layer described there). Getting both the is-a relationship and this working was a bit of an ordeal and meant I didn't feel great just tossing it into helpers, the only thing I could get playing nice was to check the stringy-type of the class name (ugh!).

Also, it would be cool to get it to treat this thing as an actual generic type like the typing module gets (with __args__ and such) - I gave up on that for now in favor of a silly type-level constant, as it seemed like the kind of thing I could spend a long time on and get nowhere.