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

Function names updated incorrectly when containing ID #3313

Open
golanglemonade opened this issue Oct 3, 2024 · 0 comments
Open

Function names updated incorrectly when containing ID #3313

golanglemonade opened this issue Oct 3, 2024 · 0 comments

Comments

@golanglemonade
Copy link

golanglemonade commented Oct 3, 2024

What happened?

Change to wordWalker in v0.17.55 unexpectedly changed all the LT/EQ function names if they contained ID

For example:

previous version correctly capitalized the G and L in these: (v0.17.54)

	OwnerIDGt           *string  `json:"ownerIDGT,omitempty"`
	OwnerIDGte          *string  `json:"ownerIDGTE,omitempty"`
	OwnerIDLt           *string  `json:"ownerIDLT,omitempty"`
	OwnerIDLte          *string  `json:"ownerIDLTE,omitempty"`

With the v0.17.55 version they are lowercased

	OwnerIdgt           *string  `json:"ownerIDGT,omitempty"`
	OwnerIdgte          *string  `json:"ownerIDGTE,omitempty"`
	OwnerIdlt           *string  `json:"ownerIDLT,omitempty"`
	OwnerIdlte          *string  `json:"ownerIDLTE,omitempty"

This looks to be due to https://github.com/99designs/gqlgen/pull/3302/files

What did you expect?

Functions correctly capitalized when containing the ID

Minimal graphql.schema and models to reproduce

Adding the following test to template_test.go:ToGo:

	require.Equal(t, "OwnerIDGT", ToGo("OwnerIDGT"))
        	Error Trace:	/Users/sarahfunkhouser/go/src/github.com/golanglemonade/gqlgen/codegen/templates/templates_test.go:59
        	Error:      	Not equal:
        	            	expected: "OwnerIDGT"
        	            	actual  : "OwnerIdgt"

versions

  • go run github.com/99designs/gqlgen version? v0.17.55
  • go version? 1.23.2
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

1 participant