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

Current implementation of federation does not conform to the Apollo Federation subgraph specification #1834

Closed
newerbie opened this issue Jan 21, 2022 · 1 comment · Fixed by #1835

Comments

@newerbie
Copy link
Contributor

What happened?

There are several issues in federation implementation according to the Apollo Federation subgraph specification:

  1. When customizing root query type, _service is not generated in customized query struct. Then Apollo gateway cannot get service definition in subgraph.
  2. If @key directive is not used in graphql schema, both _service and _entities are not generated.

What did you expect?

  1. _service is generated in customized query struct.
  2. _service is generated in any case, while _entities is generated only when @key directive exists.

Minimal graphql.schema and models to reproduce

schema {
    query: CustomQuery
}

type Hello {
  name: String!
}

type CustomQuery {
  hello: Hello!
}

versions

  • gqlgen version 0.15.1
  • go version 1.17
  • dep or go modules? go modules
@ipfans
Copy link
Contributor

ipfans commented Jan 21, 2022

@StevenACoffman Please review this and help us fix it.

StevenACoffman pushed a commit that referenced this issue Jan 22, 2022
* Fix federation implementation which does not conform to Apollo Federation subgraph specification

* Optimize generated line breaks

* Run go generate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants