Skip to content

Generate fragments for interfaces - #955

Open
ryanflegel wants to merge 1 commit into
Netflix:masterfrom
ryanflegel:interface-fragments
Open

Generate fragments for interfaces#955
ryanflegel wants to merge 1 commit into
Netflix:masterfrom
ryanflegel:interface-fragments

Conversation

@ryanflegel

Copy link
Copy Markdown

Generate fragments projection methods for interfaces.

Currently dgs-codegen only generates fragment projection methods for concrete types and union member types, however it is also valid to do fragment projections on interfaces.

This fixes #855.

prefix: String,
processedEdges: Set<Pair<String, String>>,
queryDepth: Int,
fragment: Boolean = false,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to know if the projection is for a fragment so that we don't generate fragments within fragments.

when (type) {
is InterfaceTypeDefinition -> {
document
.getDefinitionsOfType(InterfaceTypeDefinition::class.java)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the heart of the change -- we now include other interface types in addition to concrete object types.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to generate projection for an interface

1 participant