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

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

Open
gzak opened this issue Jan 8, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@gzak
Copy link

gzak commented Jan 8, 2024

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.

@gzak gzak added the bug Something isn't working label Jan 8, 2024
@gzak gzak changed the title parameterized @external field resolver should not generate resolver methods[Short Description] parameterized @external field resolver should not generate resolver methods Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant