I am not able to find a simple way how to initialize a Pydantic object from field values given by position (for example in a list instead of a dictionary) so I
I have defined a pydantic Schema with extra = Extra.allow in Pydantic Config. Is it possible to get a list or set of extra fields passed to the Schema separatel
I have an enum : from enum import Enum class MyEnum(Enum): val1 = "val1" val2 = "val2" val3 = "val3" I would like to validate a pydantic field bas
From the pydantic docs I understand this: import pydantic class User(pydantic.BaseModel): id: int name: str class Student(pydantic.BaseModel): sem
Specifically, I want the below example to work: from typing import List from pydantic import BaseModel from fastapi import FastAPI, UploadFile, File app = Fas
I am trying to restrict one field in a class to an enum. However, when I try to get a dictionary out of class, it doesn't get converted to string. Instead it re
I'm new to FastAPI (migrating from Flask) and I'm trying to create a Pydantic model for my GET route: from fastapi import APIRouter,Depends from pydantic import
Suppose I have the following class: class ModelConfig(pydantic.BaseModel): name: str = "bert" If I were to instantiate it with model_config = ModelConfig(n
I wonder if this would somehow be possible: class Picture(BaseModel): src: Union[FilePath, stricturl(allowed_schemes=["https"])] I have this test, which is
Is there a way for a FastAPI application to not display a model in its schema documentation? I have some models which are slight variations of others, and with
I would like to set default email in case email not provided, i.e: name = a last_name = b email = None email will become "[email protected]" I tried something li
I'm trying to write pydantic validators, but I can't seem to understand how to make use of the kwargs argument that is mentioned in the docs. I would like to p
Problem in a nutshell I am having issues with the hypothesis build strategy and custom pydantic data types (no values are returned when invoking the build strat