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

feat(Apollo): Format Schema For Apollo Gateway #7298

Merged
merged 22 commits into from
Jan 18, 2021

Conversation

minhaj-shakeel
Copy link
Contributor

@minhaj-shakeel minhaj-shakeel commented Jan 15, 2021

Fixes GRAPHQL-951.
This PR modifies GraphQL generated schema in order to support federation.
It also removes some directive definitions which currently give validation error in apollo.
This PR also removes generated mutations and mutation input types from the Generated schema.


This change is Reviewable

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 10 files reviewed, 7 unresolved discussions (waiting on @minhaj-shakeel)


graphql/admin/admin.go, line 390 at r1 (raw file):

func SchemaValidate(sch string) error {
	schHandler, err := schema.NewHandler(sch, true, false)

for Apollo also, this should be called once when schema updates and then be stored in memory


graphql/e2e/schema/apolloServiceResponse.graphql, line 5 at r1 (raw file):

#######################

type Todo @key(fields: "id") {

Rename file to apollo_service_response.graphql


graphql/schema/gqlschema.go, line 898 at r1 (raw file):

// completeSchema generates all the required types and fields for
// query/mutation/update for all the types mentioned in the schema.
// In case of Apollo service Query, input types from mutations and mutations

from queries and mutations


graphql/schema/gqlschema.go, line 996 at r1 (raw file):

		}

		if apolloServiceQuery && hasExtends(defn) {

this can be moved above the params definition


graphql/schema/gqlschema.go, line 2410 at r1 (raw file):

// var "apolloServiceQuery" is used to distinguish Schema String from what should be
// returned as a result of apollo service query. In case of Apollo service query, Schema
// misses some of the directive definitions which are currently not supported at the GateWay.

Schema removes some of the

gateway


graphql/schema/schemagen.go, line 80 at r1 (raw file):

// some directives which are not exposed to the Apollo Gateway
// as they are failing in the schema validation which is a bug
// in their library.

Add link to GitHub issue on the Apollo project


graphql/schema/schemagen.go, line 81 at r1 (raw file):

// as they are failing in the schema validation which is a bug
// in their library.
func (s *handler) GQLSchemaWithoutApolloExtras() string {

Add some unit tests for this also where given some input schemas and the output schema that we send to Apollo.

@minhaj-shakeel minhaj-shakeel merged commit 33481e6 into minhaj/apollo-federation Jan 18, 2021
@minhaj-shakeel minhaj-shakeel deleted the minhaj/fix-service branch January 18, 2021 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants