Skip to content

Commit cd7279c

Browse files
authored
docs: include target option for fetching the schema (#6883)
1 parent 8d56b98 commit cd7279c

File tree

2 files changed

+89
-31
lines changed

2 files changed

+89
-31
lines changed

packages/libraries/cli/README.md

Lines changed: 62 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ create an app deployment
5959
```
6060
USAGE
6161
$ hive app:create FILE --name <value> --version <value> [--debug] [--registry.endpoint <value>]
62-
[--registry.accessToken <value>]
62+
[--registry.accessToken <value>] [--target <value>]
6363
6464
ARGUMENTS
6565
FILE Path to the persisted operations mapping.
@@ -69,46 +69,54 @@ FLAGS
6969
--name=<value> (required) app name
7070
--registry.accessToken=<value> registry access token
7171
--registry.endpoint=<value> registry endpoint
72+
--target=<value> The target in which the app deployment will be created. This can either be a slug
73+
following the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
74+
"the-guild/graphql-hive/staging") or an UUID (e.g.
75+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
7276
--version=<value> (required) app version
7377
7478
DESCRIPTION
7579
create an app deployment
7680
```
7781

7882
_See code:
79-
[dist/commands/app/create.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/app/create.js)_
83+
[src/commands/app/create.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/app/create.ts)_
8084

8185
## `hive app:publish`
8286

8387
publish an app deployment
8488

8589
```
8690
USAGE
87-
$ hive app:publish --name <value> --version <value> [--registry.endpoint <value>] [--registry.accessToken
88-
<value>]
91+
$ hive app:publish --name <value> --version <value> [--debug] [--registry.endpoint <value>]
92+
[--registry.accessToken <value>] [--target <value>]
8993
9094
FLAGS
9195
--debug Whether debug output for HTTP calls and similar should be enabled.
9296
--name=<value> (required) app name
9397
--registry.accessToken=<value> registry access token
9498
--registry.endpoint=<value> registry endpoint
99+
--target=<value> The target in which the app deployment will be published (slug or ID). This can either
100+
be a slug following the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
101+
"the-guild/graphql-hive/staging") or an UUID (e.g.
102+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
95103
--version=<value> (required) app version
96104
97105
DESCRIPTION
98106
publish an app deployment
99107
```
100108

101109
_See code:
102-
[dist/commands/app/publish.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/app/publish.js)_
110+
[src/commands/app/publish.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/app/publish.ts)_
103111

104112
## `hive artifact:fetch`
105113

106114
fetch artifacts from the CDN
107115

108116
```
109117
USAGE
110-
$ hive artifact:fetch --artifact sdl|supergraph|metadata|services|sdl.graphql|sdl.graphqls [--cdn.endpoint
111-
<value>] [--cdn.accessToken <value>] [--outputFile <value>]
118+
$ hive artifact:fetch --artifact sdl|supergraph|metadata|services|sdl.graphql|sdl.graphqls [--debug]
119+
[--cdn.endpoint <value>] [--cdn.accessToken <value>] [--outputFile <value>]
112120
113121
FLAGS
114122
--artifact=<option> (required) artifact to fetch (Note: supergraph is only available for federation projects)
@@ -123,7 +131,7 @@ DESCRIPTION
123131
```
124132

125133
_See code:
126-
[dist/commands/artifact/fetch.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/artifact/fetch.js)_
134+
[src/commands/artifact/fetch.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/artifact/fetch.ts)_
127135

128136
## `hive dev`
129137

@@ -133,7 +141,7 @@ Develop and compose Supergraph with your local services.
133141
USAGE
134142
$ hive dev (--url <address>... --service <string>...) [--debug] [--registry.endpoint <value> --remote]
135143
[--registry <value> ] [--registry.accessToken <value> ] [--token <value> ] [--schema <filepath>... ] [--watch]
136-
[--watchInterval <value>] [--write <value>]
144+
[--watchInterval <value>] [--write <value>] [--target <value>]
137145
138146
FLAGS
139147
--debug Whether debug output for HTTP calls and similar should be enabled.
@@ -143,6 +151,10 @@ FLAGS
143151
--remote Compose provided services remotely
144152
--schema=<filepath>... Service sdl. If not provided, will be introspected from the service
145153
--service=<string>... (required) Service name
154+
--target=<value> The target to use for composition (slug or ID). This can either be a slug following
155+
the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
156+
"the-guild/graphql-hive/staging") or an UUID (e.g.
157+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
146158
--token=<value> api token (deprecated in favor of --registry.accessToken)
147159
--url=<address>... (required) Service url
148160
--watch Watch mode
@@ -162,7 +174,7 @@ DESCRIPTION
162174
```
163175

164176
_See code:
165-
[dist/commands/dev.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/dev.js)_
177+
[src/commands/dev.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/dev.ts)_
166178

167179
## `hive help [COMMAND]`
168180

@@ -206,7 +218,7 @@ DESCRIPTION
206218
```
207219

208220
_See code:
209-
[dist/commands/introspect.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/introspect.js)_
221+
[src/commands/introspect.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/introspect.ts)_
210222

211223
## `hive operations:check FILE`
212224

@@ -216,7 +228,7 @@ checks operations against a published schema
216228
USAGE
217229
$ hive operations:check FILE [--debug] [--registry.endpoint <value>] [--registry <value>] [--registry.accessToken
218230
<value>] [--token <value>] [--require <value>...] [--graphqlTag <value>...] [--globalGraphqlTag <value>...]
219-
[--apolloClient]
231+
[--apolloClient] [--target <value>]
220232
221233
ARGUMENTS
222234
FILE Glob pattern to find the operations
@@ -252,6 +264,11 @@ FLAGS
252264
--require=<value>...
253265
[default: ] Loads specific require.extensions before running the command
254266
267+
--target=<value>
268+
The target to which to check agains (slug or ID). This can either be a slug following the format
269+
"$organizationSlug/$projectSlug/$targetSlug" (e.g "the-guild/graphql-hive/staging") or an UUID (e.g.
270+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
271+
255272
--token=<value>
256273
api token
257274
@@ -260,7 +277,7 @@ DESCRIPTION
260277
```
261278

262279
_See code:
263-
[dist/commands/operations/check.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/operations/check.js)_
280+
[src/commands/operations/check.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/operations/check.ts)_
264281

265282
## `hive schema:check FILE`
266283

@@ -269,8 +286,9 @@ checks schema
269286
```
270287
USAGE
271288
$ hive schema:check FILE [--debug] [--service <value>] [--registry.endpoint <value>] [--registry <value>]
272-
[--registry.accessToken <value>] [--token <value>] [--forceSafe] [--github] [--require <value>...] [--author
273-
<value>] [--commit <value>] [--contextId <value>]
289+
[--registry.accessToken <value>] [--token <value>] [--experimentalJsonFile <value>] [--forceSafe] [--github]
290+
[--require <value>...] [--author <value>] [--commit <value>] [--contextId <value>] [--target <value>] [--url
291+
<value>]
274292
275293
ARGUMENTS
276294
FILE Path to the schema file(s)
@@ -280,6 +298,8 @@ FLAGS
280298
--commit=<value> Associated commit sha
281299
--contextId=<value> Context ID for grouping the schema check.
282300
--debug Whether debug output for HTTP calls and similar should be enabled.
301+
--experimentalJsonFile=<value> File path to output a JSON file containing the command's result. Useful for e.g. CI
302+
scripting with `jq`.
283303
--forceSafe mark the check as safe, breaking changes are expected
284304
--github Connect with GitHub Application
285305
--registry=<value> registry address
@@ -288,14 +308,20 @@ FLAGS
288308
--require=<value>... [default: ] Loads specific require.extensions before running the codegen and reading
289309
the configuration
290310
--service=<value> service name (only for distributed schemas)
311+
--target=<value> The target against which to check the schema (slug or ID). This can either be a slug
312+
following the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
313+
"the-guild/graphql-hive/staging") or an UUID (e.g.
314+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
291315
--token=<value> api token
316+
--url=<value> If checking a service, then you can optionally provide the service URL to see the
317+
difference in the supergraph during the check.
292318
293319
DESCRIPTION
294320
checks schema
295321
```
296322

297323
_See code:
298-
[dist/commands/schema/check.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/schema/check.js)_
324+
[src/commands/schema/check.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/schema/check.ts)_
299325

300326
## `hive schema:delete SERVICE`
301327

@@ -304,7 +330,7 @@ deletes a schema
304330
```
305331
USAGE
306332
$ hive schema:delete SERVICE [--debug] [--registry.endpoint <value>] [--registry <value>] [--registry.accessToken
307-
<value>] [--token <value>] [--dryRun] [--confirm]
333+
<value>] [--token <value>] [--dryRun] [--confirm] [--target <value>]
308334
309335
ARGUMENTS
310336
SERVICE name of the service
@@ -316,24 +342,27 @@ FLAGS
316342
--registry=<value> registry address
317343
--registry.accessToken=<value> registry access token
318344
--registry.endpoint=<value> registry endpoint
345+
--target=<value> The target to which to publish to (slug or ID). This can either be a slug following
346+
the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
347+
"the-guild/graphql-hive/staging") or an UUID (e.g.
348+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
319349
--token=<value> api token
320350
321351
DESCRIPTION
322352
deletes a schema
323353
```
324354

325355
_See code:
326-
[dist/commands/schema/delete.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/schema/delete.js)_
356+
[src/commands/schema/delete.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/schema/delete.ts)_
327357

328358
## `hive schema:fetch [ACTIONID]`
329359

330-
fetch a schema, supergraph, or list of subgraphs from the Hive API. Uses the latest if no ACTIONID
331-
is provided.
360+
fetch a schema, supergraph, or list of subgraphs from the Hive API
332361

333362
```
334363
USAGE
335364
$ hive schema:fetch [ACTIONID] [--debug] [--registry <value>] [--token <value>] [--registry.endpoint <value>]
336-
[--registry.accessToken <value>] [--type <value>] [--write <value>] [--outputFile <value>]
365+
[--registry.accessToken <value>] [--type <value>] [--write <value>] [--outputFile <value>] [--target <value>]
337366
338367
ARGUMENTS
339368
ACTIONID action id (e.g. commit sha)
@@ -344,6 +373,10 @@ FLAGS
344373
--registry=<value> registry address
345374
--registry.accessToken=<value> registry access token
346375
--registry.endpoint=<value> registry endpoint
376+
--target=<value> The target from which to fetch the schema (slug or ID). This can either be a slug
377+
following the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
378+
"the-guild/graphql-hive/staging") or an UUID (e.g.
379+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
347380
--token=<value> api token
348381
--type=<value> Type to fetch (possible types: sdl, supergraph, subgraphs)
349382
--write=<value> Write to a file (possible extensions: .graphql, .gql, .gqls, .graphqls)
@@ -353,7 +386,7 @@ DESCRIPTION
353386
```
354387

355388
_See code:
356-
[dist/commands/schema/fetch.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/schema/fetch.js)_
389+
[src/commands/schema/fetch.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/schema/fetch.ts)_
357390

358391
## `hive schema:publish FILE`
359392

@@ -363,7 +396,7 @@ publishes schema
363396
USAGE
364397
$ hive schema:publish FILE [--debug] [--service <value>] [--url <value>] [--metadata <value>] [--registry.endpoint
365398
<value>] [--registry <value>] [--registry.accessToken <value>] [--token <value>] [--author <value>] [--commit
366-
<value>] [--github] [--force] [--experimental_acceptBreakingChanges] [--require <value>...]
399+
<value>] [--github] [--force] [--experimental_acceptBreakingChanges] [--require <value>...] [--target <value>]
367400
368401
ARGUMENTS
369402
FILE Path to the schema file(s)
@@ -384,6 +417,10 @@ FLAGS
384417
--require=<value>... [default: ] Loads specific require.extensions before running the codegen and
385418
reading the configuration
386419
--service=<value> service name (only for distributed schemas)
420+
--target=<value> The target to which to publish to (slug or ID). This can either be a slug
421+
following the format "$organizationSlug/$projectSlug/$targetSlug" (e.g
422+
"the-guild/graphql-hive/staging") or an UUID (e.g.
423+
"a0f4c605-6541-4350-8cfe-b31f21a4bf80").
387424
--token=<value> api token
388425
--url=<value> service url (only for distributed schemas)
389426
@@ -392,7 +429,7 @@ DESCRIPTION
392429
```
393430

394431
_See code:
395-
[dist/commands/schema/publish.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/schema/publish.js)_
432+
[src/commands/schema/publish.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/schema/publish.ts)_
396433

397434
## `hive update [CHANNEL]`
398435

@@ -453,7 +490,7 @@ DESCRIPTION
453490
```
454491

455492
_See code:
456-
[dist/commands/whoami.js](https://github.com/graphql-hive/platform/blob/v0.37.0/dist/commands/whoami.js)_
493+
[src/commands/whoami.ts](https://github.com/graphql-hive/platform/blob/v0.50.2/src/commands/whoami.ts)_
457494

458495
<!-- commandsstop -->
459496

packages/web/docs/src/content/api-reference/cli.mdx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,22 +603,43 @@ You can fetch either the latest schema or a schema by the action id (commit sha)
603603
publishing the schema version. The `--write` option can be used for writing the schema to a file.
604604

605605
```bash
606-
hive schema:fetch --type sdl --write schema.graphql
607-
hive schema:fetch --type sdl --write schema.graphql feb8aa9ec8932eb
606+
hive schema:fetch \
607+
--target "<YOUR_ORGANIZATION>/<YOUR_PROJECT>/<YOUR_TARGET>" \
608+
--type sdl \
609+
--write schema.graphqls
610+
611+
hive schema:fetch \
612+
--target "<YOUR_ORGANIZATION>/<YOUR_PROJECT>/<YOUR_TARGET>" \
613+
--type sdl \
614+
--write schema.graphqls \
615+
feb8aa9ec8932eb
608616
```
609617

610618
For projects with a supergraph it is also possible to fetch the supergraph.
611619

612620
```bash
613-
hive schema:fetch --type supergraph --write supergraph.graphql
614-
hive schema:fetch --type supergraph --write supergraph.graphql feb8aa9ec8932eb
621+
hive schema:fetch \
622+
--target "<YOUR_ORGANIZATION>/<YOUR_PROJECT>/<YOUR_TARGET>" \
623+
--type supergraph \
624+
--write supergraph.graphqls
625+
626+
hive schema:fetch \
627+
--target "<YOUR_ORGANIZATION>/<YOUR_PROJECT>/<YOUR_TARGET>" \
628+
--type supergraph \
629+
--write supergraph.graphqls \
630+
feb8aa9ec8932eb
615631
```
616632

617633
It is also possible to print a list of subgraph details in an ascii table.
618634

619635
```bash
620-
hive schema:fetch --type subgraphs
621-
hive schema:fetch --type subgraphs feb8aa9ec8932eb
636+
hive schema:fetch \
637+
--target "<YOUR_ORGANIZATION>/<YOUR_PROJECT>/<YOUR_TARGET>" \
638+
--type subgraphs
639+
640+
hive schema:fetch \
641+
--target "<YOUR_ORGANIZATION>/<YOUR_PROJECT>/<YOUR_TARGET>" \
642+
--type subgraphs feb8aa9ec8932eb
622643
```
623644

624645
For more information please refer to the

0 commit comments

Comments
 (0)