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

request: process arbitrary fields by resolver #161

Closed
vvakame opened this issue Jul 1, 2018 · 2 comments · Fixed by #173
Closed

request: process arbitrary fields by resolver #161

vvakame opened this issue Jul 1, 2018 · 2 comments · Fixed by #173

Comments

@vvakame
Copy link
Collaborator

vvakame commented Jul 1, 2018

I want to process id: ID! field by resolver.

Relay Global Object Identification Specification required This id should be a globally unique identifier for this object.
but almost Database is not support that.
GitHub v4 uses something like echo 010:Repository52265602 | base64 for id.

My app already have ID field and It is difficult to change.
so, I want to modify id value by resolver.

I think that it is good to write in types.json like this.

{
  "Event": {
    "entity": "github.com/vvakame/foobar.Event",
    "fields": {
      "id": {
        "resolver": true
      }
    }
  }
}

I saw #156 and @resolver directive.
but I want to use schema.graphql to communication between server-side engineer and frontend engineer.
I don't want to expose server-side issue to frontend.

What do you think about this idea?

@vektah
Copy link
Collaborator

vektah commented Jul 2, 2018

Yeah, a few others have expressed similar sentiments.

I've been trying not to put any logic into types.json to keep it simple. If we do head down we probably should switch to yaml. It's a pain to support two sets of syntax for this though 😞

Another approach would be to provide a gqlgen strip-schema that takes the schema and removes all of its config directives, that doesn't need the service running to easily get a copy.

@vvakame
Copy link
Collaborator Author

vvakame commented Jul 2, 2018

@vektah I sent a PR that add support to types.yaml 👍

gqlgen strip-schema can not satisfied our team.
because, schema.graphql is modified by server-side engineer and frontend engineer both.
When we want to change GraphQL schema, modify it & sending PR and review each other, make consensus.

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