|
|
|
@ -7,6 +7,8 @@ from fastapi._compat.v1 import BaseModel |
|
|
|
from fastapi.testclient import TestClient |
|
|
|
from inline_snapshot import snapshot |
|
|
|
|
|
|
|
from tests.utils import pydantic_snapshot |
|
|
|
|
|
|
|
|
|
|
|
class Item(BaseModel): |
|
|
|
name: str |
|
|
|
@ -571,14 +573,23 @@ def test_openapi_schema(): |
|
|
|
"required": True, |
|
|
|
"content": { |
|
|
|
"application/json": { |
|
|
|
"schema": { |
|
|
|
"title": "Body", |
|
|
|
"allOf": [ |
|
|
|
"schema": pydantic_snapshot( |
|
|
|
v1=snapshot( |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_update_item_items__item_id__put" |
|
|
|
} |
|
|
|
], |
|
|
|
} |
|
|
|
), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"title": "Body", |
|
|
|
"allOf": [ |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_update_item_items__item_id__put" |
|
|
|
} |
|
|
|
], |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -783,14 +794,23 @@ def test_openapi_schema(): |
|
|
|
"requestBody": { |
|
|
|
"content": { |
|
|
|
"application/json": { |
|
|
|
"schema": { |
|
|
|
"allOf": [ |
|
|
|
"schema": pydantic_snapshot( |
|
|
|
v1=snapshot( |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_create_item_embed_items_embed__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"allOf": [ |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_create_item_embed_items_embed__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
} |
|
|
|
}, |
|
|
|
"required": True, |
|
|
|
@ -820,14 +840,23 @@ def test_openapi_schema(): |
|
|
|
"requestBody": { |
|
|
|
"content": { |
|
|
|
"application/x-www-form-urlencoded": { |
|
|
|
"schema": { |
|
|
|
"allOf": [ |
|
|
|
"schema": pydantic_snapshot( |
|
|
|
v1=snapshot( |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_submit_form_form_data__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"allOf": [ |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_submit_form_form_data__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
} |
|
|
|
}, |
|
|
|
"required": True, |
|
|
|
@ -857,14 +886,23 @@ def test_openapi_schema(): |
|
|
|
"requestBody": { |
|
|
|
"content": { |
|
|
|
"multipart/form-data": { |
|
|
|
"schema": { |
|
|
|
"allOf": [ |
|
|
|
"schema": pydantic_snapshot( |
|
|
|
v1=snapshot( |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_upload_file_upload__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"allOf": [ |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_upload_file_upload__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
} |
|
|
|
}, |
|
|
|
"required": True, |
|
|
|
@ -894,14 +932,23 @@ def test_openapi_schema(): |
|
|
|
"requestBody": { |
|
|
|
"content": { |
|
|
|
"multipart/form-data": { |
|
|
|
"schema": { |
|
|
|
"allOf": [ |
|
|
|
"schema": pydantic_snapshot( |
|
|
|
v1=snapshot( |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_upload_multiple_files_upload_multiple__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"allOf": [ |
|
|
|
{ |
|
|
|
"$ref": "#/components/schemas/Body_upload_multiple_files_upload_multiple__post" |
|
|
|
} |
|
|
|
], |
|
|
|
"title": "Body", |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
} |
|
|
|
}, |
|
|
|
"required": True, |
|
|
|
@ -928,12 +975,21 @@ def test_openapi_schema(): |
|
|
|
"components": { |
|
|
|
"schemas": { |
|
|
|
"Body_create_item_embed_items_embed__post": { |
|
|
|
"properties": { |
|
|
|
"item": { |
|
|
|
"allOf": [{"$ref": "#/components/schemas/Item"}], |
|
|
|
"title": "Item", |
|
|
|
} |
|
|
|
}, |
|
|
|
"properties": pydantic_snapshot( |
|
|
|
v1=snapshot( |
|
|
|
{"item": {"$ref": "#/components/schemas/Item"}} |
|
|
|
), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"item": { |
|
|
|
"allOf": [ |
|
|
|
{"$ref": "#/components/schemas/Item"} |
|
|
|
], |
|
|
|
"title": "Item", |
|
|
|
} |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
"type": "object", |
|
|
|
"required": ["item"], |
|
|
|
"title": "Body_create_item_embed_items_embed__post", |
|
|
|
@ -959,10 +1015,17 @@ def test_openapi_schema(): |
|
|
|
}, |
|
|
|
"Body_update_item_items__item_id__put": { |
|
|
|
"properties": { |
|
|
|
"item": { |
|
|
|
"allOf": [{"$ref": "#/components/schemas/Item"}], |
|
|
|
"title": "Item", |
|
|
|
}, |
|
|
|
"item": pydantic_snapshot( |
|
|
|
v1=snapshot({"$ref": "#/components/schemas/Item"}), |
|
|
|
v2=snapshot( |
|
|
|
{ |
|
|
|
"allOf": [ |
|
|
|
{"$ref": "#/components/schemas/Item"} |
|
|
|
], |
|
|
|
"title": "Item", |
|
|
|
} |
|
|
|
), |
|
|
|
), |
|
|
|
"importance": { |
|
|
|
"type": "integer", |
|
|
|
"maximum": 10.0, |
|
|
|
|