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: fragments on interfaces in the generator #994

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Conversation

obmarg
Copy link
Owner

@obmarg obmarg commented Jul 26, 2024

The generator contains a function field_from_path that accepts a root type and a path. This was originally written before I supported fragments, so assumed that the root type would always be an object (as it is for query, mutation & subscription roots). For fragments though the root type can also be an interface or a union type.

This partially fixes the problem so that we support interfaces. I didn't add support for unions because unions don't specifically have fields (except __typename) and I can't remember how this stuff works well enough to fix it for unions right now.

Suspect there might be other problems related to this in there, but that's a problem for another day.

Fixes #993

The generator contains a function `field_from_path` that accepts a root type
and a path.  This was originally written before I supported fragments, so
assumed that the root type would always be an object (as it is for query,
mutation & subscription roots).  For fragments though the root type can also be
an interface or a union type.

This partially fixes the problem so that we support interfaces.  I didn't add
support for unions because unions don't specifically have fields (except
`__typename`) and I can't remember how this stuff works well enough to fix it
for unions right now.

Suspect there might be other problems related to this in there, but that's a
problem for another day.

Fixes #993
@obmarg obmarg enabled auto-merge (squash) July 26, 2024 19:22
Copy link

netlify bot commented Jul 26, 2024

Deploy Preview for cynic-querygen-web canceled.

Name Link
🔨 Latest commit 1680e17
🔍 Latest deploy log https://app.netlify.com/sites/cynic-querygen-web/deploys/66a3f733fbc04100081080fe

@obmarg obmarg merged commit 35a1fec into main Jul 26, 2024
6 checks passed
@obmarg obmarg deleted the obmarg/wvpxpqqomqqu branch July 26, 2024 19:24
@harrysolovay harrysolovay mentioned this pull request Aug 28, 2024
@cynic-releaser cynic-releaser bot mentioned this pull request Aug 23, 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.

Generator fails to handle a fragment
1 participant