def test_arbitrary_ref_in_json_schema() -> None:
    """See https://github.com/pydantic/pydantic/issues/9981."""

    class Test(BaseModel):
        x: dict = Field(examples=[{'$ref': '#/components/schemas/Pet'}])

    assert Test.model_json_schema() == {
        'properties': {
            'x': {
                'additionalProperties': True,
                'examples': [{'$ref': '#/components/schemas/Pet'}],
                'title': 'X',
                'type': 'object',
            }
        },
        'required': ['x'],
        'title': 'Test',
        'type': 'object',
    }
See https://github.com/pydantic/pydantic/issues/9981.
tests/test_json_schema.py