mirror of https://github.com/tiangolo/fastapi.git
Remove code examples for Python 3.8 in `separate_openapi_schemas`
This commit is contained in:
parent
680b8a0d16
commit
2e792112bb
|
|
@ -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"),
|
|
||||||
]
|
|
||||||
|
|
@ -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"),
|
|
||||||
]
|
|
||||||
|
|
@ -3,15 +3,14 @@ import importlib
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from ...utils import needs_py39, needs_py310, needs_pydanticv2
|
from ...utils import needs_py310, needs_pydanticv2
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
name="client",
|
name="client",
|
||||||
params=[
|
params=[
|
||||||
"tutorial001",
|
pytest.param("tutorial001_py39"),
|
||||||
pytest.param("tutorial001_py310", marks=needs_py310),
|
pytest.param("tutorial001_py310", marks=needs_py310),
|
||||||
pytest.param("tutorial001_py39", marks=needs_py39),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def get_client(request: pytest.FixtureRequest) -> TestClient:
|
def get_client(request: pytest.FixtureRequest) -> TestClient:
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,14 @@ import importlib
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from ...utils import needs_py39, needs_py310, needs_pydanticv2
|
from ...utils import needs_py310, needs_pydanticv2
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
name="client",
|
name="client",
|
||||||
params=[
|
params=[
|
||||||
"tutorial002",
|
pytest.param("tutorial002_py39"),
|
||||||
pytest.param("tutorial002_py310", marks=needs_py310),
|
pytest.param("tutorial002_py310", marks=needs_py310),
|
||||||
pytest.param("tutorial002_py39", marks=needs_py39),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def get_client(request: pytest.FixtureRequest) -> TestClient:
|
def get_client(request: pytest.FixtureRequest) -> TestClient:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue