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

User Facing Documentation and Examples #243

Closed
carwyn opened this issue Feb 18, 2021 · 7 comments
Closed

User Facing Documentation and Examples #243

carwyn opened this issue Feb 18, 2021 · 7 comments

Comments

@carwyn
Copy link

carwyn commented Feb 18, 2021

While graphql-gateway is very useful standalone, I think much of the utility in graphql-go-tools is in being able to use it in things like (as noted in the README):

  • proxies
  • caches
  • server/client implementations

But, the Godocs alone are quite hard to get into and graphql-gateway in some respects is doing too much for you if you are wanting to build other things into your gateway or proxy (e.g. middlware in front of a Dgraph database in my case).

Some more user (library user) facing documentation and examples to illustrate how graphql-go-tools might be used to make a proxy/client/server would be very useful.

@carwyn
Copy link
Author

carwyn commented Feb 18, 2021

Related to some of the comments in jensneuse/graphql-gateway#4

@StevenACoffman
Copy link

If you would like to see an implementation of the Apollo Federation demo using DGraph as a backend, this branch has that: https://github.com/StevenACoffman/federation-demo/tree/dgraph-again

It uses DGraph's lambda support for the little bit of dynamic behavior required.

I would be interested in adapting this to use the recent federation gateway support to make a pure Go version of federation.

@StevenACoffman
Copy link

Comparing the two, I'm curious why the schema is different. Original:

type Review @key(fields: "id") {
  id: ID!
  body: String
  author: User @provides(fields: "username")
  product: Product
}

type User @extends @key(fields: "id") {
  id: ID! @external
  username: String @external
  reviews: [Review]
}

type Product @extends @key(fields: "upc") {
  upc: String! @external
  reviews: [Review]
}

This repository's federation example version:

type Review {
    body: String!
    author: User! @provides(fields: "username")
    product: Product!
}

extend type User @key(fields: "id") {
    id: ID! @external
    username: String! @external
    reviews: [Review]
}

extend type Product @key(fields: "upc") {
    upc: String! @external
    reviews: [Review]
}

@jensneuse
Copy link
Member

@StevenACoffman good question! =)
If you find a problem with different type definitions, please let me know.

@chedom
Copy link
Contributor

chedom commented Apr 29, 2021

@StevenACoffman
Schema was taken from here
@jensneuse if it's confusing I can change schema in the example.

@StevenACoffman
Copy link

Ah, fair enough ( original is here btw)!

To clarify are @key and @extends directives supported at this point?

@chedom
Copy link
Contributor

chedom commented Apr 29, 2021

@StevenACoffman these directives are supported.
Example of federated schema with @key directive.
Example of federated schema with @extend directive.
Subscription operation is also supported.

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

No branches or pull requests

5 participants