dbt-labs / hologram

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

Fix/validate union products #14

Closed beckjake closed 5 years ago

beckjake commented 5 years ago

Fix an issue where hologram will return an invalid value for a union of multiple incompatible JsonSchemaMixins.

Before this change, the ft.from_dict(val, validate=False) in the union's default would result in every entry in unioned being a Thing(a=None). It comes up when parsing packages.yml files.

In the future, we may may be forced to bypass the decoder cache in this case (to avoid caching or using a bad decoder), but I couldn't get it to break.