You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the below example I set title, however I've found it won't work with any ConfigDict.json_schema_extra either, which is really what I require for my uses.
Example Code
fromtyping_extensionsimportTypedDictfrompydanticimportConfigDict, TypeAdapter# Tested on both my system and the live runner https://docs.pydantic.dev/2.6/errors/usage_errors/#type-adapter-config-unusedclassMyTypedDict(TypedDict):
x: int# or `model_config = ...` for BaseModel__pydantic_config__=ConfigDict(title="foobar")
type_adapter=TypeAdapter(MyTypedDict)
print(type_adapter.json_schema()) # The outputted json doesn't have the correct title.# OUTPUT# pydantic version: v2.6.0, pydantic-core version: v2.16.1# {'properties': {'x': {'title': 'X', 'type': 'integer'}}, 'required': ['x'], 'title': 'MyTypedDict', 'type': 'object'}
I just checked. Looks like this is a V2 problem in general, not a v2.6 problem. Nonetheless, definitely something that we want to fix! Thanks for reporting this. We'll look into a fix and try to include that in 2.7.0 :).
Hi @sydney-runkle & @evalott100 I was looking into this issue, I think, The typed_dict_schema function in json_schema.py is missing update for title and json_schema_extra. Can I create PR for this?
Initial Checks
Description
When generating json schema with pydantic,
__pydantic_config__
is ignored in the outputted json, contrary to what the docs explain.In the below example I set
title
, however I've found it won't work with anyConfigDict.json_schema_extra
either, which is really what I require for my uses.Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: