validation error when sending a json with the required field
New to Pydantic and fail to understand why this is failing when the json has the key.
Pydantic Inheritance Defaults
How can I typehint a parent basemodel such that a child subclass can provide defaults for some of the fields:
How to make all fields required in pydantic model
I have a pydantic (v2) model containing some fields with default values. I would like on some occasions for these models to be used in a “strict mode” where the default values are no longer available and every field must be supplied when using model_validate.
How to create a pydantic discriminated type union whose union members are imported during validation, depending on the discriminator?
I would like to implement a strategy pattern in pydantic, by taking the strategy string, importing it as a module, retrieving the model for that item for it, and continue model validation with the dynamically imported model.
Serializing pydantic enums
Just getting started with pydantic. I have this example code:
Pydantic list of lists output model gives error
I get an error {'loc': ('response', 'piegraphdata'), 'msg': 'value is not a valid list', 'type': 'type_error.list'}
on running the below code. I tried a number of variations but all give the same error. This is what I currently have:
create_model in Pydantic v1 doesn’t populate __fields__ attribute
I am using Pydantic v1 in a Langchain implementation of Custom Tools. When I staticly define a Pydantic class it will populate the __fields__
attribute of my class with metadata about the fields — which is needed by Langchain.
How to add and retrieve metadata on a pydantic field
I would like to add some metadata to model fields. This is not necessary for validation or serialisation but might be user for data display or perhaps as a hint when entering data.
For instance one might want to add a unit to a field.