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

feat: infer bounds for generic nested query fragments #893

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

obmarg
Copy link
Owner

@obmarg obmarg commented Apr 6, 2024

Why are we making this change?

Support for generic parameters in QueryFragment (and elsewhere) was added in v3.0.0. In #708 a user asked how to do this, and I explained that it required two where bounds to be added by hand. I wasn't entirely happy with this: although it makes sense, it's annoyingly verbose and the VariablesFields bound is particularly non-obvious.

What effects does this change have?

This updates the QueryFragment impl to try and infer these bounds when generic parameters are declared on the struct and used on a field that we know is a composite type.

I've not bothered to do the same for scalar or enum fields at present. They also require bounds, but I think they're less useful and I don't want to put the effort in today. Can revisit this if any users complain.

Fixes #708
Fixes #709

Copy link

netlify bot commented Apr 6, 2024

Deploy Preview for cynic-querygen-web canceled.

Name Link
🔨 Latest commit c7f1868
🔍 Latest deploy log https://app.netlify.com/sites/cynic-querygen-web/deploys/6611b08b11b11300084b0022

@obmarg obmarg force-pushed the obmarg/push-tutrxopnrnvl branch 3 times, most recently from 4713ea6 to 37d48b9 Compare April 6, 2024 20:01
@obmarg
Copy link
Owner Author

obmarg commented Apr 6, 2024

I should probably update the book for these changes

@obmarg obmarg modified the milestone: 4.0.0 Apr 7, 2024
@obmarg obmarg added this to the 4.0.0 milestone Jun 8, 2024
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.

Can we infer bounds on generic QueryFragments Is it possible to make the response of a query generic?
1 participant