Skip to content

Commit

Permalink
fix(ci): use typing annotaqtions
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Sep 26, 2024
1 parent b5a9bcc commit e80debc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions robyn/openapi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import inspect
import typing
from dataclasses import asdict, dataclass, field
from importlib import resources
from inspect import Signature
Expand Down Expand Up @@ -277,8 +278,10 @@ def get_path_obj(
endpoint_with_path_params_wrapped_in_braces += "/{" + path_param_name + "}"

if query_params:
for query_param in query_params.__annotations__:
query_param_type = self.get_openapi_type(query_params.__annotations__[query_param])
query_param_annotations = query_params.__annotations__ if query_params is TypedDict else typing.get_type_hints(query_params)

for query_param in query_param_annotations:
query_param_type = self.get_openapi_type(query_param_annotations[query_param])

openapi_path_object["parameters"].append(
{
Expand All @@ -292,8 +295,10 @@ def get_path_obj(
if request_body:
properties = {}

for body_item in request_body.__annotations__:
properties[body_item] = self.get_schema_object(body_item, request_body.__annotations__[body_item])
request_body_annotations = request_body.__annotations__ if request_body is TypedDict else typing.get_type_hints(request_body)

for body_item in request_body_annotations:
properties[body_item] = self.get_schema_object(body_item, request_body_annotations[body_item])

request_body_object = {
"content": {
Expand Down

0 comments on commit e80debc

Please sign in to comment.