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

Exclude unused standard types from the schema #964

Open
spawnia opened this issue Oct 10, 2021 · 1 comment
Open

Exclude unused standard types from the schema #964

spawnia opened this issue Oct 10, 2021 · 1 comment

Comments

@spawnia
Copy link
Collaborator

spawnia commented Oct 10, 2021

The current implementation of Schema always adds standard scalar types to the schema, even if they are not used. This differs from the reference implementation, which has added quite a few test cases that rely on missing standard scalars.

We should align our behaviour with the specification, see http://spec.graphql.org/draft/#sec-Scalars.Built-in-Scalars:

If a built-in scalar type is not referenced anywhere in a schema (there is no field, argument, or input field of that type) then it must not be included.

@spawnia
Copy link
Collaborator Author

spawnia commented Oct 18, 2021

Aligning the behaviour of this library exactly with graphql-js is difficult due to lazy loading. Given we don't want to eagerly traverse the schema and all its types, how can we differentiate if a standard scalar is supposed to be included in the schema when calling Schema::getType('Int')?

I think we should strive to align the behaviour with graphql-js if possible, but not at the cost of totally bombing performance. Due to the share-nothing request model of PHP, lazy type loading is very important.

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

No branches or pull requests

1 participant