Skip to content

Commit ec1238d

Browse files
authored
docs: @meta product update (#6592)
1 parent c5d7822 commit ec1238d

File tree

1 file changed

+66
-0
lines changed
  • packages/web/docs/src/app/product-updates/(posts)/2025-03-08-metadata

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Subgraph Metadata Features
3+
description:
4+
One of the most convincing reasons to use GraphQL that it's self documenting. The `@meta`
5+
directive takes this a step further by defining a convenient and type safe way to add key-value
6+
metadata to your schema.
7+
date: 2025-03-08
8+
authors: [jdolle]
9+
---
10+
11+
## What’s New?
12+
13+
- **Linkable `@meta` directive** – A federation compatible, `@link`-able schema to add metadata and
14+
enhance functionality of your schema.
15+
16+
## Feature Details
17+
18+
One of the most convincing reasons to use GraphQL that it's self documenting. Hive takes this a step
19+
further by defining a convenient and type safe way to add key-value metadata to your schema. The
20+
`@meta` directive is the first directive we've added to a new Federation 2.x compatible set of Hive
21+
features. To opt-in, add a Federation `link` directive to your schema definition:
22+
23+
```graphql
24+
extend schema @link(url: "https://specs.graphql-hive.com/hive/v1.0", import: ["@meta"])
25+
```
26+
27+
Metadata is useful for a variety of cases:
28+
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"`
33+
34+
... and more.
35+
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:
41+
42+
```graphql
43+
extend schema
44+
@link(url: "https://specs.apollo.dev/link/v1.0")
45+
@link(url: "https://specs.apollo.dev/federation/v2.3")
46+
@link(url: "https://specs.graphql-hive.com/hive/v1.0", import: ["@meta"])
47+
@meta(name: "owner", content: "users-team")
48+
49+
directive @meta(
50+
name: String!
51+
content: String!
52+
) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION
53+
54+
type Query {
55+
me: User @meta(name: "priority", content: "tier-1")
56+
}
57+
58+
type User {
59+
id: ID!
60+
name: String!
61+
}
62+
```
63+
64+
---
65+
66+
[Learn more in the updated documentation](/docs/specs/link-specifications)

0 commit comments

Comments
 (0)