mirror of
https://github.com/fastapi/sqlmodel.git
synced 2026-03-13 09:29:54 +08:00
✅ Update tests, remove conditionals for Pydantic v1 (#1702)
This commit is contained in:
committed by
GitHub
parent
2cc11dada3
commit
8dbcd643d3
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -300,16 +299,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -319,16 +312,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -336,36 +323,18 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"secret_name": IsDict(
|
||||
{
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Secret Name", "type": "string"}
|
||||
),
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"secret_name": {
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -235,16 +234,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -254,16 +247,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -159,16 +158,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -179,16 +172,10 @@ def test_tutorial(module: ModuleType):
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -159,16 +158,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -178,16 +171,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -178,16 +177,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -197,16 +190,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -549,26 +548,14 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -578,26 +565,14 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -608,85 +583,43 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"team": IsDict(
|
||||
{
|
||||
"anyOf": [
|
||||
{"$ref": "#/components/schemas/TeamPublic"},
|
||||
{"type": "null"},
|
||||
]
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"$ref": "#/components/schemas/TeamPublic"}
|
||||
),
|
||||
"team": {
|
||||
"anyOf": [
|
||||
{"$ref": "#/components/schemas/TeamPublic"},
|
||||
{"type": "null"},
|
||||
]
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroUpdate": {
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"secret_name": IsDict(
|
||||
{
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Secret Name", "type": "string"}
|
||||
),
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"secret_name": {
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -728,36 +661,18 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"headquarters": IsDict(
|
||||
{
|
||||
"title": "Headquarters",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Headquarters", "type": "string"}
|
||||
),
|
||||
"id": {
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"headquarters": {
|
||||
"title": "Headquarters",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -131,28 +130,16 @@ def test_tutorial(module: ModuleType):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"id": {
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -302,16 +301,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -321,16 +314,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -338,36 +325,18 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"secret_name": IsDict(
|
||||
{
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Secret Name", "type": "string"}
|
||||
),
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"secret_name": {
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -137,28 +136,16 @@ def test_tutorial(module: ModuleType):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"id": {
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -534,26 +533,14 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -563,26 +550,14 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -590,46 +565,22 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"secret_name": IsDict(
|
||||
{
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Secret Name", "type": "string"}
|
||||
),
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"team_id": IsDict(
|
||||
{
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Team Id", "type": "integer"}
|
||||
),
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"secret_name": {
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"team_id": {
|
||||
"title": "Team Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -655,26 +606,14 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"headquarters": IsDict(
|
||||
{
|
||||
"title": "Headquarters",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Headquarters", "type": "string"}
|
||||
),
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"headquarters": {
|
||||
"title": "Headquarters",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -279,16 +278,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"HeroPublic": {
|
||||
@@ -298,16 +291,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -315,36 +302,18 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"secret_name": IsDict(
|
||||
{
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Secret Name", "type": "string"}
|
||||
),
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"name": {
|
||||
"title": "Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"secret_name": {
|
||||
"title": "Secret Name",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
},
|
||||
"age": {
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -2,7 +2,6 @@ import importlib
|
||||
from types import ModuleType
|
||||
|
||||
import pytest
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import Session, create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -342,16 +341,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"title": "Age",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: Remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"title": "Age",
|
||||
},
|
||||
"password": {"type": "string", "title": "Password"},
|
||||
},
|
||||
},
|
||||
@@ -362,16 +355,10 @@ def test_tutorial(module: ModuleType):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"title": "Age",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: Remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"age": {
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"title": "Age",
|
||||
},
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -379,46 +366,22 @@ def test_tutorial(module: ModuleType):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": IsDict(
|
||||
{
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"title": "Name",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: Remove when deprecating Pydantic v1
|
||||
{"title": "Name", "type": "string"}
|
||||
),
|
||||
"secret_name": IsDict(
|
||||
{
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"title": "Secret Name",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: Remove when deprecating Pydantic v1
|
||||
{"title": "Secret Name", "type": "string"}
|
||||
),
|
||||
"age": IsDict(
|
||||
{
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"title": "Age",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: Remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"password": IsDict(
|
||||
{
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"title": "Password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: Remove when deprecating Pydantic v1
|
||||
{"title": "Password", "type": "string"}
|
||||
),
|
||||
"name": {
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"title": "Name",
|
||||
},
|
||||
"secret_name": {
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"title": "Secret Name",
|
||||
},
|
||||
"age": {
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
"title": "Age",
|
||||
},
|
||||
"password": {
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"title": "Password",
|
||||
},
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
Reference in New Issue
Block a user