|
|
|
@ -1,10 +1,11 @@ |
|
|
|
import importlib |
|
|
|
|
|
|
|
import pytest |
|
|
|
from dirty_equals import IsDict |
|
|
|
from fastapi.testclient import TestClient |
|
|
|
|
|
|
|
from ...utils import needs_py39, needs_py310 |
|
|
|
from ...utils import needs_py39, needs_py310, needs_pydanticv2 |
|
|
|
|
|
|
|
skip_for_pydantic_v1 = needs_pydanticv2 |
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture( |
|
|
|
@ -15,6 +16,9 @@ from ...utils import needs_py39, needs_py310 |
|
|
|
"tutorial001_an", |
|
|
|
pytest.param("tutorial001_an_py39", marks=needs_py39), |
|
|
|
pytest.param("tutorial001_an_py310", marks=needs_py310), |
|
|
|
"tutorial001_02_an", |
|
|
|
pytest.param("tutorial001_02_an_py39", marks=needs_py39), |
|
|
|
pytest.param("tutorial001_02_an_py310", marks=needs_py310), |
|
|
|
], |
|
|
|
) |
|
|
|
def get_client(request: pytest.FixtureRequest): |
|
|
|
@ -70,16 +74,10 @@ def test_openapi_schema(client: TestClient): |
|
|
|
"parameters": [ |
|
|
|
{ |
|
|
|
"required": False, |
|
|
|
"schema": IsDict( |
|
|
|
{ |
|
|
|
"anyOf": [{"type": "string"}, {"type": "null"}], |
|
|
|
"title": "Q", |
|
|
|
} |
|
|
|
) |
|
|
|
| IsDict( |
|
|
|
# TODO: remove when deprecating Pydantic v1 |
|
|
|
{"title": "Q", "type": "string"} |
|
|
|
), |
|
|
|
"schema": { |
|
|
|
"anyOf": [{"type": "string"}, {"type": "null"}], |
|
|
|
"title": "Q", |
|
|
|
}, |
|
|
|
"name": "q", |
|
|
|
"in": "query", |
|
|
|
}, |
|
|
|
@ -129,16 +127,10 @@ def test_openapi_schema(client: TestClient): |
|
|
|
"parameters": [ |
|
|
|
{ |
|
|
|
"required": False, |
|
|
|
"schema": IsDict( |
|
|
|
{ |
|
|
|
"anyOf": [{"type": "string"}, {"type": "null"}], |
|
|
|
"title": "Q", |
|
|
|
} |
|
|
|
) |
|
|
|
| IsDict( |
|
|
|
# TODO: remove when deprecating Pydantic v1 |
|
|
|
{"title": "Q", "type": "string"} |
|
|
|
), |
|
|
|
"schema": { |
|
|
|
"anyOf": [{"type": "string"}, {"type": "null"}], |
|
|
|
"title": "Q", |
|
|
|
}, |
|
|
|
"name": "q", |
|
|
|
"in": "query", |
|
|
|
}, |