Skip to content

Commit 77b8495

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

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

integration_tests/base_routes.py

+2
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ async def async_dict_post():
560560

561561
# Body
562562

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

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

robyn/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def ALLOW_CORS(app: Robyn, origins: Union[List[str], str]):
609609
def cors_middleware(request):
610610
if request is None:
611611
return None
612-
612+
613613
origin = request.headers.get("Origin")
614614

615615
# If specific origins are set, validate the request origin

robyn/openapi.py

+3-8
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)