You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd submit a PR but I'm unclear exactly how it's used, myself :)
GraphQLSchema defines a method AddScalar, which has something to do with validating and translating scalar types.
It's used in the tests to add a DateTime with year/month/day components, but I'm a bit unclear where these components come from, since the translation is only in one direction.
Without it, tests that query a model with a DateTime field will fail; for eg, comment out the AddScalar line in EntityFrameworkExecutionTests.CreateDefaultContext(), or alternatively in EntityFrameworkExecutionTests.AddAllFields() add a query on account (in this test Account is defined via AddAllFields(), but without the DateTime scalar added to the schema):
gql.ExecuteQuery("{ account(id:1) { id } }");
The text was updated successfully, but these errors were encountered:
AddScalar only has one translation because it only ever needs to do one. We treat scalars as values that we could either receive as input to a query or return as output in a result set (which cannot have their own selection set, see: https://facebook.github.io/graphql/#sec-Scalars).
Our result sets are entirely in-memory, not serialized. This is so that you can pass them off to whatever serialization library you want (likely Newtonsoft.Json, but we're flexible). Given that, we have no need to provide a translation from a scalar type back to a string type.
However, since we parse the input query and can accept an arbitrary scalar, we have to be able to build that scalar up from components we understand (ints, floats, strings, etc.).
I intended to write some additional documentation this weekend (related to #46), so while I'm doing that I can add real documentation for these features as well.
Aah, I see thanks, so it's in the query-parsing direction? That makes sense.
Why does it raise an exception though when you execute a query, if you're not parsing (or serialising) that field? (Obviously I haven't dug that deep into that bit of the code sorry, I was just curious at this point)
I'd submit a PR but I'm unclear exactly how it's used, myself :)
GraphQLSchema
defines a methodAddScalar
, which has something to do with validating and translating scalar types.It's used in the tests to add a
DateTime
with year/month/day components, but I'm a bit unclear where these components come from, since the translation is only in one direction.Without it, tests that query a model with a
DateTime
field will fail; for eg, comment out theAddScalar
line inEntityFrameworkExecutionTests.CreateDefaultContext()
, or alternatively inEntityFrameworkExecutionTests.AddAllFields()
add a query on account (in this testAccount
is defined viaAddAllFields()
, but without theDateTime
scalar added to the schema):The text was updated successfully, but these errors were encountered: