-
Notifications
You must be signed in to change notification settings - Fork 243
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
Add @tag documentation #2033
Add @tag documentation #2033
Conversation
✅ Deploy Preview for apollo-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
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.
Looks good! Couple suggestions
directive @tag(from: String!) on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
``` | ||
|
||
The `@tag` directive is used to provide a mechanism for applying arbitrary string metadata to the fields and types of a schema. Tags will be propagated up into composed supergraphs. This metadata is potentially useful throughout the schema’s lifecycle, including, but not limited to, processing, static analysis, and documentation. |
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.
The `@tag` directive is used to provide a mechanism for applying arbitrary string metadata to the fields and types of a schema. Tags will be propagated up into composed supergraphs. This metadata is potentially useful throughout the schema’s lifecycle, including, but not limited to, processing, static analysis, and documentation. | |
The `@tag` directive provides a mechanism for applying arbitrary string metadata to a schema's types and fields. This metadata can be useful throughout the schema’s lifecycle, including (but not limited to) processing, static analysis, and documentation. | |
Tags applied in subgraph schemas are preserved in the composed supergraph schema. |
|
||
```graphql | ||
extend schema | ||
@link(url: "https://specs.apollo.dev/federation/v2.0", import: [""@tag"]) |
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.
@link(url: "https://specs.apollo.dev/federation/v2.0", import: [""@tag"]) | |
@link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@tag"]) |
### `@tag` | ||
|
||
```graphql | ||
directive @tag(from: String!) on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION |
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.
blocker This should be marked as repeatable
and the input param is called name
, to align with what's in code / the spec https://specs.apollo.dev/tag/v0.2/#@tag
directive @tag(from: String!) on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | |
directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION |
type Customer implements User @tag(name: "team-customers") { | ||
id: String! | ||
name: String! | ||
cart: [Product!] @tag(name: "team-shopping-cart") |
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.
suggestion type Product
isn't defined in this schema. Just so we can make sure these examples compose, maybe it would be best to remove this field and put a tag on a different field.
cart: [Product!] @tag(name: "team-shopping-cart") |
All directive descriptions have been removed from this doc in favor of the "Federation-specific directives" article, so I'm going to recreate this content targeting that article in a separate PR! |
Fixes #1972