I am trying to write a query that uses data across two subgraphs to allow for filtration based on data from both subgraphs, but I do not want to expose the dependent data to the client. If I mark the dependent data as @inaccessible, my query breaks. This seems like it should work based on the language in the docs, especially
Note that Position.z does appear in the supergraph schema, but the API schema enforces which fields clients can include in operations.
Does this indicate that the @requires must be a publicly accessible query and thus that @inaccessible fields are not available there?
I get the message:
"Cannot add selection of field \"Example.sensitiveUserData\" to selection set of parent type \"Example\" (that does not declare that field)",
Here is my SDL:
subgraph A
type Example @key(fields: "id"){
id: ID!
sensitiveUserData: SensitiveUserData @inaccessible
}
type SensitiveUserData {
age: Int
}
subgraph B
type Example @key(fields: "id"){
id: ID!
sensitiveUserData: SensitiveUserData @external
someDerivedData: DerivedData @requires(fields: "sensitiveUserData { age }")
}
Can you clarify where are you getting "Cannot add selection of field \"Example.sensitiveUserData\" to selection set of parent type \"Example\" (that does not declare that field)", error?
This is a valid use case that is supported by the Federation 2.
Are you trying to query for sensitiveUserData field (which will be @inaccessible for end users through Gateway/Router but will passed over to subgraph B when resolving someDerivedData)?
I get this error returned by Gateway to the client when I submit a query that specifies the someDerivedData field. I am not asking for the @inaccessible field. It seems like the error is coming from the @requires field asking for the data somehow. Say something like