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

Interface getters are not using goField directive #2439

Closed
darkLord19 opened this issue Nov 28, 2022 · 0 comments · Fixed by #2447
Closed

Interface getters are not using goField directive #2439

darkLord19 opened this issue Nov 28, 2022 · 0 comments · Fixed by #2447

Comments

@darkLord19
Copy link
Contributor

darkLord19 commented Nov 28, 2022

What happened?

Create an interface with few types implementing it. Override generated models fields name with goField directive. Notice that getters generated by gqlgen don't use goField directive to access fields inside getters.

What did you expect?

Getters should use correct field names.

Minimal graphql.schema and models to reproduce

Schema:

interface Resource {
  id: String!
  createdById: String! @goField(name: "CreatedById")
  updatedById: String @goField(name: "UpdatedById")
  createdAt: String!
  updatedAt: String!
}

type ResourceImpl1 implements Resource {
  id: String! @goTag(key: "copier", value: "XId")
  createdById: String! @goField(name: "CreatedById")
  updatedById: String @goField(name: "UpdatedById")
  createdAt: String!
  updatedAt: String!
  type: String!
  shared: Boolean!
}

Generated getter functions:

func (this ResourceImpl1) GetCreatedByID() string  { return this.CreatedByID }
func (this ResourceImpl1) GetUpdatedByID() *string { return &this.UpdatedByID }

versions

  • go run github.com/99designs/gqlgen version? v0.17.20
  • go version? go version go1.19.3 darwin/arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant