-
Notifications
You must be signed in to change notification settings - Fork 9
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
Adds federation error code coerage docs #61
base: main
Are you sure you want to change the base?
Adds federation error code coerage docs #61
Conversation
| 🔴 | INVALID_LINK_IDENTIFIER | A URL/version for a @link feature is invalid/does not respect the specification. | | ||
| 🔴 | INVALID_SUBGRAPH_NAME | A subgraph name is invalid. (Subgraph names cannot be a single underscore (\*)). | | ||
| 🔴 | LINK_IMPORT_NAME_MISMATCH | The import name for a merged directive (as declared by the relevant @link(import:) argument) is inconsistent between subgraphs. | | ||
| 🔴 | REQUIRES_FIELDS_MISSING_EXTERNAL | The fields argument of a @requires directive includes a field that is not marked as @external. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@requires"]
)
type Query {
users: [User]
}
type User @key(fields: "id") {
id: ID!
internalId: ID!
profile: Profile @requires(fields: "internalId")
}
type Profile {
name: String
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[users] On field "User.profile", for @requires(fields: "internalId"): field "User.internalId" should not be part of a @requires since it is already provided by this subgraph (it is not marked @external)
| 🔴 | INVALID_SUBGRAPH_NAME | A subgraph name is invalid. (Subgraph names cannot be a single underscore (\*)). | | ||
| 🔴 | LINK_IMPORT_NAME_MISMATCH | The import name for a merged directive (as declared by the relevant @link(import:) argument) is inconsistent between subgraphs. | | ||
| 🔴 | REQUIRES_FIELDS_MISSING_EXTERNAL | The fields argument of a @requires directive includes a field that is not marked as @external. | | ||
| 🔴 | REQUIRES_UNSUPPORTED_ON_INTERFACE | A @requires directive is used on an interface, which is not (yet) supported. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@requires"]
)
type Query {
users: [User]
}
type RegisteredUser implements User @key(fields: "id") {
id: ID!
name: String!
email: String
}
interface User @key(fields: "id") {
id: ID!
name: String!
email: String @requires(fields: "name")
}
[users] Cannot use @requires on field "User.email" of parent type "User": @requires is not yet supported within interfaces
| Status | Error | Description | | ||
| ------ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------ | | ||
| ❓ | EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE | The @external directive collides with other directives in some situations. | | ||
| ❓ | INTERFACE_OBJECT_USAGE_ERROR | Error in the usage of the @interfaceObject directive. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# subgraph book
extend schema @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key"])
interface Media @key(fields: "id") {
id: ID!
title: String!
}
type Book implements Media @key(fields: "id") {
id: ID!
title: String!
}
# subgraph review
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@interfaceObject"]
)
type Media @interfaceObject {
id: ID!
reviews: [Review!]!
}
type Review {
score: Int!
}
type Query {
topRatedMedia: [Media!]!
}
The @interfaceObject directive can only be applied to entity types but type "Media" has no @key in this subgraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or
# subgraph a
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@interfaceObject"]
)
type Query {
hello: String
}
# subgraph b
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@interfaceObject"]
)
type Query {
otherField: String
}
type MyInterface @key(fields: "id") @interfaceObject {
id: ID!
newField: String
}
```
Type "MyInterface" is declared with @interfaceObject in all the subgraphs in which is is defined (it is defined in subgraph "b" but should be defined as an interface in at least one subgraph)
| ❓ | EXTERNAL_COLLISION_WITH_ANOTHER_DIRECTIVE | The @external directive collides with other directives in some situations. | | ||
| ❓ | INTERFACE_OBJECT_USAGE_ERROR | Error in the usage of the @interfaceObject directive. | | ||
| ❓ | INVALID_FEDERATION_SUPERGRAPH | Indicates that a schema provided for an Apollo Federation supergraph is not a valid supergraph schema. | | ||
| ❓ | KEY_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @key directive is not a string. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend schema @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key"])
type Query {
users: [User!]!
}
type User @key(fields: true) {
id: ID
}
[users] On type "User", for @key(fields: true): Invalid value for argument "fields": must be a string.
| ❓ | INTERFACE_OBJECT_USAGE_ERROR | Error in the usage of the @interfaceObject directive. | | ||
| ❓ | INVALID_FEDERATION_SUPERGRAPH | Indicates that a schema provided for an Apollo Federation supergraph is not a valid supergraph schema. | | ||
| ❓ | KEY_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @key directive is not a string. | | ||
| ❓ | MERGED_DIRECTIVE_APPLICATION_ON_EXTERNAL | In a subgraph, a field is both marked @external and has a merged directive applied to it. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few examples, I can provide them if needed, but those are relevant errors messages:
[users] Cannot apply merged directive @inaccessible to external field "User.internalId"
[users] Cannot apply merged directive @tag(name: "public") to external field "User.internalId"
| ❓ | INVALID_FEDERATION_SUPERGRAPH | Indicates that a schema provided for an Apollo Federation supergraph is not a valid supergraph schema. | | ||
| ❓ | KEY_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @key directive is not a string. | | ||
| ❓ | MERGED_DIRECTIVE_APPLICATION_ON_EXTERNAL | In a subgraph, a field is both marked @external and has a merged directive applied to it. | | ||
| ❓ | PROVIDES_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @provides directive is not a string. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@provides"]
)
type Payment @key(fields: "id") {
id: ID!
amount: Int!
}
type Invoice @key(fields: "id") {
id: ID!
amount: Int!
payment: Payment @provides(fields: true)
}
[billing] On field "Invoice.payment", for @provides(fields: true): Invalid value for argument "fields": must be a string.
| ❓ | KEY_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @key directive is not a string. | | ||
| ❓ | MERGED_DIRECTIVE_APPLICATION_ON_EXTERNAL | In a subgraph, a field is both marked @external and has a merged directive applied to it. | | ||
| ❓ | PROVIDES_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @provides directive is not a string. | | ||
| ❓ | PROVIDES_ON_NON_OBJECT_FIELD | A @provides directive is used to mark a field whose base type is not an object type. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3"
import: ["@key", "@provides"]
)
type Query {
users: [User]
}
type RegisteredUser implements User @key(fields: "id") {
id: ID!
name: String!
email: String
}
interface User @key(fields: "id") {
id: ID!
name: String!
email: String @provides(fields: "name")
}
[users] Invalid @provides directive on field "User.email": field has type "String" which is not a Composite Type
| ❓ | MERGED_DIRECTIVE_APPLICATION_ON_EXTERNAL | In a subgraph, a field is both marked @external and has a merged directive applied to it. | | ||
| ❓ | PROVIDES_INVALID_FIELDS_TYPE | The value passed to the fields argument of a @provides directive is not a string. | | ||
| ❓ | PROVIDES_ON_NON_OBJECT_FIELD | A @provides directive is used to mark a field whose base type is not an object type. | | ||
| ❓ | PROVIDES_UNSUPPORTED_ON_INTERFACE | A @provides directive is used on an interface, which is not (yet) supported. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.1"
import: ["@key", "@provides"]
)
type Query {
users: [User]
}
type RegisteredUser implements User @key(fields: "id") {
id: ID!
name: String!
profile: Profile
}
interface User @key(fields: "id") {
id: ID!
name: String!
profile: Profile @provides(fields: "name")
}
type Profile {
name: String
}
[users] Cannot use @provides on field "User.profile" of parent type "User": @provides is not yet supported within interfaces
I can provide more examples and cover more rules, just say so :) |
No description provided.