SAHB.GraphQLClient icon indicating copy to clipboard operation
SAHB.GraphQLClient copied to clipboard

No upper-case fields

Open chelliwell opened this issue 5 years ago • 2 comments

The 'parsing' of query classes etc cannot retain uppercase letters in the names e.g.

public class Query
{
   public CharacterOrPerson Hero { get; set; }
}
...

becomes

{"query":"query{hero{name friends{name}}}"}

not

{"query":"Query{Hero{Name Friends{Name}}}"}

Can this be solved?

chelliwell avatar Sep 10 '19 06:09 chelliwell

Hello,

It's possible to chance the GraphQL field name using an attribute. For example:

[GraphQLFieldName("Name")] 
public string Name { get; set;}

Alternavively you can override the method GetPropertyField in GraphQLFieldBuilder. The automatic lowercasing of GraphQL name could be optional (using some options) in the future. I Will look into that.

sahb1239 avatar Sep 10 '19 09:09 sahb1239

Thanks - that should give me a route to a solution with the current version.

chelliwell avatar Sep 10 '19 17:09 chelliwell