Skip to content

Commit e14f272

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3b51e8d commit e14f272

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

integration_tests/base_routes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ async def async_dict_post():
559559

560560
# Body
561561

562+
562563
class TestMyRequest(Body):
563564
items: List[str]
564565
numbers: list[int]
@@ -578,6 +579,7 @@ async def async_body_post(request: Request):
578579
def sync_form_data(request: Request):
579580
return request.headers["Content-Type"]
580581

582+
581583
@app.post("/sync/body/typed")
582584
def sync_body_typed(body: TestMyRequest):
583585
# the server should just start

robyn/openapi.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,9 @@ def get_schema_object(self, parameter: str, param_type: Any) -> dict:
403403
# Handle Optional types
404404
if origin is Union and type(None) in args:
405405
non_none_type = next(t for t in args if t is not type(None))
406-
properties["anyOf"] = [
407-
{"type": self.get_openapi_type(non_none_type)},
408-
{"type": "null"}
409-
]
406+
properties["anyOf"] = [{"type": self.get_openapi_type(non_none_type)}, {"type": "null"}]
410407
return properties
411-
408+
412409
# Handle List types
413410
elif origin in (list, List):
414411
properties["type"] = "array"
@@ -424,9 +421,7 @@ def get_schema_object(self, parameter: str, param_type: Any) -> dict:
424421

425422
if hasattr(param_type, "__annotations__"):
426423
for e in param_type.__annotations__:
427-
properties["properties"][e] = self.get_schema_object(
428-
e, param_type.__annotations__[e]
429-
)
424+
properties["properties"][e] = self.get_schema_object(e, param_type.__annotations__[e])
430425

431426
return properties
432427

0 commit comments

Comments
 (0)