From f1aad85fc119566e62b197f500a09b6dce53526f Mon Sep 17 00:00:00 2001 From: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com> Date: Thu, 5 Feb 2026 12:58:01 +0300 Subject: [PATCH] =?utf8?q?=E2=9C=85=20Update=20`ValidationError`=20schema?= =?utf8?q?=20in=20FastAPI-related=20tests=20to=20be=20compatible=20with=20?= =?utf8?q?FastAPI=200.128.1+=20(#1744)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../test_delete/test_tutorial001.py | 40 ++++++++++++++----- .../test_limit_and_offset/test_tutorial001.py | 40 ++++++++++++++----- .../test_multiple_models/test_tutorial001.py | 40 ++++++++++++++----- .../test_multiple_models/test_tutorial002.py | 40 ++++++++++++++----- .../test_read_one/test_tutorial001.py | 40 ++++++++++++++----- .../test_relationships/test_tutorial001.py | 40 ++++++++++++++----- .../test_response_model/test_tutorial001.py | 40 ++++++++++++++----- .../test_tutorial001.py | 40 ++++++++++++++----- .../test_simple_hero_api/test_tutorial001.py | 40 ++++++++++++++----- .../test_teams/test_tutorial001.py | 40 ++++++++++++++----- .../test_update/test_tutorial001.py | 40 ++++++++++++++----- .../test_update/test_tutorial002.py | 40 ++++++++++++++----- 12 files changed, 372 insertions(+), 108 deletions(-) diff --git a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py index a766b37d4..d3dea79f4 100644 --- a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -341,17 +342,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py index 241241a42..99f556636 100644 --- a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -258,17 +259,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py index 1690ba26e..5e3a95606 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlalchemy import inspect from sqlalchemy.engine.reflection import Inspector @@ -182,17 +183,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py index b17fc20ff..d8a891ff1 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlalchemy import inspect from sqlalchemy.engine.reflection import Inspector @@ -182,17 +183,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py index 420da4a37..8b22e050c 100644 --- a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -201,17 +202,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py index 07be8c308..4756ac6c8 100644 --- a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -679,17 +680,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py index 2951268d9..77a7fc6f6 100644 --- a/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -146,17 +147,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py index 6528f8533..ffd0381bf 100644 --- a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -343,17 +344,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py index b6f88b136..17c69440a 100644 --- a/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -152,17 +153,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py index 6982ee991..c770b4718 100644 --- a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -620,17 +621,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py index cba5c1ae6..b28ca100b 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import create_engine from sqlmodel.pool import StaticPool @@ -320,17 +321,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py index 22110ecb0..1b784b2f6 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py @@ -2,6 +2,7 @@ import importlib from types import ModuleType import pytest +from dirty_equals import IsOneOf from fastapi.testclient import TestClient from sqlmodel import Session, create_engine from sqlmodel.pool import StaticPool @@ -388,17 +389,38 @@ def test_tutorial(module: ModuleType): "title": "ValidationError", "required": ["loc", "msg", "type"], "type": "object", - "properties": { - "loc": { - "title": "Location", - "type": "array", - "items": { - "anyOf": [{"type": "string"}, {"type": "integer"}] + "properties": IsOneOf( + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, }, - "msg": {"title": "Message", "type": "string"}, - "type": {"title": "Error Type", "type": "string"}, - }, + { + "loc": { + "title": "Location", + "type": "array", + "items": { + "anyOf": [ + {"type": "string"}, + {"type": "integer"}, + ] + }, + }, + "msg": {"title": "Message", "type": "string"}, + "type": {"title": "Error Type", "type": "string"}, + "ctx": {"title": "Context", "type": "object"}, + "input": {"title": "Input"}, + }, + ), }, } }, -- 2.47.3