✅ Add inline snapshot tests for OpenAPI before changes from Pydantic v2 (#14864)

This commit is contained in:
Sebastián Ramírez authored and GitHub committed 2026-02-08 10:18:38 +00:00
1 parent c48539f4c6
commit 9f4ecf562c
248 files changed
+28752 -27532

No files matched your search

@@ -2,6 +2,7 @@ import importlib
import pytest
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
@pytest.fixture(
@@ -33,21 +34,23 @@ def test_get_path(client: TestClient, path, expected_status, expected_response):
def test_openapi_schema(client: TestClient):
response = client.get("/openapi.json")
assert response.status_code == 200
assert response.json() == {
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Root",
"operationId": "root__get",
assert response.json() == snapshot(
{
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Root",
"operationId": "root__get",
}
}
}
},
}
},
}
)