graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Use GraphQLName when referencing type with ID<Type>

Open glen-84 opened this issue 2 years ago • 1 comments

Product

Hot Chocolate

Is your feature request related to a problem?

[GraphQLName("Article")]
public sealed class ArticleModel
{

...

[ID<ArticleModel>]
public static async Task<long> DraftArticle(

This uses the name ArticleModel for the ID – could it use the GraphQL name (Article) instead?

The solution you'd like

public IDAttribute()
{
    var type = typeof(T);

    TypeName = type.GetCustomAttribute<GraphQLNameAttribute>()?.Name ?? type.Name;
}

I can send a PR if this makes sense.

glen-84 avatar Jun 09 '23 15:06 glen-84

Sure... go ahead and do a PR.

michaelstaib avatar Jun 12 '23 05:06 michaelstaib