Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tests to include federation v2.3 compatibility #353

Merged
merged 3 commits into from
Feb 14, 2023

Conversation

dariuszkuc
Copy link
Member

Adds tests for @composeDirective (fed v2.1) and @interfaceObject (fed v2.3).

Schema changes:

  • update @link federation spec to v2.3 and add imports for @composeDirective and @interfaceObject
extend schema
  @link(
    url: "https://specs.apollo.dev/federation/v2.3",
    import: [
      "@composeDirective",
      "@extends",
      "@external",
      "@inaccessible",
      "@interfaceObject",
      "@key",
      "@override",
      "@provides",
      "@requires",
      "@shareable",
      "@tag"
    ]
  )
  • apply @link to newly composed directive and @composeDirective on schema object (federation link import omitted for clarity)
extend schema
  @link(url: "https://myspecs.dev/myCustomDirective/v1.0", import: ["@custom")
  @composeDirective(name: "@custom")
  • new @custom directive definition
directive @custom on OBJECT
  • apply @custom directive on Product type (other directives/fields omitted for clarity)
type Product @custom ... { ... }
  • declare new @interfaceObject type
type Inventory @interfaceObject @key(fields: "id") {
  id: ID!
  deprecatedProducts: [DeprecatedProduct!]!
}

expected data set (deprecatedProduct is the existing object)

const inventory = {
  id: "apollo-oss",
  deprecatedProducts: [deprecatedProduct]
}

Resolves:

@@ -21,24 +21,24 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"dependencies": {
"@apollo/rover": "^0.10.0",
"@apollo/rover": "^0.11.1",
"debug": "^4.3.4",
"execa": "^5.1.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: starting with v6 execa is pure ESM module and requires some additional code changes, will tackle it in a separate PR

@dariuszkuc dariuszkuc changed the title update tests to federation v2.3 compatibility update tests to include federation v2.3 compatibility Feb 13, 2023
@apollographql apollographql deleted a comment from github-actions bot Feb 13, 2023
@apollographql apollographql deleted a comment from github-actions bot Feb 13, 2023
@apollographql apollographql deleted a comment from github-actions bot Feb 13, 2023
@github-actions
Copy link
Contributor

Apollo Federation Subgraph Compatibility Results

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

Adds tests for `@composeDirective` (fed v2.1) and `@interfaceObject` (fed v2.3).

Schema changes:
* update `@link` federation spec to v2.3 and add imports for `@composeDirective` and `@interfaceObject`
```graphql
extend schema
  @link(
    url: "https://specs.apollo.dev/federation/v2.3",
    import: [
      "@composeDirective",
      "@extends",
      "@external",
      "@inaccessible",
      "@interfaceObject",
      "@key",
      "@OverRide",
      "@provides",
      "@requires",
      "@Shareable",
      "@tag"
    ]
  )
```

* apply `@link` to newly composed directive and `@composeDirective` on schema object (federation link import omitted for clarity)
```graphql
extend schema
  @link(url: "https://myspecs.dev/myCustomDirective/v1.0", import: ["@Custom")
  @composeDirective(name: "@Custom")
```

* new `@custom` directive definition

```graphql
directive @Custom on OBJECT
```

* apply `@custom` directive on `Product` type (other directives/fields omitted for clarity)

```graphql
type Product @Custom ... { ... }
```

* declare new `@interfaceObject` type

```graphql
type Inventory @interfaceObject @key(fields: "id") {
  id: ID!
  deprecatedProducts: [DeprecatedProduct!]!
}
```

expected data set (deprecatedProduct is the existing object)
```js
const inventory = {
  id: "apollo-oss",
  deprecatedProducts: [deprecatedProduct]
}
```

---
Resolves:
* apollographql#175
* apollographql#344
@github-actions
Copy link
Contributor

Apollo Federation Subgraph Compatibility Results

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

@jeffjakub jeffjakub self-requested a review February 14, 2023 15:17
@dariuszkuc dariuszkuc marked this pull request as ready for review February 14, 2023 15:45
@github-actions
Copy link
Contributor

Apollo Federation Subgraph Compatibility Results

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

@dariuszkuc dariuszkuc merged commit 8f48076 into apollographql:main Feb 14, 2023
@dariuszkuc dariuszkuc deleted the fed2.3 branch February 14, 2023 18:57
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