diff --git a/fastapi/_compat.py b/fastapi/_compat.py index fc605d0ec..13f596423 100644 --- a/fastapi/_compat.py +++ b/fastapi/_compat.py @@ -347,6 +347,7 @@ else: @dataclass class GenerateJsonSchema: # type: ignore[no-redef] ref_template: str + by_alias: bool = True class PydanticSchemaGenerationError(Exception): # type: ignore[no-redef] pass