René's URL Explorer Experiment


Title: Fix @skip definition is added twice to the GraphQLSchema when defined in sdl by tinnou · Pull Request #2940 · graphql-java/graphql-java · GitHub

Open Graph Title: Fix @skip definition is added twice to the GraphQLSchema when defined in sdl by tinnou · Pull Request #2940 · graphql-java/graphql-java

X Title: Fix @skip definition is added twice to the GraphQLSchema when defined in sdl by tinnou · Pull Request #2940 · graphql-java/graphql-java

Description: Description When @skip/@include is defined in a SDL, schema generation will create a GraphQLSchema with multiple skip/include definitions. This can cause problems when a schema is serialized and parsed multiple times. A little far fetched example: @Test fun parse() { val schema: GraphQLSchema = """ type Query { hello: String } """.trimIndent().mockSchema() val sdl = schema.printSdl() val schema2 = sdl.mockSchema() val sdl2 = schema2.printSdl() sdl2.mockSchema() // throws } fun GraphQLSchema.printSdl(): String { return SchemaPrinter(SchemaPrinter.Options.defaultOptions() .includeDirectiveDefinitions(true) ).print(this) } will throw: Caused by: SchemaProblem{errors=['include' type [@13:1] tried to redefine existing directive 'include' type [@7:1], 'skip' type [@25:1] tried to redefine existing directive 'skip' type [@19:1]]} at graphql.schema.idl.SchemaParser.buildRegistry(SchemaParser.java:156) at graphql.schema.idl.SchemaParser.parseImpl(SchemaParser.java:124) at graphql.schema.idl.SchemaParser.parse(SchemaParser.java:90) at graphql.schema.idl.SchemaParser.parse(SchemaParser.java:75) We could add a predicate to avoid printing directives skip and include but it would sit better if we could ensure printing the sdl generates a valid SDL (that can be parsed back into a valid GraphQLSchema). The actual issue comes from the fact @skip and @include are added by default on the GraphQLSchema builder. Expected Behavior To preserve the behavior of being able to redefine the skip and include directives without raising an error, we should probably just ignore any directive definition named skip or include and rely on the added by default definitions provided by the GraphQL library implementation. I'm on the fence as to add validation to check if a provided skip/include definition is semantically equivalent to the ones defined by the server. Since these are guaranteed to be provided by the GraphQL server implementation, I don't feel this is really needed and it will likely be an artifact of a tool having printed them in the SDL. Changes The fix consists of skipping any directive defined in the sdl with the name skip/include with the expectation graphql-java will use its own. Testing The following test fails and show that redefining the skip/include directive leads to multiple definitions added to the GraphQLSchema instance. def "skip and include should be added to the schema only if not already defined"() { def sdl = ''' "Directs the executor to skip this field or fragment when the `if`'argument is true." directive @skip( "Skipped when true." if: Boolean! ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT "Directs the executor to include this field or fragment only when the `if` argument is true" directive @include( "Included when true." if: Boolean! ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT type Query { hello: String } ''' when: def schema = TestUtil.schema(sdl) then: schema.getDirectives().findAll { it.name == "skip" }.size() == 1 schema.getDirectives().findAll { it.name == "include" }.size() == 1 and: def newSchema = GraphQLSchema.newSchema(schema).build() then: newSchema.getDirectives().findAll { it.name == "skip" }.size() == 1 newSchema.getDirectives().findAll { it.name == "include" }.size() == 1 }

Open Graph Description: Description When @skip/@include is defined in a SDL, schema generation will create a GraphQLSchema with multiple skip/include definitions. This can cause problems when a schema is serialized and pa...

X Description: Description When @skip/@include is defined in a SDL, schema generation will create a GraphQLSchema with multiple skip/include definitions. This can cause problems when a schema is serialized and pa...

Opengraph URL: https://github.com/graphql-java/graphql-java/pull/2940

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:2cbaa915-7ab1-1be8-6201-9bf4a64e488a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDB06:3EDED5:1238B6:17CB1F:6A60218C
html-safe-nonce5788416aff5e935fb87daa123f1ebedc7aed468424c836b0fa58578855134a97
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjA2OjNFREVENToxMjM4QjY6MTdDQjFGOjZBNjAyMThDIiwidmlzaXRvcl9pZCI6IjYxNTc1NTMwNTY4MjI5MjYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacfb0db26ad54002a1283c58e947b66657b3acd9cce8b7521ac72190f2ccea6d2f
hovercard-subject-tagpull_request:1044397290
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/graphql-java/graphql-java/pull/2940/files
twitter:imagehttps://avatars.githubusercontent.com/u/1523863?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1523863?s=400&v=4
og:image:altDescription When @skip/@include is defined in a SDL, schema generation will create a GraphQLSchema with multiple skip/include definitions. This can cause problems when a schema is serialized and pa...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7e86a727ba4abf81d0638c5ead57286c17d3b2706f57813445c4316d8e848673
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef13d8ac548fb76838b3d703c7fe2100887547d0e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/graphql-java/graphql-java/pull/2940/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fpull%2F2940%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fpull%2F2940%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=graphql-java%2Fgraphql-java
Reloadhttps://github.com/graphql-java/graphql-java/pull/2940/files
Reloadhttps://github.com/graphql-java/graphql-java/pull/2940/files
Reloadhttps://github.com/graphql-java/graphql-java/pull/2940/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
graphql-java https://github.com/graphql-java
graphql-javahttps://github.com/graphql-java/graphql-java
Notifications https://github.com/login?return_to=%2Fgraphql-java%2Fgraphql-java
Fork 1.1k https://github.com/login?return_to=%2Fgraphql-java%2Fgraphql-java
Star 6.2k https://github.com/login?return_to=%2Fgraphql-java%2Fgraphql-java
Code https://github.com/graphql-java/graphql-java
Issues 26 https://github.com/graphql-java/graphql-java/issues
Pull requests 11 https://github.com/graphql-java/graphql-java/pulls
Discussions https://github.com/graphql-java/graphql-java/discussions
Actions https://github.com/graphql-java/graphql-java/actions
Projects https://github.com/graphql-java/graphql-java/projects
Wiki https://github.com/graphql-java/graphql-java/wiki
Security and quality 0 https://github.com/graphql-java/graphql-java/security
Insights https://github.com/graphql-java/graphql-java/pulse
Code https://github.com/graphql-java/graphql-java
Issues https://github.com/graphql-java/graphql-java/issues
Pull requests https://github.com/graphql-java/graphql-java/pulls
Discussions https://github.com/graphql-java/graphql-java/discussions
Actions https://github.com/graphql-java/graphql-java/actions
Projects https://github.com/graphql-java/graphql-java/projects
Wiki https://github.com/graphql-java/graphql-java/wiki
Security and quality https://github.com/graphql-java/graphql-java/security
Insights https://github.com/graphql-java/graphql-java/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fgraphql-java%2Fgraphql-java%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgraphql-java%2Fgraphql-java%2Fissues%2Fnew%2Fchoose
bbakermanhttps://github.com/bbakerman
graphql-java:masterhttps://github.com/graphql-java/graphql-java/tree/master
tinnou:skip-include-parsehttps://github.com/tinnou/graphql-java/tree/skip-include-parse
Conversation 5 https://github.com/graphql-java/graphql-java/pull/2940
Commits 1 https://github.com/graphql-java/graphql-java/pull/2940/commits
Checks 0 https://github.com/graphql-java/graphql-java/pull/2940/checks
Files changed https://github.com/graphql-java/graphql-java/pull/2940/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
Fix @skip definition is added twice to the GraphQLSchema when defined in sdl https://github.com/graphql-java/graphql-java/pull/2940/files#top
Show all changes 1 commit https://github.com/graphql-java/graphql-java/pull/2940/files
7a245cd Fix bug where parsing a sdl with @skip definition would result in 2 d… tinnou Sep 2, 2022 https://github.com/graphql-java/graphql-java/pull/2940/commits/7a245cd2a038aa3e1b293f38ae4fa4f0d1b12a3c
Clear filters https://github.com/graphql-java/graphql-java/pull/2940/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
SchemaGeneratorHelper.java https://github.com/graphql-java/graphql-java/pull/2940/files#diff-788fe4e4623d9e9a8fc61d20d38ca74f5b19a17e9598bff0e25190ab195a8223
SchemaGeneratorTest.groovy https://github.com/graphql-java/graphql-java/pull/2940/files#diff-2936f6e762b5a3f1aa5570476494746c8b8125e8f8a48bc6567fdc746a87b65a
src/main/java/graphql/schema/idl/SchemaGeneratorHelper.javahttps://github.com/graphql-java/graphql-java/pull/2940/files#diff-788fe4e4623d9e9a8fc61d20d38ca74f5b19a17e9598bff0e25190ab195a8223
View file https://github.com/tinnou/graphql-java/blob/7a245cd2a038aa3e1b293f38ae4fa4f0d1b12a3c/src/main/java/graphql/schema/idl/SchemaGeneratorHelper.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/2940/{{ revealButtonHref }}
https://github.com/graphql-java/graphql-java/pull/2940/files#diff-788fe4e4623d9e9a8fc61d20d38ca74f5b19a17e9598bff0e25190ab195a8223
https://github.com/graphql-java/graphql-java/pull/2940/files#diff-788fe4e4623d9e9a8fc61d20d38ca74f5b19a17e9598bff0e25190ab195a8223
https://github.com/graphql-java/graphql-java/pull/2940/files#diff-788fe4e4623d9e9a8fc61d20d38ca74f5b19a17e9598bff0e25190ab195a8223
bbakermanhttps://github.com/bbakerman
Sep 2, 2022https://github.com/graphql-java/graphql-java/pull/2940/files#r961224597
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@deprecatedhttps://github.com/deprecated
@includehttps://github.com/include
@Skiphttps://github.com/Skip
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
bbakermanhttps://github.com/bbakerman
Sep 2, 2022https://github.com/graphql-java/graphql-java/pull/2940/files#r961251881
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
tinnouhttps://github.com/tinnou
Sep 5, 2022https://github.com/graphql-java/graphql-java/pull/2940/files#r963133748
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
only add them if not presenthttps://github.com/tinnou/graphql-java/blob/93d7f5df0db26f4e55506a97d69c7ce537e8638e/src/main/java/graphql/schema/idl/SchemaGenerator.java#L78
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
bbakermanhttps://github.com/bbakerman
Sep 6, 2022https://github.com/graphql-java/graphql-java/pull/2940/files#r964244444
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/graphql-java/graphql-java/pull/2940/files
https://github.com/graphql-java/graphql-java/pull/2940/files#diff-788fe4e4623d9e9a8fc61d20d38ca74f5b19a17e9598bff0e25190ab195a8223
src/test/groovy/graphql/schema/idl/SchemaGeneratorTest.groovyhttps://github.com/graphql-java/graphql-java/pull/2940/files#diff-2936f6e762b5a3f1aa5570476494746c8b8125e8f8a48bc6567fdc746a87b65a
View file https://github.com/tinnou/graphql-java/blob/7a245cd2a038aa3e1b293f38ae4fa4f0d1b12a3c/src/test/groovy/graphql/schema/idl/SchemaGeneratorTest.groovy
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/graphql-java/graphql-java/pull/2940/{{ revealButtonHref }}
https://github.com/graphql-java/graphql-java/pull/2940/files#diff-2936f6e762b5a3f1aa5570476494746c8b8125e8f8a48bc6567fdc746a87b65a
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.