I'm using a pydantic model to represent a request body in fastapi
.
from pydantic import BaseModel, Schema
class Files(BaseModel):
'''Class for file URLs'''
urls: Set[str] = Schema(..., title='Urls to files')
This will restrict the request body to set of urls defined as str
.
I was wondering if there's a way to further limit the "types" of urls sent in the body, by using e.g. regular expressions. I know Schema
has a regex
flags, but I think that will only work with a single input (or at least it didn't work with my lists).