Browse Source

Update snapshots for Pydantic v1 and v2

pull/14168/head
Sebastián Ramírez 10 months ago
parent
commit
803ca5f735
  1. 55
      tests/test_pydantic_v1_v2_multifile/test_multifile.py

55
tests/test_pydantic_v1_v2_multifile/test_multifile.py

@ -1,6 +1,8 @@
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from tests.utils import pydantic_snapshot
from .main import app
client = TestClient(app)
@ -237,14 +239,23 @@ def test_openapi_schema():
"requestBody": {
"content": {
"application/json": {
"schema": {
"allOf": [
"schema": pydantic_snapshot(
v2=snapshot(
{
"allOf": [
{
"$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
}
],
"title": "Data",
}
),
v1=snapshot(
{
"$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
}
],
"title": "Data",
}
),
)
}
},
"required": True,
@ -318,14 +329,23 @@ def test_openapi_schema():
"requestBody": {
"content": {
"application/json": {
"schema": {
"allOf": [
"schema": pydantic_snapshot(
v2=snapshot(
{
"allOf": [
{
"$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
}
],
"title": "Data",
}
),
v1=snapshot(
{
"$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv1__Item"
}
],
"title": "Data",
}
),
)
}
},
"required": True,
@ -639,10 +659,17 @@ def test_openapi_schema():
"properties": {
"new_title": {"type": "string", "title": "New Title"},
"new_size": {"type": "integer", "title": "New Size"},
"new_description": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "New Description",
},
"new_description": pydantic_snapshot(
v2=snapshot(
{
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "New Description",
}
),
v1=snapshot(
{"type": "string", "title": "New Description"}
),
),
"new_sub": {
"$ref": "#/components/schemas/tests__test_pydantic_v1_v2_multifile__modelsv2__SubItem"
},

Loading…
Cancel
Save