apollo-federation-subgraph-compatibility icon indicating copy to clipboard operation
apollo-federation-subgraph-compatibility copied to clipboard

Validate directive locations in subgraph implementations

Open kdawgwilk opened this issue 3 years ago • 1 comments

Not sure the best way to test this but we just noticed that absinthe_federation did not have up-to-date locations defined on a few federation directives. Not sure if they were wrong from the beginning or if @apollo/subgraph updated its implementation but it would be nice to know when that happens and have this test suite notify subgraph maintainers of those types of changes. absinthe_federation PR to update directive definitions for reference https://github.com/DivvyPayHQ/absinthe_federation/pull/58

kdawgwilk avatar Aug 02 '22 20:08 kdawgwilk

Hello 👋 I think that is a good idea but might be somewhat problematic to test.

We are comparing the expected schema against the SDL returned by the _service { sdl } query

  • in federation v1 all the federated definitions should be stripped out of this SDL
  • federation v2 relaxed the composition rules so the _service { sdl } can simply return full SDL definition (including federated definitions, this is the preferred implementation right now) but it still works fine if definitions are excluded (for backwards compatibility)
  • with introduction of @link directive, federated definitions can now be imported and don't have to be present within the SDL returned by _service { sdl }

So sadly not every implementation will contain those definitions as they don't have to be present in the _service { sdl }

dariuszkuc avatar Aug 11 '22 23:08 dariuszkuc