Closed DiamondJoseph closed 2 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.25%. Comparing base (
f49320c
) to head (688265e
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Current handling requires that subclasses of type annotated with discriminated_union_of_subclasses
are Pydantic dataclasses, which I will add to the docstring: this way their schema is generated after Spec has had it schema updated.
Types that want to have their schema updated when a new instance of a class decorated with discriminated_union_of_subclasses
must also either be Pydantic dataclasses or BaseModels.
The FastAPI schema for the routes into the service does not update when a new subclass is created, nor do any types that refer to types that refer to a discriminated union.
If Pydantic exposed some way of propagating that a schema that is used in the schema of a model has updated, so the schema of the model must also update, then _TaggedUnion
could remove all handling of references and just rebuild_dataclass(self._baseclass
)
I've made an issue for that last part, but I don't think it will gain much traction as I think creating runtime models often goes against the purpose of validation
Fixes #130, #131