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

Relay - Global Object Identification specification #50

Open
AleksandarFaraj opened this issue Jan 7, 2023 · 0 comments
Open

Relay - Global Object Identification specification #50

AleksandarFaraj opened this issue Jan 7, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@AleksandarFaraj
Copy link

AleksandarFaraj commented Jan 7, 2023

Hello! Thanks for a great library!

I'm looking to create a front facing 99design/gqlgen server that interacts with my internal grpc service. I'm looking to create a graphql server to fulfill https://graphql.org/learn/global-object-identification/ (GOI)

I use this library to autobind my base types but I don't use the resolvers at all, I use gqlgen for that. I still would like to use both go, go-grpc, gogql and gpl.

The graphql schema I'm trying to replicate can be found here: https://relay.dev/docs/guides/graphql-server-specification/

There are some issues I run into that could be solved:

  1. Graphql "type Ship implements Node"
    Issue: I would like to extend my proto types but it's not possible.
    Solution: a message option could be made like this:
    message Ship {
    option (danielvladco.protobuf.graphql.message) = {implements: "Node"};
    string id = 1;
    }
    Expected:
    The gogql outputs: type Node interface { IsNode() } func (*Ship) IsNode() {}
    The gpl outputs following graphql: type Ship implements Node {}
    Considerations: if node was a type / message Node {} then it would be a struct generated by go/go-grpc that would collide with a possilbe interface Node {}. Another question is how and where the Node definition should be, perhaps there is a nested option structure that can be applied as a file option?.

  2. gql generator, generates "dummy" query for "definition" proto files that contain only types (message Ship, etc.).
    Issue: If I only want types to be generated in the .graphql, it's not possible right now. It only output types that are traversed from a service then method and then field. There is a svc=false config that only applies to the directive.

  3. change the type of id to ID.
    Issue: Creating a custom type creates a nested like structure in proto which is not ideal.
    Solution: a field option that changes the type of graphql.
    string id = 1 [(danielvladco.protobuf.graphql.field) = {required: true, type: "ID"}];
    Expected:
    The gpl outputs following graphql: type Ship { id: ID! }

@danielvladco danielvladco added the enhancement New feature or request label Jan 10, 2023
@danielvladco danielvladco self-assigned this Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants