mirror of https://github.com/tiangolo/fastapi.git
📝 Fix types in examples under `docs_src/extra_data_types` (#10535)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
d84d6e03f4
commit
6d523d62d0
|
|
@ -10,10 +10,10 @@ app = FastAPI()
|
||||||
@app.put("/items/{item_id}")
|
@app.put("/items/{item_id}")
|
||||||
async def read_items(
|
async def read_items(
|
||||||
item_id: UUID,
|
item_id: UUID,
|
||||||
start_datetime: Union[datetime, None] = Body(default=None),
|
start_datetime: datetime = Body(),
|
||||||
end_datetime: Union[datetime, None] = Body(default=None),
|
end_datetime: datetime = Body(),
|
||||||
|
process_after: timedelta = Body(),
|
||||||
repeat_at: Union[time, None] = Body(default=None),
|
repeat_at: Union[time, None] = Body(default=None),
|
||||||
process_after: Union[timedelta, None] = Body(default=None),
|
|
||||||
):
|
):
|
||||||
start_process = start_datetime + process_after
|
start_process = start_datetime + process_after
|
||||||
duration = end_datetime - start_process
|
duration = end_datetime - start_process
|
||||||
|
|
@ -21,8 +21,8 @@ async def read_items(
|
||||||
"item_id": item_id,
|
"item_id": item_id,
|
||||||
"start_datetime": start_datetime,
|
"start_datetime": start_datetime,
|
||||||
"end_datetime": end_datetime,
|
"end_datetime": end_datetime,
|
||||||
"repeat_at": repeat_at,
|
|
||||||
"process_after": process_after,
|
"process_after": process_after,
|
||||||
|
"repeat_at": repeat_at,
|
||||||
"start_process": start_process,
|
"start_process": start_process,
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ app = FastAPI()
|
||||||
@app.put("/items/{item_id}")
|
@app.put("/items/{item_id}")
|
||||||
async def read_items(
|
async def read_items(
|
||||||
item_id: UUID,
|
item_id: UUID,
|
||||||
start_datetime: Annotated[Union[datetime, None], Body()] = None,
|
start_datetime: Annotated[datetime, Body()],
|
||||||
end_datetime: Annotated[Union[datetime, None], Body()] = None,
|
end_datetime: Annotated[datetime, Body()],
|
||||||
|
process_after: Annotated[timedelta, Body()],
|
||||||
repeat_at: Annotated[Union[time, None], Body()] = None,
|
repeat_at: Annotated[Union[time, None], Body()] = None,
|
||||||
process_after: Annotated[Union[timedelta, None], Body()] = None,
|
|
||||||
):
|
):
|
||||||
start_process = start_datetime + process_after
|
start_process = start_datetime + process_after
|
||||||
duration = end_datetime - start_process
|
duration = end_datetime - start_process
|
||||||
|
|
@ -22,8 +22,8 @@ async def read_items(
|
||||||
"item_id": item_id,
|
"item_id": item_id,
|
||||||
"start_datetime": start_datetime,
|
"start_datetime": start_datetime,
|
||||||
"end_datetime": end_datetime,
|
"end_datetime": end_datetime,
|
||||||
"repeat_at": repeat_at,
|
|
||||||
"process_after": process_after,
|
"process_after": process_after,
|
||||||
|
"repeat_at": repeat_at,
|
||||||
"start_process": start_process,
|
"start_process": start_process,
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ app = FastAPI()
|
||||||
@app.put("/items/{item_id}")
|
@app.put("/items/{item_id}")
|
||||||
async def read_items(
|
async def read_items(
|
||||||
item_id: UUID,
|
item_id: UUID,
|
||||||
start_datetime: Annotated[datetime | None, Body()] = None,
|
start_datetime: Annotated[datetime, Body()],
|
||||||
end_datetime: Annotated[datetime | None, Body()] = None,
|
end_datetime: Annotated[datetime, Body()],
|
||||||
|
process_after: Annotated[timedelta, Body()],
|
||||||
repeat_at: Annotated[time | None, Body()] = None,
|
repeat_at: Annotated[time | None, Body()] = None,
|
||||||
process_after: Annotated[timedelta | None, Body()] = None,
|
|
||||||
):
|
):
|
||||||
start_process = start_datetime + process_after
|
start_process = start_datetime + process_after
|
||||||
duration = end_datetime - start_process
|
duration = end_datetime - start_process
|
||||||
|
|
@ -21,8 +21,8 @@ async def read_items(
|
||||||
"item_id": item_id,
|
"item_id": item_id,
|
||||||
"start_datetime": start_datetime,
|
"start_datetime": start_datetime,
|
||||||
"end_datetime": end_datetime,
|
"end_datetime": end_datetime,
|
||||||
"repeat_at": repeat_at,
|
|
||||||
"process_after": process_after,
|
"process_after": process_after,
|
||||||
|
"repeat_at": repeat_at,
|
||||||
"start_process": start_process,
|
"start_process": start_process,
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ app = FastAPI()
|
||||||
@app.put("/items/{item_id}")
|
@app.put("/items/{item_id}")
|
||||||
async def read_items(
|
async def read_items(
|
||||||
item_id: UUID,
|
item_id: UUID,
|
||||||
start_datetime: Annotated[Union[datetime, None], Body()] = None,
|
start_datetime: Annotated[datetime, Body()],
|
||||||
end_datetime: Annotated[Union[datetime, None], Body()] = None,
|
end_datetime: Annotated[datetime, Body()],
|
||||||
|
process_after: Annotated[timedelta, Body()],
|
||||||
repeat_at: Annotated[Union[time, None], Body()] = None,
|
repeat_at: Annotated[Union[time, None], Body()] = None,
|
||||||
process_after: Annotated[Union[timedelta, None], Body()] = None,
|
|
||||||
):
|
):
|
||||||
start_process = start_datetime + process_after
|
start_process = start_datetime + process_after
|
||||||
duration = end_datetime - start_process
|
duration = end_datetime - start_process
|
||||||
|
|
@ -21,8 +21,8 @@ async def read_items(
|
||||||
"item_id": item_id,
|
"item_id": item_id,
|
||||||
"start_datetime": start_datetime,
|
"start_datetime": start_datetime,
|
||||||
"end_datetime": end_datetime,
|
"end_datetime": end_datetime,
|
||||||
"repeat_at": repeat_at,
|
|
||||||
"process_after": process_after,
|
"process_after": process_after,
|
||||||
|
"repeat_at": repeat_at,
|
||||||
"start_process": start_process,
|
"start_process": start_process,
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ app = FastAPI()
|
||||||
@app.put("/items/{item_id}")
|
@app.put("/items/{item_id}")
|
||||||
async def read_items(
|
async def read_items(
|
||||||
item_id: UUID,
|
item_id: UUID,
|
||||||
start_datetime: datetime | None = Body(default=None),
|
start_datetime: datetime = Body(),
|
||||||
end_datetime: datetime | None = Body(default=None),
|
end_datetime: datetime = Body(),
|
||||||
|
process_after: timedelta = Body(),
|
||||||
repeat_at: time | None = Body(default=None),
|
repeat_at: time | None = Body(default=None),
|
||||||
process_after: timedelta | None = Body(default=None),
|
|
||||||
):
|
):
|
||||||
start_process = start_datetime + process_after
|
start_process = start_datetime + process_after
|
||||||
duration = end_datetime - start_process
|
duration = end_datetime - start_process
|
||||||
|
|
@ -20,8 +20,8 @@ async def read_items(
|
||||||
"item_id": item_id,
|
"item_id": item_id,
|
||||||
"start_datetime": start_datetime,
|
"start_datetime": start_datetime,
|
||||||
"end_datetime": end_datetime,
|
"end_datetime": end_datetime,
|
||||||
"repeat_at": repeat_at,
|
|
||||||
"process_after": process_after,
|
"process_after": process_after,
|
||||||
|
"repeat_at": repeat_at,
|
||||||
"start_process": start_process,
|
"start_process": start_process,
|
||||||
"duration": duration,
|
"duration": duration,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ def test_openapi_schema():
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
|
"required": True,
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": IsDict(
|
"schema": IsDict(
|
||||||
|
|
@ -86,7 +87,7 @@ def test_openapi_schema():
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -97,40 +98,16 @@ def test_openapi_schema():
|
||||||
"title": "Body_read_items_items__item_id__put",
|
"title": "Body_read_items_items__item_id__put",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"start_datetime": IsDict(
|
"start_datetime": {
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
"title": "Start Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
"end_datetime": {
|
||||||
"end_datetime": IsDict(
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
"title": "End Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
|
||||||
"repeat_at": IsDict(
|
"repeat_at": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Repeat At",
|
"title": "Repeat At",
|
||||||
|
|
@ -151,10 +128,8 @@ def test_openapi_schema():
|
||||||
"process_after": IsDict(
|
"process_after": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Process After",
|
"title": "Process After",
|
||||||
"anyOf": [
|
"type": "string",
|
||||||
{"type": "string", "format": "duration"},
|
"format": "duration",
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
| IsDict(
|
| IsDict(
|
||||||
|
|
@ -166,6 +141,7 @@ def test_openapi_schema():
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
"required": ["start_datetime", "end_datetime", "process_after"],
|
||||||
},
|
},
|
||||||
"ValidationError": {
|
"ValidationError": {
|
||||||
"title": "ValidationError",
|
"title": "ValidationError",
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ def test_openapi_schema():
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
|
"required": True,
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": IsDict(
|
"schema": IsDict(
|
||||||
|
|
@ -86,7 +87,7 @@ def test_openapi_schema():
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -97,40 +98,16 @@ def test_openapi_schema():
|
||||||
"title": "Body_read_items_items__item_id__put",
|
"title": "Body_read_items_items__item_id__put",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"start_datetime": IsDict(
|
"start_datetime": {
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
"title": "Start Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
"end_datetime": {
|
||||||
"end_datetime": IsDict(
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
"title": "End Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
|
||||||
"repeat_at": IsDict(
|
"repeat_at": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Repeat At",
|
"title": "Repeat At",
|
||||||
|
|
@ -151,10 +128,8 @@ def test_openapi_schema():
|
||||||
"process_after": IsDict(
|
"process_after": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Process After",
|
"title": "Process After",
|
||||||
"anyOf": [
|
"type": "string",
|
||||||
{"type": "string", "format": "duration"},
|
"format": "duration",
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
| IsDict(
|
| IsDict(
|
||||||
|
|
@ -166,6 +141,7 @@ def test_openapi_schema():
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
"required": ["start_datetime", "end_datetime", "process_after"],
|
||||||
},
|
},
|
||||||
"ValidationError": {
|
"ValidationError": {
|
||||||
"title": "ValidationError",
|
"title": "ValidationError",
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
|
"required": True,
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": IsDict(
|
"schema": IsDict(
|
||||||
|
|
@ -95,7 +96,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,40 +107,16 @@ def test_openapi_schema(client: TestClient):
|
||||||
"title": "Body_read_items_items__item_id__put",
|
"title": "Body_read_items_items__item_id__put",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"start_datetime": IsDict(
|
"start_datetime": {
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
"title": "Start Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
"end_datetime": {
|
||||||
"end_datetime": IsDict(
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
"title": "End Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
|
||||||
"repeat_at": IsDict(
|
"repeat_at": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Repeat At",
|
"title": "Repeat At",
|
||||||
|
|
@ -160,10 +137,8 @@ def test_openapi_schema(client: TestClient):
|
||||||
"process_after": IsDict(
|
"process_after": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Process After",
|
"title": "Process After",
|
||||||
"anyOf": [
|
"type": "string",
|
||||||
{"type": "string", "format": "duration"},
|
"format": "duration",
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
| IsDict(
|
| IsDict(
|
||||||
|
|
@ -175,6 +150,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
"required": ["start_datetime", "end_datetime", "process_after"],
|
||||||
},
|
},
|
||||||
"ValidationError": {
|
"ValidationError": {
|
||||||
"title": "ValidationError",
|
"title": "ValidationError",
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
|
"required": True,
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": IsDict(
|
"schema": IsDict(
|
||||||
|
|
@ -95,7 +96,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,40 +107,16 @@ def test_openapi_schema(client: TestClient):
|
||||||
"title": "Body_read_items_items__item_id__put",
|
"title": "Body_read_items_items__item_id__put",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"start_datetime": IsDict(
|
"start_datetime": {
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
"title": "Start Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
"end_datetime": {
|
||||||
"end_datetime": IsDict(
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
"title": "End Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
|
||||||
"repeat_at": IsDict(
|
"repeat_at": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Repeat At",
|
"title": "Repeat At",
|
||||||
|
|
@ -160,10 +137,8 @@ def test_openapi_schema(client: TestClient):
|
||||||
"process_after": IsDict(
|
"process_after": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Process After",
|
"title": "Process After",
|
||||||
"anyOf": [
|
"type": "string",
|
||||||
{"type": "string", "format": "duration"},
|
"format": "duration",
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
| IsDict(
|
| IsDict(
|
||||||
|
|
@ -175,6 +150,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
"required": ["start_datetime", "end_datetime", "process_after"],
|
||||||
},
|
},
|
||||||
"ValidationError": {
|
"ValidationError": {
|
||||||
"title": "ValidationError",
|
"title": "ValidationError",
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
|
"required": True,
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": IsDict(
|
"schema": IsDict(
|
||||||
|
|
@ -95,7 +96,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,40 +107,16 @@ def test_openapi_schema(client: TestClient):
|
||||||
"title": "Body_read_items_items__item_id__put",
|
"title": "Body_read_items_items__item_id__put",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"start_datetime": IsDict(
|
"start_datetime": {
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "Start Datetime",
|
"title": "Start Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
"end_datetime": {
|
||||||
"end_datetime": IsDict(
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
|
||||||
"anyOf": [
|
|
||||||
{"type": "string", "format": "date-time"},
|
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
| IsDict(
|
|
||||||
# TODO: remove when deprecating Pydantic v1
|
|
||||||
{
|
|
||||||
"title": "End Datetime",
|
"title": "End Datetime",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
}
|
},
|
||||||
),
|
|
||||||
"repeat_at": IsDict(
|
"repeat_at": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Repeat At",
|
"title": "Repeat At",
|
||||||
|
|
@ -160,10 +137,8 @@ def test_openapi_schema(client: TestClient):
|
||||||
"process_after": IsDict(
|
"process_after": IsDict(
|
||||||
{
|
{
|
||||||
"title": "Process After",
|
"title": "Process After",
|
||||||
"anyOf": [
|
"type": "string",
|
||||||
{"type": "string", "format": "duration"},
|
"format": "duration",
|
||||||
{"type": "null"},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
| IsDict(
|
| IsDict(
|
||||||
|
|
@ -175,6 +150,7 @@ def test_openapi_schema(client: TestClient):
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
"required": ["start_datetime", "end_datetime", "process_after"],
|
||||||
},
|
},
|
||||||
"ValidationError": {
|
"ValidationError": {
|
||||||
"title": "ValidationError",
|
"title": "ValidationError",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue