Add type reference support to interface builders#2602
Merged
Conversation
dondonz
commented
Nov 1, 2021
| return this; | ||
| } | ||
|
|
||
| public Builder withInterface(GraphQLInterfaceType interfaceType) { |
Member
Author
There was a problem hiding this comment.
Shifting this down to be adjacent to the other withInterface method
bbakerman
requested changes
Nov 7, 2021
Member
bbakerman
left a comment
There was a problem hiding this comment.
See the comments on how to avoid a breaking change
| } | ||
|
|
||
| public Builder replaceInterfaces(List<GraphQLInterfaceType> interfaces) { | ||
| public Builder replaceInterfaces(List<? extends GraphQLNamedOutputType> interfaces) { |
Member
There was a problem hiding this comment.
This is an API breaking change - albeit a low likelyhood one - but a breaks a break so if we can NOT do it - let not do it.
This can be rewritten like this to avoid the breaking change
public Builder replaceInterfaces(List<GraphQLInterfaceType> interfaces) {
return replaceInterfacesOrReferences(interfaces);
}
public Builder replaceInterfacesOrReferences(List<? extends GraphQLNamedOutputType> interfacesOrReferences) {
and then up above you can change the impl to be
public GraphQLInterfaceType withNewChildren(SchemaElementChildrenContainer newChildren) {
return transform(builder ->
builder.replaceDirectives(newChildren.getChildren(CHILD_DIRECTIVES))
.replaceFields(newChildren.getChildren(CHILD_FIELD_DEFINITIONS))
.replaceInterfacesOrReferences(newChildren.getChildren(CHILD_INTERFACES))
);
}
dondonz
commented
Nov 14, 2021
| return this; | ||
| } | ||
|
|
||
| public Builder withInterfaces(GraphQLTypeReference... references) { |
bbakerman
approved these changes
Nov 15, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2546.
An interface (or object) can contain a type reference to itself. The referenced type is replaced with the real type object when the schema is built.
This PR adds support for type references in
GraphQLInterfaceTypebuilders, making these equivalent to builders inGraphQLObjectType.