Transform external composed sdl to public sdl - #8398
Conversation
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-hive/gateway-plugin-console-sdk |
0.1.5-alpha-20260824191446-9fb0c4b4c2a526c5c6a49428d2c0a543c64e499d |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/yoga |
0.49.5-alpha-20260824191446-9fb0c4b4c2a526c5c6a49428d2c0a543c64e499d |
npm ↗︎ unpkg ↗︎ |
hive |
11.12.1-alpha-20260824191446-9fb0c4b4c2a526c5c6a49428d2c0a543c64e499d |
npm ↗︎ unpkg ↗︎ |
|
🐋 This PR was built and pushed to the following Docker images: Targets: Platforms: Image Tags: |
| * This is done for us in the native composition library | ||
| * https://github.com/graphql-hive/federation-composition/blob/77d6b4ece2abacf94164beafb4e7f5961f726755/src/compose.ts#L228 | ||
| */ | ||
| return print(transformSupergraphToPublicSchema(parse(sdl))); |
There was a problem hiding this comment.
shouldn't we run transformSupergraphToPublicSchema on the supergraph instead of the sdl?
I also flagged this internally - this restores previous behaviour - which is to not take the public sdl as it is provided by the external composition. I am not sure if we should do that. 🤔 I would argue it is the responsibility of user that uses the external composition to return the proper public schema sdl
There was a problem hiding this comment.
Is in the specific scenario the apollo composition returning an invalid public sdl schema that still contains supergraph specific SDL or is it a custom customer endpoint that is sending wrong stuff for the public sdl?
There was a problem hiding this comment.
The later. This is a custom external composition implementation that isnt converting the public sdl into a an API Schema
n1ru4l
left a comment
There was a problem hiding this comment.
The public sdl should be generated from the supergraph not the public sdl passed from the external composition: https://github.com/graphql-hive/console/pull/8398/changes#r3842626702 as seen in https://github.com/graphql-hive/console/pull/8319/changes#diff-f912a95c08d02dee17df2da852f56f215ec961506f1d50eb792971fc09cb5b5aL247
746052b to
9fb0c4b
Compare
Background
An issue was reported where suddenly a team's public SDL included federated directives
Description
I was able to identify the cause as this change: https://github.com/graphql-hive/console/pull/8319/changes#diff-f912a95c08d02dee17df2da852f56f215ec961506f1d50eb792971fc09cb5b5aL247
Because the composition library we use automatically make this calls, it was mistakenly assumed that the external composer would also call this. Since this composer is external by definition, I dont think it's safe to make that assumption.
Long term, we should remove this extra transform from all composition logic. Before doing this, we must ensure all existing systems are compatible or we have a plan to migrate.
For now, I've added back the transform based on an environment variable. This will transform the external supergraph SDL result to match the previous behavior.
Checklist