contrib icon indicating copy to clipboard operation
contrib copied to clipboard

feat(entgql): support custom NodeID field

Open giautm opened this issue 3 years ago • 3 comments

giautm avatar Jan 22 '22 17:01 giautm

Thanks for the contribution @giautm. Would you mind elaborate on the use case? 🙂

a8m avatar Jan 24 '22 19:01 a8m

Thanks for the contribution @giautm. Would you mind elaborate on the use case? 🙂

the use case it supports is when I migrate the old Ent-based project to support GQL NodeID (really exposed a Restful API). So, I need to keep the current ID column and add a new global_id to the schema. Then, expose it via this config. In the example, I really demo the use case:

type Document implements Node {
  id: ID! @goField(name: "GlobalID")
  legacyID: ID! @goField(name: "ID")
  name: String!
}

PS: Github uses the same concept to support Restful API/GQL. I hope no one will run into this situation again, 🤦🙃

giautm avatar Jan 24 '22 19:01 giautm

Hey @a8m, I renamed NodeIDField to NodeID and rebase the PR to the master branch. Will you consider merging it?

giautm avatar Feb 11 '22 18:02 giautm