After digging a bit deeper into the pydantic code I found a nice little way to prevent this. There is a method called field_title_should_be_set(...) in GenerateJsonSchema which can be subclassed and provided to model_json_schema(...).

I'm not sure if the way I've overwritten the method is sufficient for each edge case but at least for this little test class it works as intended.

from pydantic import BaseModel
from pydantic._internal._core_utils import is_core_schema, CoreSchemaOrField
from pydantic.json_schema import GenerateJsonSchema


class Test(BaseModel):
    a: int

class GenerateJsonSchemaWithoutDefaultTitles(GenerateJsonSchema):
    def field_title_should_be_set(self, schema: CoreSchemaOrField) -> bool:
        return_value = super().field_title_should_be_set(schema)
        if return_value and is_core_schema(schema):
            return False
        return return_value

json_schema = Test.model_json_schema(schema_generator=GenerateJsonSchemaWithoutDefaultTitles)
assert "title" not in json_schema["properties"]["a"]
Answer from lord_haffi on Stack Overflow
🌐
Pydantic
docs.pydantic.dev › latest › concepts › json_schema
JSON Schema - Pydantic Validation
At both the field and model levels, you can use the json_schema_extra option to add extra information to the JSON schema. For custom types, Pydantic offers other tools for customizing JSON schema generation:
🌐
Medium
medium.com › @kishanbabariya101 › episode-8-json-schema-generation-in-pydantic-9a4c4fee02c8
Episode 8: JSON Schema Generation in Pydantic | by Kishan Babariya | Medium
December 17, 2024 - Feature Description Automatic Schema ... API docs and validation. Customization Use Field and json_schema_extra to add descriptions, examples, and override field definitions....
🌐
FastAPI
fastapi.tiangolo.com › tutorial › schema-extra-example
Declare Request Example Data - FastAPI
... Even after OpenAPI 3.1.0 was ... examples inside a Pydantic model, using schema_extra or Field(examples=["something"]) that example is added to the JSON Schema for that Pydantic model....
🌐
GitHub
github.com › litestar-org › litestar › issues › 3054
Bug: Pydantic's `json_schema_extra` is not passed to the generated OpenAPI spec · Issue #3054 · litestar-org/litestar
January 31, 2024 - The json_schema_extra (and other fields?) should be copied over to the schema. import uvicorn from litestar import Litestar, get from litestar.openapi import ResponseSpec from pydantic import BaseModel, ConfigDict, Field class Payload(BaseModel): model_config = ConfigDict( title="Some label", json_schema_extra={ "examples": [ { "field": "VALUE1" }, { "field": "VALUE2" } ], "not": { "type": "integer" } } ) field: str = Field(default=..., json_schema_extra={"x-local-extension": True}) @get( responses={ 200: ResponseSpec(Payload, generate_examples=False) } ) async def hello() -> Payload: pass app = Litestar( route_handlers=[hello], ) uvicorn.run(app)
Author   tuukkamustonen
🌐
Pydantic
docs.pydantic.dev › latest › api › fields
Fields - Pydantic Validation
Field( default: ellipsis, *, alias: ... discriminator: str | Discriminator | None = _Unset, deprecated: Deprecated | str | bool | None = _Unset, json_schema_extra: ( JsonDict | Callable[[JsonDict], None] | None ) = _Unset, frozen: bool | None = _Unset, validate_default: bool ...
🌐
Instructor
python.useinstructor.com › concepts › fields
Customizing Pydantic Models with Field Metadata - Instructor
In some cases, you may wish to have the language model ignore certain fields in your model. You can do this by using Pydantic's SkipJsonSchema annotation. This omits a field from the JSON schema emitted by Pydantic (which instructor uses for constructing its prompts and tool definitions).
Find elsewhere
🌐
GitHub
github.com › pydantic › pydantic › discussions › 8476
Popping "title" from the schema in json_schema_extra does not change the schema. · pydantic/pydantic · Discussion #8476
I am still getting a problem with composite models - the title field is not removed from the definitions in the schema: from typing import Dict, Any, Type from pydantic import BaseModel import json from typing import List, Optional class OpenAIFunctionBase(BaseModel): @classmethod def model_json_schema(cls, *args, **kwargs) -> dict[str, Any]: schema = super().model_json_schema(*args, **kwargs) schema.pop('title', None) for prop in schema.get('properties', {}).values(): prop.pop('title', None) return schema class SomeOne(OpenAIFunctionBase): name: str age: int class Foo(OpenAIFunctionBase): cou
Author   pydantic
🌐
Pydantic
pydantic.com.cn › ja › concepts › json_schema
JSON Schema - Pydanticドキュメント
By design, this class breaks the JSON schema generation process into smaller methods that can be easily overridden in subclasses to modify the "global" approach to generating JSON schema. ``` py from pydantic import BaseModel from pydantic.json_schema import GenerateJsonSchema
🌐
Zenn
zenn.dev › 7shi › articles › 20251231-pydantic_ge_le
Pydantic V2 における Field 制約
December 31, 2025 - PydanticDeprecatedSince20: Using extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead.
🌐
Xiniushu
fastapi.xiniushu.com › de › tutorial › schema-extra-example
Declare Request Example Data - FastAPI
If the ideas above already work for you, that might be enough, and you probably don't need these details, feel free to skip them. When you add an example inside of a Pydantic model, using schema_extra or Field(example="something") that example is added to the JSON Schema for that Pydantic model.
🌐
Pydantic
pydantic.com.cn › en › api › fields
Fields - Pydantic documentation (en)
Field( default: Any = ... discriminator: str | Discriminator | None = _Unset, deprecated: Deprecated | str | bool | None = _Unset, json_schema_extra: ( JsonDict | Callable[[JsonDict], None] | None ) = _Unset, frozen: bool | None = _Unset, validate_default: bool ...
🌐
GitHub
github.com › samuelcolvin › pydantic › issues › 1564
Advice for setting schema_extra on primitive types · Issue #1564 · pydantic/pydantic
May 26, 2020 - Customising the schema by implementing a config on Samples with a schema_extra static function (as per the docs) which targets a specific case (schema["properties"]["samples"]["items"]["format"] = "my-format"), but this doesn't generalise for any T (T may be a nested array of strings which also require specifying format on their elements).
Published   May 26, 2020
Author   lewisbelcher
🌐
Pydantic
docs.pydantic.dev › latest › concepts › models
Models - Pydantic Validation
model_validate_strings(): data is validated as a dictionary (can be nested) with string keys and values and validates the data in JSON mode so that said strings can be coerced into the correct types. Compared to using the model constructor, it is possible to control several validation parameters when using the model_validate_*() methods (strictness, extra data, validation context, etc.).
🌐
GitHub
github.com › fastapi › sqlmodel › pull › 1035
Field() supports json_schema_extra for Pydantic v2 #1035
July 26, 2024 - Instead, any extra data you want to add to the JSON schema should be passed as a dictionary to the json_schema_extra keyword argument. So I modified the Field's parameters to be compatible and consistent with the Pydantic v2 parameters, and ...
Author   fastapi
🌐
GitHub
github.com › pydantic › pydantic › discussions › 4168
Generate multiple JSON schema files that refer to each others · pydantic/pydantic · Discussion #4168
The short answer is that I don't think there's much appetite to support this directly from pydantic. ... edit schema() for each model (you could use a common base class) to include the file name in the schema under some item name that JSON Schema and your tool ignore
Author   pydantic
🌐
LangChain
python.langchain.com › v0.1 › docs › modules › model_io › output_parsers › types › pydantic
Pydantic parser
LangChain is an open source framework with a prebuilt agent architecture and integrations for any model or tool—so you can build agents that adapt as fast as the ecosystem evolves
🌐
AWS Cloud Community
docs.powertools.aws.dev › lambda › python › stage › api › utilities › parser › index.html
aws_lambda_powertools.utilities.parser API documentation
This option can be applied only to iterable types (list, tuple, set, and frozenset). extra: (Deprecated) Extra fields that will be included in the JSON schema. !!! warning Deprecated The `extra` kwargs is deprecated. Use `json_schema_extra` instead. Returns: A new [`FieldInfo`][pydantic.fi...