Skip to content

Source Generator does not set MethodInfo or ParameterInfo #9908

Description

@leniency

Product

Hot Chocolate

Is your feature request related to a problem?

Methods registered through the source generator do not have the MethodInfo or any ParameterInfo set on the ObjectFieldConfiguration or any of their ArgumentConfiguration. When then inspecting configurations in a TypeInterceptor, fields and arguments are missing information.

This information used to be available under HotChocolate 15, and it is available for fields and arguments not being registered through the source generator, leading to a discrepancy in handling between those two paths.

Sample Repo

I have a sample repository up here demonstrating the issue.
https://github.com/[leniency/HotChocolate16Collections](https://github.com/leniency/HotChocolate16Collections)

  • CustomDirectiveInterceptor this is a sample interceptor that applies a testing attribute at various locations. The FIELD_DEFINITION and ARGUMENT_DEFINITION are where the issue arises - Member and Parameter properties are null on the corresponding configuration objects.

Use Cases

Adding custom directives based on attributes. I use a TypeInterceptor to check for various attributes to apply custom directives. Not all of these can be modified to inherit from DescriptorAttribute.

  • DataAnnotations - The various validation and display attributes (StringLength, Range, etc...) can be applied as directives for client-side validation and kept in sync with server logic.

The solution you'd like

Add MemberInfo and ParameterInfo to the configuration objects in the source generator, allowing TypeInterceptors and any other consumers to have access to the original type information.

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions