|
|
|
@ -43,7 +43,8 @@ def test_get_plane(client: TestClient): |
|
|
|
def test_openapi_schema(client: TestClient): |
|
|
|
response = client.get("/openapi.json") |
|
|
|
assert response.status_code == 200, response.text |
|
|
|
assert response.json() == snapshot({ |
|
|
|
assert response.json() == snapshot( |
|
|
|
{ |
|
|
|
"openapi": "3.1.0", |
|
|
|
"info": {"title": "FastAPI", "version": "0.1.0"}, |
|
|
|
"paths": { |
|
|
|
@ -57,8 +58,12 @@ def test_openapi_schema(client: TestClient): |
|
|
|
"schema": { |
|
|
|
"title": "Response Read Item Items Item Id Get", |
|
|
|
"anyOf": [ |
|
|
|
{"$ref": "#/components/schemas/PlaneItem"}, |
|
|
|
{"$ref": "#/components/schemas/CarItem"}, |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/PlaneItem" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/CarItem" |
|
|
|
}, |
|
|
|
], |
|
|
|
} |
|
|
|
} |
|
|
|
@ -96,7 +101,11 @@ def test_openapi_schema(client: TestClient): |
|
|
|
"type": "object", |
|
|
|
"properties": { |
|
|
|
"description": {"title": "Description", "type": "string"}, |
|
|
|
"type": {"title": "Type", "type": "string", "default": "plane"}, |
|
|
|
"type": { |
|
|
|
"title": "Type", |
|
|
|
"type": "string", |
|
|
|
"default": "plane", |
|
|
|
}, |
|
|
|
"size": {"title": "Size", "type": "integer"}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -106,7 +115,11 @@ def test_openapi_schema(client: TestClient): |
|
|
|
"type": "object", |
|
|
|
"properties": { |
|
|
|
"description": {"title": "Description", "type": "string"}, |
|
|
|
"type": {"title": "Type", "type": "string", "default": "car"}, |
|
|
|
"type": { |
|
|
|
"title": "Type", |
|
|
|
"type": "string", |
|
|
|
"default": "car", |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
"ValidationError": { |
|
|
|
@ -132,10 +145,13 @@ def test_openapi_schema(client: TestClient): |
|
|
|
"detail": { |
|
|
|
"title": "Detail", |
|
|
|
"type": "array", |
|
|
|
"items": {"$ref": "#/components/schemas/ValidationError"}, |
|
|
|
"items": { |
|
|
|
"$ref": "#/components/schemas/ValidationError" |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
) |
|
|
|
|