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

Required external fields from other subgraphs return as null if it's a custom object type (Non standard scalar) #7574

Open
zhu302198 opened this issue Oct 7, 2024 · 3 comments
Labels
Area: Apollo Federation Issue is related to Apollo Federation 🌶️ hot chocolate

Comments

@zhu302198
Copy link

Product

Hot Chocolate

Version

13.6.1

Link to minimal reproduction

https://github.com/zhu302198/HC-example/blob/main/example.cs

Steps to reproduce

  1. Define the User type in one subgraph, with a field Profile marked as @external that comes from another subgraph.
  2. Use a ReferenceResolver to resolve the User type with both the UserId and the Profile.
  3. Attempt to query the User object across subgraphs, including the Profile field.
  4. Notice that scalar fields like UserId resolve, but the custom object type Profile is not resolved correctly.

What is expected?

The external Profile object should be correctly resolved across subgraphs, similar to how scalar fields (e.g., Guid) are resolved. The federated schema should be able to retrieve the Profile type’s username field for the User.

What is actually happening?

While scalar fields like Guid (e.g., UserId) are resolved correctly, custom object types like Profile, which are marked as @external, are not being resolved in the federated schema.

Relevant log output

No response

Additional context

No response

@michaelstaib
Copy link
Member

It works if you inject the data as ObjectValueNode instead.

@michaelstaib michaelstaib added the Area: Apollo Federation Issue is related to Apollo Federation label Oct 8, 2024
@zhu302198
Copy link
Author

It works if you inject the data as ObjectValueNode instead.

Do you have a code example of this? I tried to inject it as such, but still no luck. I do see that the entity is coming in within the IResolveContext I injected into the ReferenceResolver method, but I'd rather avoid parsing the context to get the entity

@michaelstaib
Copy link
Member

@glen-84 glen-84 removed the 🐛 bug label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Apollo Federation Issue is related to Apollo Federation 🌶️ hot chocolate
Projects
None yet
Development

No branches or pull requests

3 participants