Skip to content

Resolver gives warning when using TypeAlias for Info #4057

@rik-coenders

Description

@rik-coenders

The ReservedType resolver gives a warning when the Info parameter is a type alias.

Describe the Bug

Define a type alias for Info

from strawberry.fastapi import BaseContext
from strawberry.types import Info

class Context(BaseContext):
    ....

type MyInfo = Info[Context, None]

And use this as a type annotation for fields within the Query class.

This gives the warning:

DeprecationWarning: Argument name-based matching of 'info' is deprecated and will be removed in v1.0. Ensure that reserved arguments are annotated their respective types (i.e. use value: 'DirectiveValue[str]' instead of 'value: str' and 'info: Info' instead of a plain 'info').

And probably (I have not tested that) cannot recognize the parameter at all if it would not have been called info.

System Information

  • Operating system: Docker image python:3.13.8-trixie
  • Python version: 3.13.8
  • Strawberry version (if applicable): tested with 0.284.0 but looking at the code this is still the case in the newest version

Additional Context

If I debug the issue, then I see that within the function is_reserved_type in strawberry/types/fields/resolver.py, the type of origin is TypeAliasType. Probably that should be handled there as well as a case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions