Approach

  1. 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}!"
    
  2. Use a generic mapper for dataclass with validations using the typing. (Example)

Problem

  1. Keep the view and view_model synced with the same typing.
    1. If we only have a parse between the model and graphql_view (similar to marshmallow) we don’t need to worry about the middle object.
  2. Sync enum between strawberry and another type.