def info_directive_schema() -> strawberry.Schema:
    """Returns a schema with directive that validates if info is recieved."""

    @strawberry.enum
    class Locale(Enum):
        EN: str = "EN"
        NL: str = "NL"

    greetings: dict[Locale, str] = {
        Locale.EN: "Hello {username}",
        Locale.NL: "Hallo {username}",
    }

    @strawberry.type
    class Query:
        @strawberry.field
        def greeting_template(self, locale: Locale = Locale.EN) -> str:
            return greetings[locale]

    field = get_object_definition(Query, strict=True).fields[0]

    @strawberry.directive(
        locations=[DirectiveLocation.FIELD],
        description="Interpolate string on the server from context data",
    )
    def interpolate(value: DirectiveValue[str], info: strawberry.Info):
        try:
            assert isinstance(info, strawberry.Info)
            assert info._field is field
            return value.format(**info.context["userdata"])
        except KeyError:
            return value

    return strawberry.Schema(query=Query, directives=[interpolate])
Returns a schema with directive that validates if info is recieved.
tests/schema/test_directives.py