Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/empty-shirts-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"apollo-federation-integration-testsuite": minor
"@apollo/query-planner": minor
"@apollo/query-graphs": minor
"@apollo/composition": minor
"@apollo/federation-internals": minor
"@apollo/subgraph": minor
"@apollo/gateway": minor
---

Federation 2.12 and Connect 0.3
10 changes: 0 additions & 10 deletions .changeset/five-suits-drum.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/four-panthers-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@apollo/composition": patch
"@apollo/federation-internals": patch
---

Adding new CompositionOption `maxValidationSubgraphPaths`. This value represents the maximum number of SubgraphPathInfo objects that may exist in a ValidationTraversal when checking for satisfiability. Setting this value can help composition error before running out of memory. Default is 1,000,000.
16 changes: 8 additions & 8 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"mode": "exit",
"mode": "pre",
"tag": "preview",
"initialVersions": {
"@apollo/composition": "2.10.0",
"apollo-federation-integration-testsuite": "2.10.0",
"@apollo/gateway": "2.10.0",
"@apollo/federation-internals": "2.10.0",
"@apollo/query-graphs": "2.10.0",
"@apollo/query-planner": "2.10.0",
"@apollo/subgraph": "2.10.0"
"@apollo/composition": "2.11.0",
"apollo-federation-integration-testsuite": "2.11.0",
"@apollo/gateway": "2.11.0",
"@apollo/federation-internals": "2.11.0",
"@apollo/query-graphs": "2.11.0",
"@apollo/query-planner": "2.11.0",
"@apollo/subgraph": "2.11.0"
},
"changesets": [
"afraid-queens-drive",
Expand Down
14 changes: 14 additions & 0 deletions composition-js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# CHANGELOG for `@apollo/composition`

## 2.11.0

### Minor Changes

- Adds connect spec v0.2, available for use with Apollo Router 2.3.0 or greater. ([#3262](https://github.com/apollographql/federation/pull/3262))

### Patch Changes

- Allow merging external types when using arrays as default arguments. ([#3262](https://github.com/apollographql/federation/pull/3262))

- Updated dependencies [[`1462c91879d41884c0a7e60551d8dd0d67c832d3`](https://github.com/apollographql/federation/commit/1462c91879d41884c0a7e60551d8dd0d67c832d3), [`9614b26e5a17cbf1f6aaf08f6fcb1c95eb12592d`](https://github.com/apollographql/federation/commit/9614b26e5a17cbf1f6aaf08f6fcb1c95eb12592d)]:
- @apollo/query-graphs@2.11.0
- @apollo/federation-internals@2.11.0

## 2.11.0-preview.2

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions composition-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apollo/composition",
"version": "2.11.0-preview.2",
"version": "2.11.0",
"description": "Apollo Federation composition utilities",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -27,10 +27,10 @@
"access": "public"
},
"dependencies": {
"@apollo/federation-internals": "2.11.0-preview.2",
"@apollo/query-graphs": "2.11.0-preview.2"
"@apollo/federation-internals": "2.11.0",
"@apollo/query-graphs": "2.11.0"
},
"peerDependencies": {
"graphql": "^16.5.0"
}
}
}
191 changes: 186 additions & 5 deletions composition-js/src/__tests__/connectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("connect spec and join__directive", () => {
"schema
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
@link(url: \\"https://specs.apollo.dev/join/v0.5\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.2\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.3\\", for: EXECUTION)
@join__directive(graphs: [WITH_CONNECTORS], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
{
Expand Down Expand Up @@ -157,7 +157,7 @@ describe("connect spec and join__directive", () => {
"schema
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
@link(url: \\"https://specs.apollo.dev/join/v0.5\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.2\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.3\\", for: EXECUTION)
@join__directive(graphs: [WITH_CONNECTORS], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", import: [\\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
{
Expand Down Expand Up @@ -276,7 +276,7 @@ describe("connect spec and join__directive", () => {
"schema
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
@link(url: \\"https://specs.apollo.dev/join/v0.5\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.2\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.3\\", for: EXECUTION)
@join__directive(graphs: [WITH_CONNECTORS], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", as: \\"http\\", import: [\\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
{
Expand Down Expand Up @@ -438,7 +438,7 @@ describe("connect spec and join__directive", () => {
"schema
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
@link(url: \\"https://specs.apollo.dev/join/v0.5\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.2\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.3\\", for: EXECUTION)
@join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS_V0_2_], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.2\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
Expand Down Expand Up @@ -539,6 +539,187 @@ describe("connect spec and join__directive", () => {
}
});

it("composes v0.3", () => {
const subgraphs = [
{
name: "with-connectors-v0_3",
typeDefs: parse(`
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.12"
import: ["@key"]
)
@link(
url: "https://specs.apollo.dev/connect/v0.3"
import: ["@connect", "@source"]
)
@source(
name: "v1"
http: {
baseURL: "http://v1"
path: ""
queryParams: ""
}
errors: { message: "" extensions: "" }
)

type Query {
resources: [Resource!]!
@connect(source: "v1", http: { GET: "/resources" }, selection: "")
}

type Resource @key(fields: "id")
@connect(
source: "v1"
http: {
GET: "/resources"
path: ""
queryParams: ""
}
batch: { maxSize: 5 }
errors: { message: "" extensions: "" }
selection: ""
) {
id: ID!
name: String!
}
`),
},
{
name: "with-connectors-v0_1",
typeDefs: parse(`
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.10"
import: ["@key"]
)
@link(
url: "https://specs.apollo.dev/connect/v0.1"
import: ["@connect", "@source"]
)
@source(name: "v1", http: { baseURL: "http://v1" })

type Query {
widgets: [Widget!]!
@connect(source: "v1", http: { GET: "/widgets" }, selection: "")
}

type Widget @key(fields: "id") {
id: ID!
name: String!
}
`),
},
];

const result = composeServices(subgraphs);
expect(result.errors ?? []).toEqual([]);
const printed = printSchema(result.schema!);
expect(printed).toMatchInlineSnapshot(`
"schema
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
@link(url: \\"https://specs.apollo.dev/join/v0.5\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.3\\", for: EXECUTION)
@join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.3\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\", path: \\"\\", queryParams: \\"\\"}, errors: {message: \\"\\", extensions: \\"\\"}})
{
query: Query
}

directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true, isInterfaceObject: Boolean! = false) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean, overrideLabel: String, contextArguments: [join__ContextArgument!]) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE

directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION

directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE

directive @join__directive(graphs: [join__Graph!], name: String!, args: join__DirectiveArguments) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION

enum link__Purpose {
\\"\\"\\"
\`SECURITY\` features provide metadata necessary to securely resolve fields.
\\"\\"\\"
SECURITY

\\"\\"\\"
\`EXECUTION\` features provide metadata necessary for operation execution.
\\"\\"\\"
EXECUTION
}

scalar link__Import

enum join__Graph {
WITH_CONNECTORS_V0_1_ @join__graph(name: \\"with-connectors-v0_1\\", url: \\"\\")
WITH_CONNECTORS_V0_3_ @join__graph(name: \\"with-connectors-v0_3\\", url: \\"\\")
}

scalar join__FieldSet

scalar join__DirectiveArguments

scalar join__FieldValue

input join__ContextArgument {
name: String!
type: String!
context: String!
selection: join__FieldValue!
}

type Query
@join__type(graph: WITH_CONNECTORS_V0_1_)
@join__type(graph: WITH_CONNECTORS_V0_3_)
{
widgets: [Widget!]! @join__field(graph: WITH_CONNECTORS_V0_1_) @join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"connect\\", args: {source: \\"v1\\", http: {GET: \\"/widgets\\"}, selection: \\"\\"})
resources: [Resource!]! @join__field(graph: WITH_CONNECTORS_V0_3_) @join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"connect\\", args: {source: \\"v1\\", http: {GET: \\"/resources\\"}, selection: \\"\\"})
}

type Widget
@join__type(graph: WITH_CONNECTORS_V0_1_, key: \\"id\\")
{
id: ID!
name: String!
}

type Resource
@join__type(graph: WITH_CONNECTORS_V0_3_, key: \\"id\\")
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"connect\\", args: {source: \\"v1\\", http: {GET: \\"/resources\\", path: \\"\\", queryParams: \\"\\"}, batch: {maxSize: 5}, errors: {message: \\"\\", extensions: \\"\\"}, selection: \\"\\"})
{
id: ID!
name: String!
}"
`);

if (result.schema) {
expect(printSchema(result.schema.toAPISchema())).toMatchInlineSnapshot(`
"type Query {
widgets: [Widget!]!
resources: [Resource!]!
}

type Widget {
id: ID!
name: String!
}

type Resource {
id: ID!
name: String!
}"
`);
}
});

it("composes with renames", () => {
const subgraphs = [
{
Expand Down Expand Up @@ -579,7 +760,7 @@ describe("connect spec and join__directive", () => {
"schema
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
@link(url: \\"https://specs.apollo.dev/join/v0.5\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.2\\", for: EXECUTION)
@link(url: \\"https://specs.apollo.dev/connect/v0.3\\", for: EXECUTION)
@join__directive(graphs: [WITH_CONNECTORS], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", as: \\"http\\", import: [{name: \\"@connect\\", as: \\"@http\\"}, {name: \\"@source\\", as: \\"@api\\"}]})
@join__directive(graphs: [WITH_CONNECTORS], name: \\"api\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
{
Expand Down
Loading