Update the adapt_map decorator and get the typing of the information
def register(func: Callable[..., R]) -> Callable[..., R]:
@wraps(func)
def inner(*args: Any, **kwargs: Any) -> Any:
return_value = func.__annotations__.get("return")
print(return_value)
print(type(return_value))
assert return_value == str
return func(*args, **kwargs)
return inner
@register
def hello(name: str) -> Iterable[Optional[str]]:
return f"Hello {name}!"
@register
def hello(name: str) -> str:
return f"Hello {name}!"
graphql_gateway.schema in the view model.Use a generic mapper for dataclass with validations using the typing. (Example)
graphql_view (similar to marshmallow) we don’t need to worry about the middle object.