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
{{ message }}
Repository navigation
Check for scalar arguments when building the schema instead of on every request #859
For each argument, MethodFieldResolver either passes graphql-java's value straight to the resolver method or converts it to the parameter type with Jackson. It passes it through only if the value already fits the parameter type and the argument is a scalar other than ID (isConcreteScalarType). To know if the argument is a scalar, it looks the type up in environment.graphQLSchema on every call.
That's the only place we read the schema from the environment. It's done at runtime because the data fetchers are created in SchemaParser before the GraphQLSchema exists, and MethodFieldResolver doesn't know which type names are scalars. But we do know that at build time: SchemaClassScanner has every type definition by name (TypeClassMatcher already checks for ScalarTypeDefinition) and the built-in scalars are in GRAPHQL_SCALARS.
So FieldResolverScanner could pass the scalar names into MethodFieldResolver, and createDataFetcher() could decide once per argument. That means:
One difference: the runtime lookup also sees changes made to the schema after we build it, e.g. by a SchemaTransformer. I don't think that matters for whether a type is a scalar, but worth checking.
Activity