-
Notifications
You must be signed in to change notification settings - Fork 2.1k
buildClientSchema: build enum type value maps lazily #4424
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
Conversation
31a3c51 to
41c044c
Compare
This makes definition of enum values lazy similar to how field/input field definition is lazy. It brings a small performance improvement when using enums in large schemas, as the enum values are only defined when they are actually used
41c044c to
51d617e
Compare
this PR means that bad enum value names will not be checked unless type.getValues() is called in parallel to how bad field names are not checked unless type.getFields() is called.
|
this change as implemented will result in bad enum value names not being checked unless relevant to: #4362 |
|
Are they checked by the time |
|
Yes, they are. The linked issue requests earlier errors on bad names, so relevant there, but validation cannot pass with bad names. |
The option of passing a thunk was made available by: graphql#4018 . Always passing the thunk helps contribute to a "lazy" build process, which gives the following performance boost:  Lazy evaluation results in bad names for enum values not being checked until `type.getValues()` is called, similar to how bad names for fields are not checked until `type.getFields()` is called. Explicit validation validates enum value names just as with field names.
The option of passing a thunk was made available by: graphql#4018 . Always passing the thunk helps contribute to a "lazy" build process, which gives the following performance boost:  Lazy evaluation results in bad names for enum values not being checked until `type.getValues()` is called, similar to how bad names for fields are not checked until `type.getFields()` is called. Explicit validation validates enum value names just as with field names.
The option of passing a thunk was made available by: graphql#4018 . Always passing the thunk helps contribute to a "lazy" build process, which gives the following performance boost:  Lazy evaluation results in bad names for enum values not being checked until `type.getValues()` is called, similar to how bad names for fields are not checked until `type.getFields()` is called. Explicit validation validates enum value names just as with field names.
The option of passing a thunk was made available by: #4018 .
Always passing the thunk helps contribute to a "lazy" build process, which gives the following performance boost: