def test_json_schema_input_type_with_refs(validator) -> None:
    """Test that `'definition-ref` schemas for `json_schema_input_type` are supported.

    See: https://github.com/pydantic/pydantic/issues/10434.
    See: https://github.com/pydantic/pydantic/issues/11033
    """

    class Sub1(BaseModel):
        pass

    class Sub2(BaseModel):
        pass

    class Model(BaseModel):
        sub: Annotated[
            Union[Sub1, Sub2],
            PlainSerializer(lambda v: v, return_type=Union[Sub1, Sub2]),
            validator,
        ]

    json_schema = Model.model_json_schema()

    assert 'Sub1' in json_schema['$defs']
    assert 'Sub2' in json_schema['$defs']
    assert json_schema['properties']['sub'] == {
        'anyOf': [{'$ref': '#/$defs/Sub1'}, {'$ref': '#/$defs/Sub2'}],
        'title': 'Sub',
    }
Test that `'definition-ref` schemas for `json_schema_input_type` are supported.

    See: https://github.com/pydantic/pydantic/issues/10434.
    See: https://github.com/pydantic/pydantic/issues/11033
    
tests/test_json_schema.py