Open pdambrauskas opened 8 months ago
Hello đŸ‘‹
Indeed this is a bug. Current fieldset validation logic is pretty crude and doesn't work with polymorphic types. Technically FieldSet
can be any valid selection set so this validation should either be updated or removed altogether to avoid those issues.
Library Version 7.0.2
Describe the bug When I have a union type and want to use it on
@requires
directive, it fails. When I use:I get something like
However, if I do not add the annotation & just edit federated schema, or remove validations by overriding
didGenerateGraphQLType
onFederatedSchemaGeneratorHooks
. Subgraph is federated and works as expectedExpected behaviour support for this kind of directives, without validation errors.
Also, would it make sense to make
validator: FederatedSchemaValidator
injectable onFederatedSchemaGeneratorHooks
and open for overrides so that there was an easy way to disable validation in this kind of edge-case scenarios?Apollo mentions similar usage pattern on Provides directive documentation: https://www.apollographql.com/docs/federation/federated-types/federated-directives/#fields-1