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

definitions: make constructed fields non-optional #2091

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

IvanGoncharov
Copy link
Member

Reflects changes in #2089

@IvanGoncharov IvanGoncharov added the PR: bug fix 🐞 requires increase of "patch" version number label Aug 15, 2019
@mjmahone
Copy link
Contributor

Not sure I understand the logic here: it seems to make it strictly more difficult to construct AST nodes by hand, as you now need to explicitly include undefined fields.

@IvanGoncharov
Copy link
Member Author

@mjmahone It's not AST it's GraphQLFields and GraphQLArgs.
They not intended to be constructed by hand, for example, you construct GraphQLFieldConfig by hand and pass it to GraphQLObjectType constructor that convert it to GraphQLField internally.
So these changes shouldn't affect any external code since all fields (except introspection fields that are constructed by the library itself) should belong to some type and thus should be created by GraphQLObjectType or GraphQLInterfaceType constructor.

Why it's important: Having a stable set of properties significantly speed up execution since it allows V8 to reuse shadow classes: #2089 (comment)

Since I plan to add extensions fields inside every GraphQL* type as part of #1527 I want to minimize the performance impact of this feature but having one stable set of properties per GraphQL* type.

@IvanGoncharov IvanGoncharov merged commit 901c4e7 into graphql:master Aug 15, 2019
@mjmahone
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bug fix 🐞 requires increase of "patch" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants