René's URL Explorer Experiment


Title: Can't resolve fields of inline fragments when inspecting a query · Issue #1718 · graphql-java/graphql-java · GitHub

Open Graph Title: Can't resolve fields of inline fragments when inspecting a query · Issue #1718 · graphql-java/graphql-java

X Title: Can't resolve fields of inline fragments when inspecting a query · Issue #1718 · graphql-java/graphql-java

Description: I've ran into similar issue as in already reported #973 but with no information about how to go around it. Background What we are doing is that, at the beginning of query execution, we inspect the whole query to create our custom graph d...

Open Graph Description: I've ran into similar issue as in already reported #973 but with no information about how to go around it. Background What we are doing is that, at the beginning of query execution, we inspect the ...

X Description: I've ran into similar issue as in already reported #973 but with no information about how to go around it. Background What we are doing is that, at the beginning of query execution, we inspect ...

Opengraph URL: https://github.com/graphql-java/graphql-java/issues/1718

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can't resolve fields of inline fragments when inspecting a query","articleBody":"I've ran into similar issue as in already reported **https://github.com/graphql-java/graphql-java/issues/973** but with no information about how to go around it. \r\n\r\n**Background**\r\nWhat we are doing is that, at the beginning of query execution, we inspect the whole query to create our custom graph data fetching strategy before the GQL data fetchers are called. Data fetchers, in the end, should just access the graph data fetching result, and should not do any DB fetching. The whole fetching should happen at once at the beginning of the query, not lazily.\r\n\r\nSo the pipeline goes something like this:\r\n\r\nGQL query -> query inspection -> our graph selection strategy -> our strategy execution -> graph object result -> GQL data fetchers simply accessing the result\r\n\r\n**Inspection phase**\r\nTo understand what to fetch in our fetching strategy, we are going through the query by using the root *DataFetchingEnvironment* and going through the *SelectedField*s coming from *DataFetchingFieldSelectionSet*s. Thus resolving all the arguments, and all the nested fields we need to fetch. \r\n\r\nThis works fine.\r\n\r\n**The issue**\r\nThe issue comes when the query contains inline fragments that contain additional fields (that we want to know about beforehand). From the above inspection, the GQL java API doesn't return such information (inline fragments are ignored, and the fields below don't get resolved), and so we don't know what to fetch.\r\n\r\nWe get that information only in the data fetcher of that field when it comes to it. But that is already late, as we want to make the whole graph fetching eager at the beginning, not lazily (based on the data fetchers of individual fields).\r\n\r\n**Example**\r\n\r\n    {\r\n        parent {\r\n            ...on ChildA {\r\n                fieldA\r\n            }\r\n            ...on ChildB {\r\n                fieldB\r\n            }\r\n        }\r\n    }\r\n\r\nGoing through the `env.getSelectionSet()` of that query, the fields `fieldA` and `fieldB` are nowhere to be found.\r\n\r\n**Investigation**\r\nThere is a piece of code in the GQL java which is connected to this issue:\r\n\r\n    // DataFetchingFieldSelectionSetImpl.java\r\n\r\n    private void traverseFields(MergedField fieldList, GraphQLFieldsContainer parentFieldType, String fieldPrefix) {\r\n\r\n        FieldCollectorParameters parameters = FieldCollectorParameters.newParameters()\r\n                .schema(graphQLSchema)\r\n                .objectType(asObjectTypeOrNull(parentFieldType))            \u003c-------------- this is important part\r\n                .fragments(fragmentsByName)\r\n                .variables(variables)\r\n                .build();\r\n\r\nHere the `parentFieldType` refers to the type of the `parent` field, which is, in this case, an interface. The information about the inline fragment and the type the fragment refers to is not present at this point, so the `asObjectTypeOrNull()` returns `null`. This causes the `FieldCollector` not to collect the fields of the inline fragment (`checkTypeCondition()` returns false).\r\n\r\n**Question**\r\nNow, I don't know if this is a bug or it's by design. The concrete GQL type of the inline fragment is known (childA, or childB), thus the fields should be possible to be resolved.\r\n\r\nIf it isn't a bug, how can I get the complete information about what graph structure I'm fetching before actually calling the GQL java data fetchers?\r\n\r\nNote: as I need to resolve the arguments, and variables, etc. I can't use the MergedField API to get that information (that one contains the whole tree, as in the query, but it is unresolved)","author":{"url":"https://github.com/redhead","@type":"Person","name":"redhead"},"datePublished":"2019-12-19T12:41:40Z","url":"https://github.com/graphql-java/graphql-java/issues/1718"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:2cbf888c-bf9a-4b77-63da-347323d3f805
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE3A2:1DC4CC:308CD6:40CEEE:6B0190B9
html-safe-nonce77dcf47e04d5e8d18887f9c6b06bbd9fcb9c71e25d76d3d9cdc90296df883fa4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0EyOjFEQzRDQzozMDhDRDY6NDBDRUVFOjZCMDE5MEI5IiwidmlzaXRvcl9pZCI6IjI2Mjc1ODk3Mzk5ODA2MjQwNTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0f1e32baa6ec48d549b1d7431e675f0be61586359b71fbfef8c3ef334d6acb88
hovercard-subject-tagissue:540290456
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/graphql-java/1718/issue_layout
twitter:imagehttps://opengraph.githubassets.com/df9d81cf24376e6087f0071947c38d945553f5b224d7e697f7390acc01961c0b/graphql-java/graphql-java/issues/1718
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/df9d81cf24376e6087f0071947c38d945553f5b224d7e697f7390acc01961c0b/graphql-java/graphql-java/issues/1718
og:image:altI've ran into similar issue as in already reported #973 but with no information about how to go around it. Background What we are doing is that, at the beginning of query execution, we inspect the ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameredhead
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git
octolytics-dimension-user_id14289921
octolytics-dimension-user_logingraphql-java
octolytics-dimension-repository_id38602457
octolytics-dimension-repository_nwographql-java/graphql-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id38602457
octolytics-dimension-repository_network_root_nwographql-java/graphql-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/graphql-java/graphql-java/issues/1718#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fissues%2F1718
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fissues%2F1718
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=graphql-java%2Fgraphql-java
Reloadhttps://github.com/graphql-java/graphql-java/issues/1718
Reloadhttps://github.com/graphql-java/graphql-java/issues/1718
Reloadhttps://github.com/graphql-java/graphql-java/issues/1718
graphql-javahttps://github.com/graphql-java
graphql-javahttps://github.com/graphql-java/graphql-java
Codehttps://github.com/graphql-java/graphql-java
Issues27 (27)https://github.com/graphql-java/graphql-java/issues
Pull requests35 (35)https://github.com/graphql-java/graphql-java/pulls
Discussionshttps://github.com/graphql-java/graphql-java/discussions
Actionshttps://github.com/graphql-java/graphql-java/actions
Projectshttps://github.com/graphql-java/graphql-java/projects
Wikihttps://github.com/graphql-java/graphql-java/wiki
Security and qualityhttps://github.com/graphql-java/graphql-java/security
Insightshttps://github.com/graphql-java/graphql-java/insights
https://github.com/graphql-java/graphql-java
New issuehttps://github.com/login?return_to=https://github.com/graphql-java/graphql-java/issues/1718
New issuehttps://github.com/login?return_to=https://github.com/graphql-java/graphql-java/issues/1718
Can't resolve fields of inline fragments when inspecting a queryhttps://github.com/graphql-java/graphql-java/issues/1718#top
https://github.com/redhead
redheadhttps://github.com/redhead
on Dec 19, 2019https://github.com/graphql-java/graphql-java/issues/1718#issue-540290456
#973https://github.com/graphql-java/graphql-java/issues/973
https://github.com/andimarek
andimarekhttps://github.com/andimarek
on Jan 14, 2020https://github.com/graphql-java/graphql-java/issues/1718#issuecomment-574016266
#1731https://github.com/graphql-java/graphql-java/pull/1731
https://github.com/redhead
redheadhttps://github.com/redhead
on Jan 29, 2020https://github.com/graphql-java/graphql-java/issues/1718#issuecomment-579809500
redheadhttps://github.com/redhead
completedhttps://github.com/graphql-java/graphql-java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jan 29, 2020https://github.com/graphql-java/graphql-java/issues/1718#event-2989962016
Sign up for freehttps://github.com/signup?return_to=https://github.com/graphql-java/graphql-java/issues/1718
Sign in to commenthttps://github.com/login?return_to=https://github.com/graphql-java/graphql-java/issues/1718
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.