It would be helpful if it were possible to create a serialization configuration set automatically based on a Pydantic model (schema).
The specific intended use would be streamline development in a FastAPI context, and to eliminate the need to maintain parallel serialization/deserialization schemas when using SQLAthanor in an application that is also using Pydantic models (read: the vast majority of FastAPI implementations).
The syntax envisioned for this would be something along the lines of:
- add Pydantic model and iterable of Pydantic model as an additional supported type for the
config argument passed to validate_serialization_config()
- enable the
BaseModel.set_attribute_serialization_config() and BaseModel.configure_serialization() methods to accept Pydantic models as their config sets
- add an
AttributeConfiguration.from_pydantic() class method that will generate an attribute configuration based on a Pydantic model
Note that the solution developed will need support the application of multiple config_set settings, where each config_set will be built off of a separate Pydantic model.
It would be helpful if it were possible to create a serialization configuration set automatically based on a Pydantic model (schema).
The specific intended use would be streamline development in a FastAPI context, and to eliminate the need to maintain parallel serialization/deserialization schemas when using SQLAthanor in an application that is also using Pydantic models (read: the vast majority of FastAPI implementations).
The syntax envisioned for this would be something along the lines of:
configargument passed tovalidate_serialization_config()BaseModel.set_attribute_serialization_config()andBaseModel.configure_serialization()methods to accept Pydantic models as their config setsAttributeConfiguration.from_pydantic()class method that will generate an attribute configuration based on a Pydantic modelNote that the solution developed will need support the application of multiple
config_setsettings, where eachconfig_setwill be built off of a separate Pydantic model.