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

Add GraphQLSchema types field #199

Closed
wants to merge 1 commit into from

Conversation

tgriesser
Copy link
Contributor

Per discussion with @leebyron - adds a "types" field on the GraphQLSchema config, requiring all GraphQLObjectTypes implementing interfaces be specified on the Schema definition. GraphQLUnionTypes may be specified in place of their possible ObjectTypes.

Moves the InterfaceType mutation of implementations from the ObjectType constructor to the definition of the Schema, properly deferring a thunk provided as the "interfaces" prop on ObjectType configuration.

This helps prevent the situation where where types are required lazily, thus making it possible an incomplete schema definition could be generated due to runtime mutation of the schema.

Requires all ObjectTypes implementing interfaces be
specified on the Schema definition. UnionTypes may
be specified in place of their possible ObjectTypes.

Moves the InterfaceType mutation from the ObjectType
constructor to the definition of the Schema, properly
deferring the thunk call for the interfaces property
on ObjectType configuration.
@leebyron
Copy link
Contributor

Just wanted to let you know that I haven't forgotten about this - I'd like to do this. I believe this is a breaking change though, and want to wait until we've flushed out some remaining issues with the v0.4.x line before digging into this :)

@tgriesser
Copy link
Contributor Author

Awesome, thanks for the heads up! I figured it was a kind of bigger change and might require a bit more thought.

leebyron added a commit that referenced this pull request Mar 23, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
@leebyron
Copy link
Contributor

The time has come to make this happen! I just rebased atop recent work and went a little further down the rabbit hole in #327. I'm closing this PR in favor of that, but it's still heavily based on your work, @tgriesser so thanks again.

@leebyron leebyron closed this Mar 23, 2016
leebyron added a commit that referenced this pull request Mar 23, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
leebyron added a commit that referenced this pull request Mar 23, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
leebyron added a commit that referenced this pull request Mar 23, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
leebyron added a commit that referenced this pull request Mar 23, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
@tgriesser
Copy link
Contributor Author

Awesome, looks great! Thanks @leebyron!

@tgriesser tgriesser deleted the schema-types branch March 23, 2016 14:25
leebyron added a commit that referenced this pull request Mar 24, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
leebyron added a commit that referenced this pull request Mar 24, 2016
This is a rebased and updated version of @tgriesser's #199. I further extended it to completely remove the side-effectful mutation of Interface types rather than just deferring that mutation to schema creation time.

This introduces a *breaking* change to the Type System API. Now, any individual Interface type does not have the required information to answer `getPossibleTypes` or `isPossibleType` without knowing the other types in the Schema. These methods were moved to the Schema API, accepting the abstract type as the first parameter.

This also introduces a *breaking* change to the type comparator functions: `isTypeSubTypeOf` and `doTypesOverlap` which now require a Schema as a first argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants