You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've inherited code that currently uses gqlgen v0.7.1. I'm trying to upgrade to 0.13.0, to take advantage of new features.
There's a change to generated field capitalization which ripples through this inherited code base. I'm hoping to override gqlgen's current preferred capitalization. I haven't found any way to do that (short of defining the models manually).
For example, if I define a gql type...
type Something {
somethingDDL: Int!
somethingGB: Int!
}
the generated go type is...
type Something struct {
SomethingDdl int // I want "SomethingDDL" here
SomethingGb int // I want "SomethingGB" here
}
I've tried to set the name using @goField(name: "SomethingDDL") directives. And I've tried to set the field name in the gqlgen.yml file. Either I haven't done it just right, or the capitalization of generated names cannot be overridden.
What did you expect?
I'd like to better control the capitalization of generated field names. If I could, I'd make the generated code capitalize the first letter of the GQL field name, and leave the other letters unchanged.
It would be a nice feature to have, because gqlgen is opinionated when it comes to capitalizing field names. It insists that "Id" (not an acronym) be spelled "ID", while "GB" (an acronym) be spelled "Gb". And this has changed sometime between version 0.7 and 0.13.
Minimal graphql.schema and models to reproduce
Sorry I haven't put together a minimal schema.
versions
gqlgen version?
0.13.0
go version?
1.15.2
dep or go modules?
modules
The text was updated successfully, but these errors were encountered:
typeRenameFieldTeststruct {
GOODnaMestring`json:"badName"`// <----- field name should be GOODnaME, but e is lowercase!OtherFieldstring`json:"otherField"`
}
What happened?
I've inherited code that currently uses gqlgen v0.7.1. I'm trying to upgrade to 0.13.0, to take advantage of new features.
There's a change to generated field capitalization which ripples through this inherited code base. I'm hoping to override gqlgen's current preferred capitalization. I haven't found any way to do that (short of defining the models manually).
For example, if I define a gql type...
the generated go type is...
I've tried to set the name using
@goField(name: "SomethingDDL")
directives. And I've tried to set the field name in the gqlgen.yml file. Either I haven't done it just right, or the capitalization of generated names cannot be overridden.What did you expect?
I'd like to better control the capitalization of generated field names. If I could, I'd make the generated code capitalize the first letter of the GQL field name, and leave the other letters unchanged.
It would be a nice feature to have, because gqlgen is opinionated when it comes to capitalizing field names. It insists that "Id" (not an acronym) be spelled "ID", while "GB" (an acronym) be spelled "Gb". And this has changed sometime between version 0.7 and 0.13.
Minimal graphql.schema and models to reproduce
Sorry I haven't put together a minimal schema.
versions
gqlgen version
?0.13.0
go version
?1.15.2
dep or go modules?
modules
The text was updated successfully, but these errors were encountered: