|
| 1 | +schema |
| 2 | + @link(url: "https://specs.apollo.dev/link/v1.0") |
| 3 | + @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) |
| 4 | + @link(url: "https://specs.apollo.dev/policy/v0.1", for: SECURITY) |
| 5 | +{ |
| 6 | + query: Query |
| 7 | +} |
| 8 | + |
| 9 | +directive @join__graph(name: String!, url: String!) on ENUM_VALUE |
| 10 | +directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA |
| 11 | +directive @join__field(graph: join__Graph!, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION |
| 12 | +directive @join__type(graph: join__Graph!, key: join__FieldSet) repeatable on OBJECT | INTERFACE |
| 13 | +directive @join__owner(graph: join__Graph!) on OBJECT | INTERFACE |
| 14 | +directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE |
| 15 | +directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION |
| 16 | +directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE |
| 17 | +directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION |
| 18 | +directive @inaccessible on OBJECT | FIELD_DEFINITION | INTERFACE | UNION |
| 19 | + |
| 20 | +directive @policy(policies: [[String]]) on OBJECT | FIELD_DEFINITION | INTERFACE | SCALAR | ENUM |
| 21 | + |
| 22 | +enum join__Graph { |
| 23 | + SUBGRAPH_A @join__graph(name: "subgraph_a", url: "http://localhost:4001/") |
| 24 | +} |
| 25 | + |
| 26 | +enum link__Purpose { |
| 27 | + """ |
| 28 | + `SECURITY` features provide metadata necessary to securely resolve fields. |
| 29 | + """ |
| 30 | + SECURITY |
| 31 | + |
| 32 | + """ |
| 33 | + `EXECUTION` features provide metadata necessary for operation execution. |
| 34 | + """ |
| 35 | + EXECUTION |
| 36 | +} |
| 37 | + |
| 38 | +scalar federation__Scope |
| 39 | +scalar join__FieldSet |
| 40 | +scalar link__Import |
| 41 | + |
| 42 | +type Query |
| 43 | + @join__type(graph: SUBGRAPH_A) |
| 44 | +{ |
| 45 | + private: Private @join__field(graph: SUBGRAPH_A) @policy(policies: [["admin"]]) |
| 46 | + public: Public @join__field(graph: SUBGRAPH_A) |
| 47 | + opensecret: OpenSecret @join__field(graph: SUBGRAPH_A) |
| 48 | +} |
| 49 | + |
| 50 | +interface Secure |
| 51 | + @join__type(graph: SUBGRAPH_A) |
| 52 | +{ |
| 53 | + id: ID @join__field(graph: SUBGRAPH_A) @policy(policies: [["admin"]]) |
| 54 | +} |
| 55 | + |
| 56 | + |
| 57 | +type Private implements Secure |
| 58 | + @join__type(graph: SUBGRAPH_A) |
| 59 | + @join__implements(graph: SUBGRAPH_A, interface: "Secure") |
| 60 | +{ |
| 61 | + id: ID @policy(policies: [["admin"]]) @join__field(graph: SUBGRAPH_A) |
| 62 | +} |
| 63 | + |
| 64 | +# NOTE: despite its name, this _doesn't_ have the `admin` policy |
| 65 | +type OpenSecret implements Secure |
| 66 | + @join__type(graph: SUBGRAPH_A) |
| 67 | + @join__implements(graph: SUBGRAPH_A, interface: "Secure") |
| 68 | +{ |
| 69 | + id: ID @join__field(graph: SUBGRAPH_A) |
| 70 | +} |
| 71 | + |
| 72 | +type Public |
| 73 | + @join__type(graph: SUBGRAPH_A) |
| 74 | +{ |
| 75 | + id: ID @join__field(graph: SUBGRAPH_A) |
| 76 | +} |
| 77 | + |
0 commit comments