From 803ca5f7352b382c914e12f1d6a1e64cda4e63e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sun, 5 Oct 2025 23:40:27 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Update=20snapshots=20for=20Pydantic?= =?UTF-8?q?=20v1=20and=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test_multifile.py | 55 ++++++++++++++----- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/tests/test_pydantic_v1_v2_multifile/test_multifile.py b/tests/test_pydantic_v1_v2_multifile/test_multifile.py index f29725e54..6a28ea445 100644 --- a/tests/test_pydantic_v1_v2_multifile/test_multifile.py +++ b/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" },