Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

starWarsIntrospection-test __schema.types confusion #2081

Closed
burner opened this issue Aug 12, 2019 · 4 comments
Closed

starWarsIntrospection-test __schema.types confusion #2081

burner opened this issue Aug 12, 2019 · 4 comments
Labels

Comments

@burner
Copy link

burner commented Aug 12, 2019

I'm implementing a graphql backend in D and when looking at the expected types
returned in https://github.com/graphql/graphql-js/blob/master/src/__tests__/starWarsIntrospection-test.js#L22
I'm confused why "Boolean" is part of the returned names.
I get that bool is a standard type but so is Int and Int does not appear in the names array.
That being said, no field or inputvalue has the type bool or int in the star wars schema.

Could somebody please clarify this for me

@IvanGoncharov
Copy link
Member

I get that bool is a standard type but so is Int and Int does not appear in the names array.

@burner You absolutely correct types (both standard and user-defined) are included only if they are used in the schema.
Boolean type is used both inside introspection types, e.g.:

includeDeprecated: { type: GraphQLBoolean, defaultValue: false },

and in standard directives, e.g.:
type: GraphQLNonNull(GraphQLBoolean),

@burner
Copy link
Author

burner commented Aug 12, 2019

Thank you for the quick answer.
My bad, sorry for the noise.

@burner burner closed this as completed Aug 12, 2019
@IvanGoncharov
Copy link
Member

@burner No problem. The main purpose of graphql-js is to be the reference implementation of GraphQL and assist with implementing interoperable GraphQL servers in various languages.
If something is not clear from source code it should be addressed in comments so you actually helping us to improve source code and save time for future readers.
For example, based on this issue I added this comment:

// Include all types used by StarWars schema, introspection types and
// standard directives. For example, `Boolean` is used in `@skip`,
// `@include` and also inside introspection types.
expect(data).to.deep.equal({

So please feel free to open similar issues if you will have such questions.
Also if you discover something that is not covered by our tests please open an issue or PR.

@burner
Copy link
Author

burner commented Aug 13, 2019

@IvanGoncharov will do, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants