def test_external_ref():
    """https://github.com/pydantic/pydantic/issues/9783"""

    class Model(BaseModel):
        json_schema: Annotated[
            dict,
            WithJsonSchema({'$ref': 'https://json-schema.org/draft/2020-12/schema'}),
        ]

    assert Model.model_json_schema() == {
        'properties': {'json_schema': {'$ref': 'https://json-schema.org/draft/2020-12/schema', 'title': 'Json Schema'}},
        'required': ['json_schema'],
        'title': 'Model',
        'type': 'object',
    }
https://github.com/pydantic/pydantic/issues/9783
tests/test_json_schema.py