Create Schema Definition from Introspection Result is ignoring Custom Scalar from Server
See original GitHub issueHi guys,
I am trying to use graphql-java to send graphql queries to prisma graphql server. However, it fails to create GraphQLSchema with the introspection results from prisma grpahql server due to the ‘DateTime’
Introspection
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type {
...TypeRef
}
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
Introspection Result
{
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": {
"name": "Subscription"
},
"types": [
{
"kind": "SCALAR",
"name": "DateTime",
"description": "",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": null,
"possibleTypes": null
},
...
],
"directives": [
...
]
}
}
}
Create Schema Definition from Introspection Result
Document schema = new IntrospectionResultToSchema().createSchemaDefinition((Map<String, Object>) introspectionResult.get("data"));
String printedSchema = new SchemaPrinter().print(schema);
Reader schemaProvider = new StringReader(printedSchema);
SchemaParser parser = new SchemaParser();
SchemaGenerator schemaGenerator = new SchemaGenerator();
TypeDefinitionRegistry typeRegistry = parser.parse(schemaProvider);
GraphQLSchema schema = schemaGenerator.makeExecutableSchema(typeRegistry, RuntimeWiring.newRuntimeWiring().build());
Error
The input value type ‘DateTime’ is not present when resolving type ‘UserWhereInput’ [@1107:1], There is no type resolver defined for interface / union ‘Node’ type
Does anyone have any idea or tries to implement this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Custom scalars - Apollo GraphQL Docs
Defining a custom scalar You can now use MyCustomScalar in your schema anywhere you can use a default scalar (e.g., as the type...
Read more >Maven Plugin Goals | GraphQL Kotlin
GraphQL Kotlin Maven Plugin provides functionality to generate a lightweight GraphQL HTTP client and generate GraphQL schema directly from ...
Read more >Schemas | Caliban
Meaning that caliban will ignore the outer type and take the first case class parameter as the real type. If isScalar is true,...
Read more >What you need to know about GraphQL enums
Let's make our GraphQL Schema more robust by migrating to enums. How to use enums. GraphQL enums can be defined using the enum...
Read more >GraphQL specification
When representing a GraphQL schema using the type system definition language, the built‐in scalar types should be omitted for brevity. Result Coercion. A ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nevermind, figured out the solution. SchemaPrinter(SchemaPrinter.Options.defaultOptions().includeScalarTypes(true)) Looks like SchemaPrinter does not print custom scalars by default.
Suspect that i’m having the same problem. GraphQL introspection query gives information about scalar types. But SchemaPrinter().print(GraphQLSchema) output does not give any scalars. Even though it references Long and LocalDateTime types, they have no “scalar Long” definition.