Browse Source

Remove code examples for Python 3.8 in `separate_openapi_schemas`

pull/14510/head
Yurii Motov 7 months ago
parent
commit
7ed79b6467
  1. 28
      docs_src/separate_openapi_schemas/tutorial001.py
  2. 28
      docs_src/separate_openapi_schemas/tutorial002.py
  3. 5
      tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py
  4. 5
      tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py

28
docs_src/separate_openapi_schemas/tutorial001.py

@ -1,28 +0,0 @@
from typing import List, Union
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: Union[str, None] = None
app = FastAPI()
@app.post("/items/")
def create_item(item: Item):
return item
@app.get("/items/")
def read_items() -> List[Item]:
return [
Item(
name="Portal Gun",
description="Device to travel through the multi-rick-verse",
),
Item(name="Plumbus"),
]

28
docs_src/separate_openapi_schemas/tutorial002.py

@ -1,28 +0,0 @@
from typing import List, Union
from fastapi import FastAPI
from pydantic import BaseModel
class Item(BaseModel):
name: str
description: Union[str, None] = None
app = FastAPI(separate_input_output_schemas=False)
@app.post("/items/")
def create_item(item: Item):
return item
@app.get("/items/")
def read_items() -> List[Item]:
return [
Item(
name="Portal Gun",
description="Device to travel through the multi-rick-verse",
),
Item(name="Plumbus"),
]

5
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py

@ -3,15 +3,14 @@ import importlib
import pytest
from fastapi.testclient import TestClient
from ...utils import needs_py39, needs_py310, needs_pydanticv2
from ...utils import needs_py310, needs_pydanticv2
@pytest.fixture(
name="client",
params=[
"tutorial001",
pytest.param("tutorial001_py39"),
pytest.param("tutorial001_py310", marks=needs_py310),
pytest.param("tutorial001_py39", marks=needs_py39),
],
)
def get_client(request: pytest.FixtureRequest) -> TestClient:

5
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py

@ -3,15 +3,14 @@ import importlib
import pytest
from fastapi.testclient import TestClient
from ...utils import needs_py39, needs_py310, needs_pydanticv2
from ...utils import needs_py310, needs_pydanticv2
@pytest.fixture(
name="client",
params=[
"tutorial002",
pytest.param("tutorial002_py39"),
pytest.param("tutorial002_py310", marks=needs_py310),
pytest.param("tutorial002_py39", marks=needs_py39),
],
)
def get_client(request: pytest.FixtureRequest) -> TestClient:

Loading…
Cancel
Save