From 83739c7c8eb320821ed963aee5f6cb91c5707ac0 Mon Sep 17 00:00:00 2001 From: Georg K Date: Fri, 11 Nov 2022 08:08:49 +0300 Subject: [PATCH] feat: add opt field --- tests/test_oas/test_view.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_oas/test_view.py b/tests/test_oas/test_view.py index e8f92c3..0bcdbf0 100644 --- a/tests/test_oas/test_view.py +++ b/tests/test_oas/test_view.py @@ -6,6 +6,7 @@ from uuid import UUID import pytest from aiohttp import web +from pydantic import Field from pydantic.main import BaseModel from aiohttp_pydantic import PydanticView, oas @@ -32,7 +33,7 @@ class Toy(BaseModel): class Pet(BaseModel): id: int - name: str + name: Optional[str] = Field(None) toys: List[Toy] @@ -193,7 +194,7 @@ async def test_pets_route_should_have_get_method(generated_oas): "type": "array", }, }, - "required": ["id", "name", "toys"], + "required": ["id", "toys"], "title": "Pet", "type": "object", }, @@ -222,7 +223,7 @@ async def test_pets_route_should_have_post_method(generated_oas): "type": "array", }, }, - "required": ["id", "name", "toys"], + "required": ["id", "toys"], "title": "Pet", "type": "object", } @@ -244,7 +245,7 @@ async def test_pets_route_should_have_post_method(generated_oas): "type": "array", }, }, - "required": ["id", "name", "toys"], + "required": ["id", "toys"], "title": "Pet", "type": "object", } @@ -321,7 +322,7 @@ async def test_pets_id_route_should_have_get_method(generated_oas): "type": "array", }, }, - "required": ["id", "name", "toys"], + "required": ["id", "toys"], "title": "Pet", "type": "object", } @@ -356,7 +357,7 @@ async def test_pets_id_route_should_have_put_method(generated_oas): "type": "array", }, }, - "required": ["id", "name", "toys"], + "required": ["id", "toys"], "title": "Pet", "type": "object", }