feat: add opt field
This commit is contained in:
parent
1dd98d2752
commit
83739c7c8e
@ -6,6 +6,7 @@ from uuid import UUID
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
from pydantic import Field
|
||||||
from pydantic.main import BaseModel
|
from pydantic.main import BaseModel
|
||||||
|
|
||||||
from aiohttp_pydantic import PydanticView, oas
|
from aiohttp_pydantic import PydanticView, oas
|
||||||
@ -32,7 +33,7 @@ class Toy(BaseModel):
|
|||||||
|
|
||||||
class Pet(BaseModel):
|
class Pet(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
name: str
|
name: Optional[str] = Field(None)
|
||||||
toys: List[Toy]
|
toys: List[Toy]
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ async def test_pets_route_should_have_get_method(generated_oas):
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required": ["id", "name", "toys"],
|
"required": ["id", "toys"],
|
||||||
"title": "Pet",
|
"title": "Pet",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
},
|
},
|
||||||
@ -222,7 +223,7 @@ async def test_pets_route_should_have_post_method(generated_oas):
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required": ["id", "name", "toys"],
|
"required": ["id", "toys"],
|
||||||
"title": "Pet",
|
"title": "Pet",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
}
|
}
|
||||||
@ -244,7 +245,7 @@ async def test_pets_route_should_have_post_method(generated_oas):
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required": ["id", "name", "toys"],
|
"required": ["id", "toys"],
|
||||||
"title": "Pet",
|
"title": "Pet",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
}
|
}
|
||||||
@ -321,7 +322,7 @@ async def test_pets_id_route_should_have_get_method(generated_oas):
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required": ["id", "name", "toys"],
|
"required": ["id", "toys"],
|
||||||
"title": "Pet",
|
"title": "Pet",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
}
|
}
|
||||||
@ -356,7 +357,7 @@ async def test_pets_id_route_should_have_put_method(generated_oas):
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"required": ["id", "name", "toys"],
|
"required": ["id", "toys"],
|
||||||
"title": "Pet",
|
"title": "Pet",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user