]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
✅ Update `ValidationError` schema in FastAPI-related tests to be compatible with...
authorMotov Yurii <109919500+YuriiMotov@users.noreply.github.com>
Thu, 5 Feb 2026 09:58:01 +0000 (12:58 +0300)
committerGitHub <noreply@github.com>
Thu, 5 Feb 2026 09:58:01 +0000 (10:58 +0100)
12 files changed:
tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py
tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py
tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py

index a766b37d47a9273085af8505969756b57c7b1ea9..d3dea79f47834815fbeadddbfdb09b0e43fddb1d 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 241241a42257e5afa4f9a63de3929c8d7b49d436..99f5566360cc595eb88cc2d65bedc63b3cd4d63e 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 1690ba26efe24a5f452e9af619466e7245640f12..5e3a956069f60e31f2e1d0d9394ed71f8bcb7a72 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index b17fc20ffaea588e345ef1f1b8474cb847304ffd..d8a891ff1b0fc6caf890f53f43c84415e841fa8d 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 420da4a379bb8f6df4e5a500250b54ddaf4ac086..8b22e050c5e789670cfe2f4ca048f69e0fbec66b 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 07be8c308988a347407ccaec6ef1528224b9e6f2..4756ac6c8626d8a6bc1dd4a6cfaa6b1adc6ab9ab 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 2951268d99a6d9f53f79605785156e5f763b273b..77a7fc6f687e0c5b53757eb22ab66b214fac221d 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 6528f853335d3c281ef99d29e8479a0f5553538d..ffd0381bfb0d93b0452d655ef2f8998f34d99206 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index b6f88b136e3e8542f01af6fce57993fec366e6f6..17c69440a8a54952efab71fefd68fbbb3fdb852b 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 6982ee9913cea1a71480a2d4e6828c9e585286ea..c770b4718f2ed42d662ed9b0c119a7c154d7d38c 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index cba5c1ae625e7306977633377da105f8679449b8..b28ca100b00025e241baf8f66e23e54faa94e188 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },
index 22110ecb0327e2cb26801eb8e2e07f08661dd84e..1b784b2f6479f3660a619551d5581daba95d1e11 100644 (file)
@@ -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"},
+                            },
+                        ),
                     },
                 }
             },