mirumee/ariadne

[federation] support new @composeDirective

オープン

#1,031 opened on 2023/02/17

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)Python (195 件のフォーク)batch import
help wanted

Repository metrics

Stars
 (2,342 個のスター)
PR merge metrics
 (平均マージ 12d) (30d で 3 merged PRs)

説明

Apollo Federation v2.1 introduced new @composeDirective directive that allows users to specify directives that should be preserved in the supergraph composition (by default composition strips out most directives from supergraph).

extend schema
  @link(
    url: "https://specs.apollo.dev/federation/v2.3",
    import: ["@composeDirective", "@extends", "@external", "@key", "@inaccessible", "@interfaceObject", "@override", "@provides", "@requires", "@shareable", "@tag"]
  )
  @link(url: "https://myspecs.dev/myCustomDirective/v1.0", import: ["@custom"])
  @composeDirective(name: "@custom")

// will be present in the supergraph definition
directive @custom on OBJECT

type Product @custom @key(fields: "id")
  id: ID!
  // other fields omitted for clarity
}

Additional resources:


New directive functionality can be tested using Apollo Federation Subgraph Compatibility NPX script (and Github Action). Example integration project is already provided in the subgraph compatibility testing repository.

コントリビューターガイド