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

fix: remove public Query field from go generated types #6849

Merged
merged 2 commits into from Mar 8, 2024

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Mar 7, 2024

Follow-up to #6716 - people were using Query as a method name, see discord.

This could cause name clashes and was annoying. Thankfully, there's only one legitimate need for this field to be public - interfaces.

We can provide a workaround for this with the new WithGraphQLQuery method on generated types, which resets the underlying type, and sets the query.


I did briefly consider the idea of using an XXX prefix for Query, but I prefer having a method to set the private field since then it's not possible to set the query, but not modify the cached properties, which would definitely result in weird things happening.

@jedevc jedevc requested review from vito and TomChv March 7, 2024 13:23
@jedevc jedevc added this to the v0.10.2 milestone Mar 7, 2024
Copy link
Contributor

@vito vito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha that conflict happened more quickly than I expected.

Looks like a check is failing but approving in principle

@jedevc
Copy link
Member Author

jedevc commented Mar 7, 2024

984    module_test.go:3489: 
985        	Error Trace:	/app/core/integration/module_test.go:3489
986        	Error:      	
987        	Test:       	TestModuleCodegenOnDepChange/python_uses_go
988    suite_test.go:271: 

Don't worry it's our good ole friend #6770 😱

This could cause name clashes and was annoying. Thankfully, there's only
one legitimate need for this field to be public - interfaces.

We can provide a workaround for this with the new `WithGraphQLQuery`
method on generated types, which resets the underlying type, and sets
the query.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
@jedevc jedevc merged commit 80dbb1d into dagger:main Mar 8, 2024
43 checks passed
@jedevc jedevc deleted the go-hide-query-field branch March 8, 2024 10:03
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

Successfully merging this pull request may close these issues.

None yet

2 participants