-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
bug V2Bug related to Pydantic V2Bug related to Pydantic V2
Description
Initial Checks
- I confirm that I'm using Pydantic V2
Description
Since upgrading to pydantic v2.10, when generating a JSON schema for a model class whose title is set to ""
, the model title in the JSON schema is the name of the model class instead of ""
. In v2.9.2 and prior the title in the schema would also be ""
, which is the behaviour I would expect.
The title is still set correctly in the JSON schema when it is not blank.
Example Code
from pydantic import BaseModel, ConfigDict
class Foo(BaseModel, title=""): # Specify title in class arguments
pass
foo_schema = Foo.model_json_schema() # Title in JSON schema is "Foo"
class Bar(BaseModel):
model_config = ConfigDict(title="") # Specify title in model config
bar_schema = Bar.model_json_schema() # Title in JSON schema is "Bar"
Python, Pydantic & OS Version
pydantic version: 2.10.0
pydantic-core version: 2.27.0
pydantic-core build: profile=release pgo=false
install path: /Users/jamieforsythe/dev/projects/rt-logic-apps/.venv/lib/python3.11/site-packages/pydantic
python version: 3.11.9 (main, Aug 28 2024, 15:08:32) [Clang 15.0.0 (clang-1500.3.9.4)]
platform: macOS-15.1-arm64-arm-64bit
related packages: mypy-1.13.0 fastapi-0.115.5 typing_extensions-4.12.2
commit: unknown
sydney-runkle
Metadata
Metadata
Assignees
Labels
bug V2Bug related to Pydantic V2Bug related to Pydantic V2