Skip to content

Conversation

@ardatan
Copy link
Owner

@ardatan ardatan commented Oct 14, 2025

Add introspectionOptions to loadGraphQLHTTPSubgraph with some defaults.
Previously, it was not possible to configure the introspection query options.
By default it was ignoring deprecated input fields and not including descriptions.
Now it includes descriptions and deprecated input fields by default.
And you can still override the defaults by providing your own options.

import { loadGraphQLHTTPSubgraph } from '@graphql-mesh/compose-cli';

loadGraphQLHTTPSubgraph('my-subgraph', {
  source: 'http://my-subgraph/graphql',
  introspectionOptions: {
    descriptions: true,
    specifiedByUrl: false,
    directiveIsRepeatable: false,
    schemaDescription: false,
    inputValueDeprecation: true,
    oneOf: false, // New in GraphQL 16
  },
});

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added an option to customize GraphQL introspection in the compose CLI for HTTP subgraphs, enabling inclusion of descriptions, specifiedByUrl, directive repeatability, schema descriptions, input value deprecation, and oneOf (GraphQL 16). Defaults now preserve these details.
  • Tests

    • Added end-to-end tests validating composition and execution with deprecated arguments, including snapshot checks.

Walkthrough

Adds an optional introspectionOptions to loadGraphQLHTTPSubgraph, introduces defaults, and threads them into getIntrospectionQuery. Adds an e2e setup: subgraph service exposing a deprecated argument, Mesh compose config, package.json, and tests validating composition and execution via snapshots. Includes a changeset entry.

Changes

Cohort / File(s) Summary
Compose CLI: HTTP subgraph loader
packages/compose-cli/src/loadGraphQLHTTPSubgraph.ts
Adds optional introspectionOptions to GraphQLSubgraphLoaderHTTPConfiguration, exports DEFAULT_INTROSPECTION_OPTIONS, and uses getIntrospectionQuery(introspectionOptions) for introspection. Imports IntrospectionOptions (type).
E2E config and package
e2e/deprecated-merging/mesh.config.ts, e2e/deprecated-merging/package.json
Adds Mesh compose config using loadGraphQLHTTPSubgraph pointing to local subgraph; introduces package.json with required deps for e2e.
E2E service
e2e/deprecated-merging/services/subgraph-a.ts
Adds GraphQL Yoga subgraph exposing Query.rootField(deprecatedArg: Enum @deprecated) returning a type with id; starts server on CLI-provided port.
E2E tests
e2e/deprecated-merging/deprecated-merging.test.ts
Adds end-to-end test composing subgraph, starting server, executing query with deprecated argument, and snapshotting schema and result.
Changeset
.changeset/sparkly-lions-make.md
Documents the new introspectionOptions API and defaults with a usage example.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Dev Script
  participant CLI as Compose CLI
  participant Loader as loadGraphQLHTTPSubgraph
  participant SG as Subgraph Server
  participant GQL as GraphQL Introspection

  Dev->>CLI: defineConfig({ subgraphs: [HTTP subgraph...] })
  CLI->>Loader: loadGraphQLHTTPSubgraph(name, { endpoint, introspectionOptions? })
  note over Loader: Apply DEFAULT_INTROSPECTION_OPTIONS if none provided
  Loader->>GQL: getIntrospectionQuery(introspectionOptions)
  Loader->>SG: POST /graphql (introspection query)
  SG-->>Loader: introspection result (includes descriptions, deprecations, etc.)
  Loader-->>CLI: SDL/metadata from introspection
  CLI-->>Dev: Composed schema/supergraph
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • enisdenjo

Poem

A twitch of whiskers, options hop in sight,
Introspection tuned—fields bathed in gentle light.
Deprecated burrows mapped, descriptions now in view,
OneOfs and notes align, a tidy warren new.
I thump with glee: compose, compose—
The schema garden grows! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly identifies the addition of the introspectionOptions feature within the compose-cli scope and clearly relates to the primary change in the pull request.
Description Check ✅ Passed The description directly explains the addition of introspectionOptions to loadGraphQLHTTPSubgraph, outlines the previous behavior, details the new defaults, and provides a usage example that matches the changes introduced.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch deprecated-input-fields

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0685d1d and 31059ca.

