mirror of
https://github.com/fastapi/sqlmodel.git
synced 2026-02-18 06:39:01 -06:00
✨ Add support for Pydantic v2 (while keeping support for v1 if v2 is not available), including initial work by AntonDeMeester (#722)
Co-authored-by: Mohamed Farahat <farahats9@yahoo.com> Co-authored-by: Stefan Borer <stefan.borer@gmail.com> Co-authored-by: Peter Landry <peter.landry@gmail.com> Co-authored-by: Anton De Meester <antondemeester+github@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5b733b348d
commit
fa2f178b8a
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -284,7 +285,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -294,7 +304,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -302,9 +321,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -287,7 +288,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -297,7 +307,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -305,9 +324,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -287,7 +288,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -297,7 +307,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -305,9 +324,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -217,7 +218,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -227,7 +237,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -220,7 +221,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -230,7 +240,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -220,7 +221,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -230,7 +240,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -53,11 +54,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] != hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -142,7 +142,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -153,7 +162,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -56,11 +57,9 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] != hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -145,7 +144,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -156,7 +164,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -56,11 +57,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] != hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -145,7 +145,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -156,7 +165,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -53,11 +54,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] != hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -142,7 +142,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -152,7 +161,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -56,11 +57,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] != hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -145,7 +145,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -155,7 +164,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -56,11 +57,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] != hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -145,7 +145,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -155,7 +164,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -38,11 +39,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -163,7 +163,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -173,7 +182,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -41,11 +42,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -166,7 +166,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -176,7 +185,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -41,11 +42,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert response.status_code == 404, response.text
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -166,7 +166,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -176,7 +185,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -531,8 +532,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -542,8 +561,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -554,20 +591,85 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"team": {"$ref": "#/components/schemas/TeamRead"},
|
||||
"team": IsDict(
|
||||
{
|
||||
"anyOf": [
|
||||
{"$ref": "#/components/schemas/TeamRead"},
|
||||
{"type": "null"},
|
||||
]
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"$ref": "#/components/schemas/TeamRead"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroUpdate": {
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -609,9 +711,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"headquarters": {"title": "Headquarters", "type": "string"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -534,8 +535,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -545,8 +564,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -557,20 +594,85 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"team": {"$ref": "#/components/schemas/TeamRead"},
|
||||
"team": IsDict(
|
||||
{
|
||||
"anyOf": [
|
||||
{"$ref": "#/components/schemas/TeamRead"},
|
||||
{"type": "null"},
|
||||
]
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"$ref": "#/components/schemas/TeamRead"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroUpdate": {
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -612,9 +714,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"headquarters": {"title": "Headquarters", "type": "string"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -534,8 +535,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -545,8 +564,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -557,20 +594,85 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"team": {"$ref": "#/components/schemas/TeamRead"},
|
||||
"team": IsDict(
|
||||
{
|
||||
"anyOf": [
|
||||
{"$ref": "#/components/schemas/TeamRead"},
|
||||
{"type": "null"},
|
||||
]
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"$ref": "#/components/schemas/TeamRead"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroUpdate": {
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -612,9 +714,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"headquarters": {"title": "Headquarters", "type": "string"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -31,11 +32,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[0]["secret_name"] == hero_data["secret_name"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -114,10 +114,28 @@ def test_tutorial(clear_sqlmodel):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -34,11 +35,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[0]["secret_name"] == hero_data["secret_name"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -117,10 +117,28 @@ def test_tutorial(clear_sqlmodel):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -34,11 +35,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[0]["secret_name"] == hero_data["secret_name"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -117,10 +117,28 @@ def test_tutorial(clear_sqlmodel):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -284,7 +285,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -294,7 +304,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -302,9 +321,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -289,7 +290,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -299,7 +309,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -307,9 +326,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -289,7 +290,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -299,7 +309,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -307,9 +326,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -51,11 +52,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] == hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -120,10 +120,28 @@ def test_tutorial(clear_sqlmodel):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -54,11 +55,10 @@ def test_tutorial(clear_sqlmodel):
|
||||
assert data[1]["id"] == hero2_data["id"]
|
||||
|
||||
response = client.get("/openapi.json")
|
||||
data = response.json()
|
||||
|
||||
assert response.status_code == 200, response.text
|
||||
|
||||
assert data == {
|
||||
assert response.json() == {
|
||||
"openapi": "3.1.0",
|
||||
"info": {"title": "FastAPI", "version": "0.1.0"},
|
||||
"paths": {
|
||||
@@ -123,10 +123,28 @@ def test_tutorial(clear_sqlmodel):
|
||||
"required": ["name", "secret_name"],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
"id": IsDict(
|
||||
{
|
||||
"title": "Id",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Id", "type": "integer"}
|
||||
),
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -518,8 +519,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -529,8 +548,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -538,10 +575,46 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -567,8 +640,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"headquarters": {"title": "Headquarters", "type": "string"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -521,8 +522,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -532,8 +551,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -541,10 +578,46 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -570,8 +643,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"headquarters": {"title": "Headquarters", "type": "string"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -521,8 +522,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -532,8 +551,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -541,10 +578,46 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"team_id": {"title": "Team Id", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"TeamCreate": {
|
||||
@@ -570,8 +643,26 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "TeamUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"headquarters": {"title": "Headquarters", "type": "string"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -263,7 +264,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -273,7 +283,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -281,9 +300,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -266,7 +267,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -276,7 +286,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -284,9 +303,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from dirty_equals import IsDict
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlmodel import create_engine
|
||||
from sqlmodel.pool import StaticPool
|
||||
@@ -266,7 +267,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"HeroRead": {
|
||||
@@ -276,7 +286,16 @@ def test_tutorial(clear_sqlmodel):
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"age": IsDict(
|
||||
{
|
||||
"title": "Age",
|
||||
"anyOf": [{"type": "integer"}, {"type": "null"}],
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
# TODO: remove when deprecating Pydantic v1
|
||||
{"title": "Age", "type": "integer"}
|
||||
),
|
||||
"id": {"title": "Id", "type": "integer"},
|
||||
},
|
||||
},
|
||||
@@ -284,9 +303,36 @@ def test_tutorial(clear_sqlmodel):
|
||||
"title": "HeroUpdate",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"title": "Name", "type": "string"},
|
||||
"secret_name": {"title": "Secret Name", "type": "string"},
|
||||
"age": {"title": "Age", "type": "integer"},
|
||||
"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"}
|
||||
),
|
||||
},
|
||||
},
|
||||
"ValidationError": {
|
||||
|
||||
Reference in New Issue
Block a user