Skip to content

Commit 78b9a56

Browse files
authored
docs: improve meta directive docs and product update (#6828)
1 parent d175fba commit 78b9a56

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

packages/web/docs/src/app/product-updates/(posts)/2025-03-08-metadata/page.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,41 +26,41 @@ extend schema @link(url: "https://specs.graphql-hive.com/hive/v1.0", import: ["@
2626

2727
Metadata is useful for a variety of cases:
2828

29-
- Indicating granular ownership e.g. `owner: "console-team"`
30-
- Adding contact information e.g. `contact: "#hive-channel"`
31-
- Defining field importance e.g. `priority: "tier-1"`
32-
- Defining domains e.g. `domain: "users"`
29+
- Indicating granular ownership e.g. `@meta(name: "owner", content: "console-team")`
30+
- Adding contact information e.g. `@meta(name: "contact", content: "#hive-channel")`
31+
- Defining field importance e.g. `@meta(name: "priority", content: "tier-1")`
32+
- Defining domains e.g. `@meta(name: "domain", content: "users")`
3333

3434
... and more.
3535

36-
Currently, metadata can be viewed from Hive’s explorer page and can be used to filter the explorer
37-
view. And we expect there will be even more features built around this metadata in the future as
38-
Hive continues to expand.
39-
40-
A full example schema of using metadata would look like:
36+
Putting it all together, an example schema using Hive's metadata might look like:
4137

4238
```graphql
4339
extend schema
4440
@link(url: "https://specs.apollo.dev/link/v1.0")
4541
@link(url: "https://specs.apollo.dev/federation/v2.3")
4642
@link(url: "https://specs.graphql-hive.com/hive/v1.0", import: ["@meta"])
47-
@meta(name: "owner", content: "users-team")
43+
@meta(name: "owner", content: "[email protected]")
4844

4945
directive @meta(
5046
name: String!
5147
content: String!
5248
) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION
5349

5450
type Query {
55-
me: User @meta(name: "priority", content: "tier-1")
51+
user: User @meta(name: "domain", content: "accounts") @meta(name: "priority", content: "tier-1")
5652
}
5753

5854
type User {
5955
id: ID!
60-
name: String!
56+
ssn: String @meta(name: "classification", content: "pii")
6157
}
6258
```
6359

60+
Currently, metadata can be viewed from Hives explorer page and can be used to filter the explorer
61+
view. And we expect there will be even more features built around this metadata in the future as
62+
Hive continues to expand.
63+
6464
---
6565

6666
[Learn more in the updated documentation](/docs/specs/link-specifications)

packages/web/docs/src/content/specs/link-specifications.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,36 @@ import explorerMetadataFilterImage from '../../../public/docs/pages/specs/link-s
8585

8686
#### Usage
8787

88+
```graphql
89+
extend schema
90+
@link(url: "https://specs.apollo.dev/link/v1.0")
91+
@link(url: "https://specs.apollo.dev/federation/v2.3")
92+
@link(url: "https://specs.graphql-hive.com/hive/v1.0", import: ["@meta"])
93+
@meta(name: "owner", content: "[email protected]")
94+
95+
directive @meta(
96+
name: String!
97+
content: String!
98+
) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION
99+
100+
type Query {
101+
user: User @meta(name: "domain", content: "accounts") @meta(name: "priority", content: "tier-1")
102+
}
103+
104+
type User {
105+
id: ID!
106+
ssn: String @meta(name: "classification", content: "pii")
107+
}
108+
```
109+
88110
`@meta` can be applied to schemas, types, interfaces, and fields. A field's metadata is a union of
89111
all applied metadata. This is applied using the following rules:
90112

91113
1. meta on a schema applies to every field in the schema.
92114
2. meta on a type applies to every field in that exact type.
93115
3. meta on an interface applies to every field in that interface on every implemented type.
94116
4. meta on a field applies only to that field for that type.
117+
5. meta is additive and will not override other applied or repeated directives.
95118

96119
</Tabs.Tab>
97120
</Tabs>

0 commit comments

Comments
 (0)