⛔ Files ignored due to path filters (2)
  • e2e/deprecated-merging/__snapshots__/deprecated-merging.test.ts.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • .changeset/sparkly-lions-make.md (1 hunks)
  • e2e/deprecated-merging/deprecated-merging.test.ts (1 hunks)
  • e2e/deprecated-merging/mesh.config.ts (1 hunks)
  • e2e/deprecated-merging/package.json (1 hunks)
  • e2e/deprecated-merging/services/subgraph-a.ts (1 hunks)
  • packages/compose-cli/src/loadGraphQLHTTPSubgraph.ts (5 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
e2e/deprecated-merging/mesh.config.ts (2)
packages/compose-cli/src/types.ts (1)
  • defineConfig (45-47)
packages/compose-cli/src/loadGraphQLHTTPSubgraph.ts (1)
  • loadGraphQLHTTPSubgraph (250-417)
e2e/deprecated-merging/deprecated-merging.test.ts (1)
e2e/utils/tenv.ts (3)
  • compose (303-358)
  • service (359-396)
  • serve (240-302)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: release / snapshot
  • GitHub Check: e2e / node v22
  • GitHub Check: e2e / node v20
  • GitHub Check: apollo-federation-compatibility
  • GitHub Check: e2e / node v18
  • GitHub Check: unit / node 20
  • GitHub Check: integration / node 22
  • GitHub Check: unit / node 22
  • GitHub Check: integration / node 20
  • GitHub Check: unit / node 18
  • GitHub Check: integration / node 18
  • GitHub Check: check
  • GitHub Check: deployment
🔇 Additional comments (15)
e2e/deprecated-merging/package.json (1)

1-9: LGTM!

The package configuration is appropriate for an e2e test. The dependency versions align with stable releases: graphql ^16.9.0 allows the latest stable 16.11.0, and graphql-yoga ^5.13.4 is a stable patch release.

.changeset/sparkly-lions-make.md (1)

1-25: LGTM!

The changeset clearly documents the new feature, correctly categorizes it as a minor version bump, and provides a comprehensive usage example.

packages/compose-cli/src/loadGraphQLHTTPSubgraph.ts (5)

19-19: LGTM!

The import of IntrospectionOptions type is necessary for the new feature and follows the existing import pattern.


102-119: LGTM!

The new introspectionOptions field is well-documented with clear JSDoc that includes the default values. Making it optional ensures backward compatibility.


241-248: LGTM!

The default introspection options are sensible and align with the PR objectives. Setting inputValueDeprecation: true enables introspection of deprecated input fields, which was the primary goal. Exporting the constant allows users to reference or extend the defaults.


265-265: LGTM!

The parameter addition with a default value ensures backward compatibility while exposing the new functionality.


337-337: LGTM!

The introspection query now correctly uses the configurable options. Note that fetchAsFederation() appropriately continues to use its own federationIntrospectionQuery instead.

e2e/deprecated-merging/services/subgraph-a.ts (3)

1-6: LGTM!

The imports and port setup are appropriate for an e2e test service.


10-27: LGTM!

The schema is well-designed to test deprecated argument introspection. The @deprecated directive on deprecatedArg enables validation of the new introspectionOptions feature.


28-39: LGTM!

The resolver implementation is simple and appropriate for e2e testing. It correctly returns data that satisfies the schema contract.

e2e/deprecated-merging/deprecated-merging.test.ts (3)

1-3: LGTM!

The test environment setup follows the standard e2e pattern.


5-11: LGTM!

The composition test appropriately validates the schema output using snapshot testing. The maskServicePorts: true option ensures stable snapshots.


13-31: LGTM!

The execution test comprehensively validates the e2e flow: composition, serving, and query execution with deprecated arguments. The snapshot-based assertion ensures the feature works as expected.

e2e/deprecated-merging/mesh.config.ts (2)

1-4: LGTM!

The imports and setup are appropriate for the mesh configuration.


6-14: LGTM!

The mesh configuration correctly wires the subgraph with a dynamic endpoint. By not passing introspectionOptions, it validates that the new defaults (including inputValueDeprecation: true) work correctly.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

@github-actions
Copy link
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/compose-cli 1.5.0-alpha-20251014113438-31059ca3d9020d53f08d8d81801965899cecbd27 npm ↗︎ unpkg ↗︎
@graphql-mesh/apollo-link 0.106.14-alpha-20251014113438-31059ca3d9020d53f08d8d81801965899cecbd27 npm ↗︎ unpkg ↗︎
@graphql-mesh/migrate-config-cli 1.7.0-alpha-20251014113438-31059ca3d9020d53f08d8d81801965899cecbd27 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

💻 Website Preview

The latest changes are available as preview in: https://6c6337eb.graphql-mesh.pages.dev

@ardatan ardatan merged commit 9ed6940 into master Oct 14, 2025
19 checks passed
@ardatan ardatan deleted the deprecated-input-fields branch October 14, 2025 12:05
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.

2 participants