Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding query convention result name per field #7083

Open
cmeeren opened this issue Apr 30, 2024 · 2 comments
Open

Allow overriding query convention result name per field #7083

cmeeren opened this issue Apr 30, 2024 · 2 comments
Labels

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Apr 30, 2024

Product

Hot Chocolate

Is your feature request related to a problem?

Currently, HotChocolate names the query convention result types by the field.

I have several fields in different parts of the hierarchy with the same name, and I need to use query conventions for both.

The solution you'd like

The ability to override the query convention result type name per field using an attribute, just like overriding the result type name for mutation conventions or the connection name for pagination.

@cmeeren cmeeren added the 🎉 enhancement New feature or request label Apr 30, 2024
@cmeeren cmeeren changed the title Allow overriding setting query convention result name Allow overriding query convention result name per field Apr 30, 2024
@cmeeren
Copy link
Contributor Author

cmeeren commented Apr 30, 2024

To be clear, if I currently have two identically named fields (in different parts of the hierarchy) that both use query conventions, then fetching the schema fails with:

The name SomeFieldNameResult was already registered by another type. (HotChocolate.Types.UnionType)

@cmeeren
Copy link
Contributor Author

cmeeren commented Apr 30, 2024

Ideally, there'd be a global option to automatically name the field similar to MutationConventionOptions.PayloadTypeNamePattern, which would allow me to set something like "{TypeName}{FieldName}Result". (I would argue that should be the default naming, but as long as I can configure it, I'm happy.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant