Skip to content

parameterized @external field resolver should not generate resolver methods #1447

Open
@gzak

Description

@gzak

Issue Description

NOTE: this is a duplicate of #1383, but since I'm unable to re-open the issue I've recreated it here. Feel free to close this one as duplicate and re-open the original on my behalf to continue the discussion there.

Take a look at the following example in the Apollo documentation.

Currently, this would generate a set of classes as follows:

class Product {
  id, shippingEstimate; // lazy shorthand
}

interface IQueryResolver {
  Product someRootResolver(...);
}

interface IProductResolver {
  Integer weight(Product product);
}

But it should not generate a separate IProductResolver interface for the weight field since it is marked @external, meaning this subgraph cannot resolve it. Instead, it should just generate a plain old field as part of the Product class, and assume that some other subgraph will resolve it:

class Product {
  id, weight, shippingEstimate; // lazy shorthand
}

interface IQueryResolver {
  Product someRootResolver(...);
}

Setting generateParameterizedFieldsResolvers to false does indeed generate the java type correctly, but the plugin should be smart enough to realize that @external parameterized fields can't possibly be resolved by the current subgraph and so should automatically be omitted from resolver method generation even when generateParameterizedFieldsResolvers is set to true.

EDIT: I realize now that the server behavior isn't controlled by this plugin, so I've opened a sister ticket there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions