chkimes / graphql-net

Convert GraphQL to IQueryable
MIT License
891 stars 86 forks source link

Decimal Argument Types #101

Open batesm opened 5 years ago

batesm commented 5 years ago

I have been using GraphQL.Net and think it's great but have run into a problem I was hoping you could help me with please?

In my GraphQL schema, if I configure field with an argument of type System.Double defined by the following "arguments" class:-

public class TestArgs { public double Score { get; set; } }

and then execute a GraphQL query on the "Tests" list field to get all instances with the matching Score 1.23:-

{ Tests(Score: 1.23) { Id Score } }

I am getting some weird and wonderful floating point conversions when TestArgs is instantiated. The Score property ends up with a value something like 1.28547713E-32

Do you have any advice about this please? What am I missing?