Skip to content

Commit 94b7af2

Browse files
committed
Merge branch 'main' into pse/fixed-input-field-default-missmatch
2 parents fe994b6 + 005b55d commit 94b7af2

File tree

7 files changed

+2950
-2606
lines changed

7 files changed

+2950
-2606
lines changed

README.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
>
33
> This spec is in the proposal stage of active development, and can change
44
> before reaching `Draft` stage. For more information, please see the
5-
> [Roadmap](ROADMAP.md) or [how to get involved](INTERESTED_DEVELOPERS.md).
5+
> [Roadmap](ROADMAP.md).
66
77
---
88

99
# GraphQL Composite Schema Spec
1010

11-
**Spec Location**
12-
13-
The GraphQL Composite Schemas specification is edited in the
14-
[spec-md markdown file](./spec/Spec.md).
15-
16-
In the future, we plan that you would be able to view the generated form of the
17-
specification as well.
11+
The GraphQL Composite Schema specification is edited in the markdown files found
12+
in [`/spec`](./spec) the latest release of which is published at
13+
https://graphql.github.io/composite-schemas-spec/.
1814

1915
### Contributing to this repo
2016

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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/inaccessible/v0.2", for: SECURITY)
5+
{
6+
query: Query
7+
}
8+
9+
directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
10+
11+
directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE
12+
13+
directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
14+
15+
directive @join__graph(name: String!, url: String!) on ENUM_VALUE
16+
17+
directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE
18+
19+
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
20+
21+
directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION
22+
23+
directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA
24+
25+
interface Bar implements Foo
26+
@join__implements(graph: LOCATIONS, interface: "Foo")
27+
@join__implements(graph: REVIEWS, interface: "Foo")
28+
@join__type(graph: LOCATIONS)
29+
@join__type(graph: REVIEWS)
30+
{
31+
foo: String!
32+
bar: String!
33+
}
34+
35+
type Baz implements Foo & Bar
36+
@join__implements(graph: LOCATIONS, interface: "Foo")
37+
@join__implements(graph: LOCATIONS, interface: "Bar")
38+
@join__implements(graph: REVIEWS, interface: "Foo")
39+
@join__implements(graph: REVIEWS, interface: "Bar")
40+
@join__type(graph: LOCATIONS)
41+
@join__type(graph: REVIEWS)
42+
@inaccessible
43+
{
44+
foo: String!
45+
bar: String!
46+
baz: String!
47+
}
48+
49+
type Entity
50+
@join__type(graph: LOCATIONS, key: "id")
51+
@join__type(graph: REVIEWS, key: "id")
52+
{
53+
id: ID!
54+
data: Foo @join__field(graph: LOCATIONS) @join__field(graph: REVIEWS, external: true)
55+
requirer: String! @join__field(graph: REVIEWS, requires: "data { foo ... on Bar { bar ... on Baz { baz } ... on Qux { qux } } }")
56+
}
57+
58+
interface Foo
59+
@join__type(graph: LOCATIONS)
60+
@join__type(graph: REVIEWS)
61+
{
62+
foo: String!
63+
}
64+
65+
scalar join__FieldSet
66+
67+
enum join__Graph {
68+
LOCATIONS @join__graph(name: "locations", url: "https://flyby-locations-sub.herokuapp.com/")
69+
REVIEWS @join__graph(name: "reviews", url: "https://flyby-reviews-sub.herokuapp.com/")
70+
}
71+
72+
scalar link__Import
73+
74+
enum link__Purpose {
75+
"""
76+
`SECURITY` features provide metadata necessary to securely resolve fields.
77+
"""
78+
SECURITY
79+
80+
"""
81+
`EXECUTION` features provide metadata necessary for operation execution.
82+
"""
83+
EXECUTION
84+
}
85+
86+
type Query
87+
@join__type(graph: LOCATIONS)
88+
@join__type(graph: REVIEWS)
89+
{
90+
dummy: Entity
91+
}
92+
93+
type Qux implements Foo & Bar
94+
@join__implements(graph: LOCATIONS, interface: "Foo")
95+
@join__implements(graph: LOCATIONS, interface: "Bar")
96+
@join__implements(graph: REVIEWS, interface: "Foo")
97+
@join__implements(graph: REVIEWS, interface: "Bar")
98+
@join__type(graph: LOCATIONS)
99+
@join__type(graph: REVIEWS)
100+
{
101+
foo: String!
102+
bar: String!
103+
qux: String!
104+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
extend schema
2+
@link(
3+
url: "https://specs.apollo.dev/federation/v2.5",
4+
import: ["@key", "@shareable"]
5+
)
6+
7+
type Query @shareable {
8+
dummy: Entity
9+
}
10+
11+
type Entity @key(fields: "id") {
12+
id: ID!
13+
data: Foo
14+
}
15+
16+
interface Foo {
17+
foo: String!
18+
}
19+
20+
interface Bar implements Foo {
21+
foo: String!
22+
bar: String!
23+
}
24+
25+
type Baz implements Foo & Bar @shareable {
26+
foo: String!
27+
bar: String!
28+
baz: String!
29+
}
30+
31+
type Qux implements Foo & Bar @shareable {
32+
foo: String!
33+
bar: String!
34+
qux: String!
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
extend schema
2+
@link(
3+
url: "https://specs.apollo.dev/federation/v2.5",
4+
import: ["@key", "@shareable", "@inaccessible", "@external", "@requires"]
5+
)
6+
7+
type Query @shareable {
8+
dummy: Entity
9+
}
10+
11+
type Entity @key(fields: "id") {
12+
id: ID!
13+
data: Foo @external
14+
requirer: String! @requires(fields: "data { foo ... on Bar { bar ... on Baz { baz } ... on Qux { qux } } }")
15+
}
16+
17+
interface Foo {
18+
foo: String!
19+
}
20+
21+
interface Bar implements Foo {
22+
foo: String!
23+
bar: String!
24+
}
25+
26+
type Baz implements Foo & Bar @shareable @inaccessible {
27+
foo: String!
28+
bar: String!
29+
baz: String!
30+
}
31+
32+
type Qux implements Foo & Bar @shareable {
33+
foo: String!
34+
bar: String!
35+
qux: String!
36+
}

spec/Appendix A -- Field Selection.md

+24-9
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,30 @@ mediaById<Book>.isbn
385385

386386
SelectedValue ::
387387

388-
- Path
389-
- SelectedObjectValue
388+
- SelectedValue | SelectedValueEntry
389+
- `|`? SelectedValueEntry
390+
391+
SelectedValueEntry ::
392+
393+
- Path [lookahead != `.`]
390394
- Path . SelectedObjectValue
391-
- SelectedValue | SelectedValue
395+
- Path SelectedListValue
396+
- SelectedObjectValue
397+
398+
A {SelectedValue} consists of one or more {SelectedValueEntry} components, which
399+
may be joined by a pipe (`|`) operator to indicate alternative selections based
400+
on type.
392401

393-
A {SelectedValue} is defined as either a {Path} or a {SelectedObjectValue}
402+
Each {SelectedValueEntry} may take one of the following forms:
394403

395-
A {Path} is designed to point to only a single value, although it may reference
396-
multiple fields depending on the return type. To allow selection from different
397-
paths based on type, a {Path} can include multiple paths separated by a pipe
398-
(`|`).
404+
- A {Path} (when not immediately followed by a dot) that is designed to point to
405+
a single value, although it may reference multiple fields depending on its
406+
return type.
407+
- A {Path} immediately followed by a dot and a {SelectedObjectValue} to denote a
408+
nested object selection.
409+
- A {Path} immediately followed by a {SelectedListValue} to denote selection
410+
from a list.
411+
- A standalone {SelectedObjectValue}
399412

400413
In the following example, the value could be `title` when referring to a `Book`
401414
and `movieTitle` when referring to a `Movie`.
@@ -425,6 +438,7 @@ SelectedObjectValue ::
425438
SelectedObjectField ::
426439

427440
- Name: SelectedValue
441+
- Name
428442

429443
{SelectedObjectValue} are unordered lists of keyed input values wrapped in
430444
curly-braces `{}`. It has to be used when the expected input type is an object
@@ -471,6 +485,7 @@ type Product {
471485
SelectedListValue ::
472486

473487
- [ SelectedValue ]
488+
- [ SelectedListValue ]
474489

475490
A {SelectedListValue} is an ordered list of {SelectedValue} wrapped in square
476491
brackets `[]`. It is used to express semantic equivalence between an argument
@@ -654,7 +669,7 @@ type context.
654669

655670
**Explanatory Text**
656671

657-
The {Path} literal is used to reference a specific output field from a input
672+
The {Path} literal is used to reference a specific output field from an input
658673
field. Each segment in the {Path} must correspond to a field that is valid
659674
within the current type scope.
660675

0 commit comments

Comments
 (0)