Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Add @tag documentation #2033

wants to merge 2 commits into from

Conversation

jeffjakub
Copy link
Contributor

@jeffjakub jeffjakub commented Aug 2, 2022

Fixes #1972

@netlify
Copy link

netlify bot commented Aug 2, 2022

Deploy Preview for apollo-federation-docs ready!

Name Link
🔨 Latest commit 4e79903
🔍 Latest deploy log https://app.netlify.com/sites/apollo-federation-docs/deploys/62ebd5b6fd9ea30008e75c88
😎 Deploy Preview https://deploy-preview-2033--apollo-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jeffjakub jeffjakub requested review from benweatherman and StephenBarlow and removed request for StephenBarlow August 2, 2022 21:44
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 2, 2022

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.

Copy link
Contributor

@StephenBarlow StephenBarlow left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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
Copy link
Contributor

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

Suggested change
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")
Copy link
Contributor

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.

Suggested change
cart: [Product!] @tag(name: "team-shopping-cart")

@benweatherman benweatherman linked an issue Aug 4, 2022 that may be closed by this pull request
@benweatherman benweatherman changed the title 1972 - adding @tag documentation. Add @tag documentation Aug 4, 2022
@StephenBarlow
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update federation specs for @tag
3 participants