Add checks to default and default_factory arguments in Mypy plugin, #3430 by @klaa97 fix mangling of inspect.signature for BaseModel, #3413 by @fix-inspect-signature Adds the SecretField abstract class so that
Use parent model's Config when validating nested NamedTuple fields, #4219 by @synek Update BaseModel.construct to work with aliased Fields, #4192 by @kylebamos Catch certain raised errors in smart_deepcopy and revert to deepcopy if so, #4184 by @coneybeare Add Config.anystr_upper and to...
Here’s a breakdown of the Field parameters you used to add additional validation and metadata to your fields: default_factory: You use this to define a callable that generates default values. In the example above, you set default_factory to uuid4. This calls uuid4() to generate a random...
Do not evaluate annotations for private fields by @Viicos in #10962 Support serialization as any for Secret types and Url types by @sydney-runkle in #10947 Fix type hint of Field.default to be compatible with Python 3.8 and 3.9 by @Viicos in #10972 Add hashing support for URL types by...
Update BaseModel.construct to work with aliased Fields, #4192 by @kylebamos Catch certain raised errors in smart_deepcopy and revert to deepcopy if so, #4184 by @coneybeare Add Config.anystr_upper and to_upper kwarg to constr and conbytes, #4165 by @satheler Fix JSON schema for set ...
As a workaround, I'm using a dynamically generated string enum. Contributor dmontagu commented Mar 4, 2024 • edited @WillDaSilva does the following not work for you? from typing import Literal from pydantic import BaseModel class A(BaseModel): x: Literal['a', 'b', 'c'] print(A...
And pick the name and port, replacing the fields: docker run -d \ --name {NAME} \ -p {PORT}:{PORT} \ redis:alpine Such as docker run -d \ --name redis \ -p 6379:6379 \ redis:alpine 4.2.4. Running the API While in therootfolder, run to start the application with uvicorn ...
Add support for dataclass fields init by @dmontagu in #8552 Implement pickling for ValidationError by @davidhewitt in pydantic/pydantic-core#1119 Add unified tuple validator that can handle "variadic" tuples via PEP-646 by @dmontagu in pydantic/pydantic-core#865 Changes Drop Python3.7 support ...