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

Initialisms make some words codegen with weird capitalization #3441

Open
amruth-opal opened this issue Dec 18, 2024 · 1 comment
Open

Initialisms make some words codegen with weird capitalization #3441

amruth-opal opened this issue Dec 18, 2024 · 1 comment

Comments

@amruth-opal
Copy link

What happened?

if you declare an enum in your schema like

enum MessagingPlatform {
  SLACK
}

the go type it codegens

type MessagingPlatform string

const (
	MessagingPlatformSLACk                     MessagingPlatform = "SLACK"
)

I believe this is because Slack contains the initialism SLA so it's keeping the initialism capitalized and then capitalizing the first letter. Possible relevant code file

What did you expect?

I would expect a way to express that the SLA substring is not an initialism and have it look like Slack. What would you recommend to enable this?

Minimal graphql.schema and models to reproduce

See above

versions

  • gqlgen version v0.17.57
  • go version go version go1.23.4 darwin/arm64
@Brookke
Copy link
Contributor

Brookke commented Dec 20, 2024

Hey @amruth-opal you could use the config option go_initialisms to drop all the default initialisms and replace them with your own which may help?

go_initialisms:
  replace_defaults: true # if true, the default initialisms will get dropped in favor of the new ones instead of being added
  initialisms: # List of initialisms to for Go names
    - 'CC' 
    - 'BCC'

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

No branches or pull requests

2 participants