|
|
@ -2,6 +2,7 @@ import importlib |
|
|
|
|
|
|
|
|
import pytest |
|
|
import pytest |
|
|
from fastapi.testclient import TestClient |
|
|
from fastapi.testclient import TestClient |
|
|
|
|
|
from inline_snapshot import snapshot |
|
|
|
|
|
|
|
|
from ...utils import needs_py310 |
|
|
from ...utils import needs_py310 |
|
|
|
|
|
|
|
|
@ -55,7 +56,8 @@ def test_read_user_item(client: TestClient, path, expected_json): |
|
|
def test_openapi_schema(client: TestClient): |
|
|
def test_openapi_schema(client: TestClient): |
|
|
response = client.get("/openapi.json") |
|
|
response = client.get("/openapi.json") |
|
|
assert response.status_code == 200 |
|
|
assert response.status_code == 200 |
|
|
assert response.json() == { |
|
|
assert response.json() == snapshot( |
|
|
|
|
|
{ |
|
|
"openapi": "3.1.0", |
|
|
"openapi": "3.1.0", |
|
|
"info": {"title": "FastAPI", "version": "0.1.0"}, |
|
|
"info": {"title": "FastAPI", "version": "0.1.0"}, |
|
|
"paths": { |
|
|
"paths": { |
|
|
@ -149,10 +151,13 @@ def test_openapi_schema(client: TestClient): |
|
|
"detail": { |
|
|
"detail": { |
|
|
"title": "Detail", |
|
|
"title": "Detail", |
|
|
"type": "array", |
|
|
"type": "array", |
|
|
"items": {"$ref": "#/components/schemas/ValidationError"}, |
|
|
"items": { |
|
|
|
|
|
"$ref": "#/components/schemas/ValidationError" |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
) |
|
|
|