apollographql / federation-hotchocolate

HotChocolate support for Apollo Federation
https://www.apollographql.com/docs/federation/
MIT License
16 stars 8 forks source link

bug: Required External fields are not populated in Extend class #53

Closed arekgwizdziel closed 1 year ago

arekgwizdziel commented 1 year ago

Hey,

I'm observing the same behaviour as in these two below using new Federation library:

https://github.com/ChilliCream/graphql-platform/issues/6203 https://github.com/ChilliCream/graphql-platform/issues/5891

I can see values from other subgraphs in context.Variables so I guess it's just a bug with propagating them to Extend class?

dariuszkuc commented 1 year ago

Hello 👋 This appears to be working fine? I tried reproducing it locally and it seemed to work correctly (but actually uncovered a bug in our testing suite....).

Can you provide a link to a repository that reproduces this issue?

arekgwizdziel commented 1 year ago

Sorry for a little delay, here's the repo: https://github.com/arekgwizdziel/federation-external-bug-repro.

The outcome below: Pasted image 20231114141922

As you can see, the class field is not populated but when I traversed the Variables bucket, I can see that the data is there is representations variable.

Am I misunderstanding something?

dariuszkuc commented 1 year ago

Hello 👋 You need to populate the external fields from your [ReferenceResolver]. All those external @requires fields are provided when resolving the entity representation. While we are working towards simplified solution, currently when instantiating entity you need to set all those fields. See example from compatibility project.

arekgwizdziel commented 1 year ago

Oh, alright! I have no idea, thanks a lot for this!