A bug was identified where computed properties in the base model were not serialized correctly due to an overridden dict() method. The method was initially designed to inject properties, but since the introduction of model_dump as a naming convention, it no longer executed the necessary code when yaml() was called.
Fixes Included:
Introduced an alias for dict() that delegates to model_dump to resolve naming conflicts.
Used the computed_fields decorator from Pydantic v2 for properties that require serialization.
Got rid of original PropertyBaseModel
Test Plan:
Added a new unit test to ensure that the model_dump() method correctly returns a dictionary with the computed fields. This test fails on the main branch but passes on this branch.
Confirmed that the original test failures are resolved with this update.
Description:
A bug was identified where computed properties in the base model were not serialized correctly due to an overridden dict() method. The method was initially designed to inject properties, but since the introduction of model_dump as a naming convention, it no longer executed the necessary code when yaml() was called.
Fixes Included:
PropertyBaseModel
Test Plan:
model_dump()
method correctly returns a dictionary with the computed fields. This test fails on the main branch but passes on this branch.