Skip to content

feat: infer bounds for generic nested query fragments#893

Open
obmarg wants to merge 1 commit intomainfrom
obmarg/push-tutrxopnrnvl
Open

feat: infer bounds for generic nested query fragments#893
obmarg wants to merge 1 commit intomainfrom
obmarg/push-tutrxopnrnvl

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

@netlify
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 force-pushed the obmarg/push-tutrxopnrnvl branch from 37d48b9 to c7f1868 Compare April 6, 2024 20:28
@obmarg obmarg modified the milestone: 4.0.0 Apr 7, 2024
@obmarg obmarg added this to the 4.0.0 milestone Jun 8, 2024
@obmarg obmarg force-pushed the obmarg/push-tutrxopnrnvl branch from c7f1868 to da20eaf Compare February 17, 2025 15:43
@netlify
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for cynic-querygen-web ready!

Name Link
🔨 Latest commit da20eaf
🔍 Latest deploy log https://app.netlify.com/sites/cynic-querygen-web/deploys/67b3593363ce330008cb26b5
😎 Deploy Preview https://deploy-preview-893--cynic-querygen-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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