Skip to content

Batching type resolution #1869

Answered by samuelAndalon
hrkfdn asked this question in General
Oct 11, 2023 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

I'm not sure I fully understood. How would I use FederatedTypePromiseResolver with batch loading with a single representation?

  1. Define your resolvers for federated entities
// This service does not own the "Product" type but is extending it with new fields
@KeyDirective(fields = FieldSet("id"))
@ExtendsDirective
class Product(@ExternalDirective val id: String) {
  fun newField(): String = getNewFieldByProductId(id)
}

// This is how the "Product" class is created from the "_entities" query using promise resolver
class ProductResolver : FederatedTypePromiseResolver<Product> {
    override val typeName: String = "Product"

    override fun resolve(
        environment: DataFetchingEnviro…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@samuelAndalon
Comment options

@hrkfdn
Comment options

Answer selected by hrkfdn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1867 on October 18, 2023 19:12.