swaggerhub-cli 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -33
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/api/create.js +7 -7
- package/src/commands/api/publish.js +26 -5
- package/src/commands/api/update.js +1 -1
- package/src/commands/domain/create.js +1 -1
- package/src/commands/domain/update.js +1 -1
- package/src/requests/spec.js +10 -9
- package/src/support/command/update-command.js +26 -9
- package/src/template-strings/errors.js +1 -1
- package/src/utils/{oas.js → definitions.js} +14 -5
package/README.md
CHANGED
|
@@ -17,6 +17,8 @@ The SwaggerHub CLI enables teams to build automation and workflows around Swagge
|
|
|
17
17
|
<!-- tocstop -->
|
|
18
18
|
# Requirements
|
|
19
19
|
Node.js 12 or later.
|
|
20
|
+
|
|
21
|
+
*NOTE:* `swaggerhub-cli v0.6.4` *will be the last release to support Node 12.x and support will be dropped in a future version.*
|
|
20
22
|
# Installation
|
|
21
23
|
```sh-session
|
|
22
24
|
$ npm i -g swaggerhub-cli
|
|
@@ -170,7 +172,7 @@ EXAMPLES
|
|
|
170
172
|
swaggerhub api:create organization/api/1.0.0 --published=publish --setdefault --file api.json
|
|
171
173
|
```
|
|
172
174
|
|
|
173
|
-
_See code: [src/commands/api/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
175
|
+
_See code: [src/commands/api/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/create.js)_
|
|
174
176
|
|
|
175
177
|
## `swaggerhub api:delete`
|
|
176
178
|
|
|
@@ -193,7 +195,7 @@ EXAMPLES
|
|
|
193
195
|
swaggerhub api:delete organization/api --force
|
|
194
196
|
```
|
|
195
197
|
|
|
196
|
-
_See code: [src/commands/api/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
198
|
+
_See code: [src/commands/api/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/delete.js)_
|
|
197
199
|
|
|
198
200
|
## `swaggerhub api:get`
|
|
199
201
|
|
|
@@ -220,7 +222,7 @@ EXAMPLES
|
|
|
220
222
|
swaggerhub api:get organization/api/1.0.0 --json
|
|
221
223
|
```
|
|
222
224
|
|
|
223
|
-
_See code: [src/commands/api/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
225
|
+
_See code: [src/commands/api/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/get.js)_
|
|
224
226
|
|
|
225
227
|
## `swaggerhub api:publish`
|
|
226
228
|
|
|
@@ -234,13 +236,15 @@ ARGUMENTS
|
|
|
234
236
|
OWNER/API_NAME/VERSION API identifier
|
|
235
237
|
|
|
236
238
|
OPTIONS
|
|
237
|
-
-
|
|
239
|
+
-f, --force publish API without prompting for confirmation
|
|
240
|
+
-h, --help show CLI help
|
|
238
241
|
|
|
239
|
-
|
|
242
|
+
EXAMPLES
|
|
240
243
|
swaggerhub api:publish organization/api/1.0.0
|
|
244
|
+
swaggerhub api:publish organization/api/1.0.0 --force
|
|
241
245
|
```
|
|
242
246
|
|
|
243
|
-
_See code: [src/commands/api/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
247
|
+
_See code: [src/commands/api/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/publish.js)_
|
|
244
248
|
|
|
245
249
|
## `swaggerhub api:setdefault`
|
|
246
250
|
|
|
@@ -260,7 +264,7 @@ EXAMPLE
|
|
|
260
264
|
swaggerhub api:setdefault organization/api/2.0.0
|
|
261
265
|
```
|
|
262
266
|
|
|
263
|
-
_See code: [src/commands/api/setdefault.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
267
|
+
_See code: [src/commands/api/setdefault.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/setdefault.js)_
|
|
264
268
|
|
|
265
269
|
## `swaggerhub api:unpublish`
|
|
266
270
|
|
|
@@ -280,7 +284,7 @@ EXAMPLE
|
|
|
280
284
|
swaggerhub api:unpublish organization/api/1.0.0
|
|
281
285
|
```
|
|
282
286
|
|
|
283
|
-
_See code: [src/commands/api/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
287
|
+
_See code: [src/commands/api/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/unpublish.js)_
|
|
284
288
|
|
|
285
289
|
## `swaggerhub api:update`
|
|
286
290
|
|
|
@@ -314,7 +318,7 @@ EXAMPLES
|
|
|
314
318
|
swaggerhub api:update organization/api/1.0.0 --visibility=private
|
|
315
319
|
```
|
|
316
320
|
|
|
317
|
-
_See code: [src/commands/api/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
321
|
+
_See code: [src/commands/api/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/update.js)_
|
|
318
322
|
|
|
319
323
|
## `swaggerhub api:validate`
|
|
320
324
|
|
|
@@ -339,7 +343,7 @@ EXAMPLES
|
|
|
339
343
|
swaggerhub api:validate organization/api
|
|
340
344
|
```
|
|
341
345
|
|
|
342
|
-
_See code: [src/commands/api/validate.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
346
|
+
_See code: [src/commands/api/validate.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/api/validate.js)_
|
|
343
347
|
|
|
344
348
|
## `swaggerhub configure`
|
|
345
349
|
|
|
@@ -361,7 +365,7 @@ DESCRIPTION
|
|
|
361
365
|
settings.
|
|
362
366
|
```
|
|
363
367
|
|
|
364
|
-
_See code: [src/commands/configure.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
368
|
+
_See code: [src/commands/configure.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/configure.js)_
|
|
365
369
|
|
|
366
370
|
## `swaggerhub domain:create`
|
|
367
371
|
|
|
@@ -393,7 +397,7 @@ EXAMPLES
|
|
|
393
397
|
swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json
|
|
394
398
|
```
|
|
395
399
|
|
|
396
|
-
_See code: [src/commands/domain/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
400
|
+
_See code: [src/commands/domain/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/create.js)_
|
|
397
401
|
|
|
398
402
|
## `swaggerhub domain:delete`
|
|
399
403
|
|
|
@@ -416,7 +420,7 @@ EXAMPLES
|
|
|
416
420
|
swaggerhub domain:delete organization/domain --force
|
|
417
421
|
```
|
|
418
422
|
|
|
419
|
-
_See code: [src/commands/domain/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
423
|
+
_See code: [src/commands/domain/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/delete.js)_
|
|
420
424
|
|
|
421
425
|
## `swaggerhub domain:get`
|
|
422
426
|
|
|
@@ -442,7 +446,7 @@ EXAMPLES
|
|
|
442
446
|
swaggerhub domain:get organization/domain/1.0.0 --json
|
|
443
447
|
```
|
|
444
448
|
|
|
445
|
-
_See code: [src/commands/domain/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
449
|
+
_See code: [src/commands/domain/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/get.js)_
|
|
446
450
|
|
|
447
451
|
## `swaggerhub domain:publish`
|
|
448
452
|
|
|
@@ -462,7 +466,7 @@ EXAMPLE
|
|
|
462
466
|
swaggerhub domain:publish organization/domain/1.0.0
|
|
463
467
|
```
|
|
464
468
|
|
|
465
|
-
_See code: [src/commands/domain/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
469
|
+
_See code: [src/commands/domain/publish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/publish.js)_
|
|
466
470
|
|
|
467
471
|
## `swaggerhub domain:setdefault`
|
|
468
472
|
|
|
@@ -482,7 +486,7 @@ EXAMPLE
|
|
|
482
486
|
swaggerhub domain:setdefault organization/domain/2.0.0
|
|
483
487
|
```
|
|
484
488
|
|
|
485
|
-
_See code: [src/commands/domain/setdefault.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
489
|
+
_See code: [src/commands/domain/setdefault.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/setdefault.js)_
|
|
486
490
|
|
|
487
491
|
## `swaggerhub domain:unpublish`
|
|
488
492
|
|
|
@@ -502,7 +506,7 @@ EXAMPLE
|
|
|
502
506
|
swaggerhub domain:unpublish organization/domain/1.0.0
|
|
503
507
|
```
|
|
504
508
|
|
|
505
|
-
_See code: [src/commands/domain/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
509
|
+
_See code: [src/commands/domain/unpublish.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/unpublish.js)_
|
|
506
510
|
|
|
507
511
|
## `swaggerhub domain:update`
|
|
508
512
|
|
|
@@ -536,7 +540,7 @@ EXAMPLES
|
|
|
536
540
|
swaggerhub domain:update organization/domain/1.0.0 --visibility=private
|
|
537
541
|
```
|
|
538
542
|
|
|
539
|
-
_See code: [src/commands/domain/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
543
|
+
_See code: [src/commands/domain/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/domain/update.js)_
|
|
540
544
|
|
|
541
545
|
## `swaggerhub help`
|
|
542
546
|
|
|
@@ -579,7 +583,7 @@ EXAMPLE
|
|
|
579
583
|
swaggerhub integration:create organization/api/1.0.0 --file config.json
|
|
580
584
|
```
|
|
581
585
|
|
|
582
|
-
_See code: [src/commands/integration/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
586
|
+
_See code: [src/commands/integration/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/integration/create.js)_
|
|
583
587
|
|
|
584
588
|
## `swaggerhub integration:delete`
|
|
585
589
|
|
|
@@ -599,7 +603,7 @@ EXAMPLE
|
|
|
599
603
|
swaggerhub integration:delete organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704
|
|
600
604
|
```
|
|
601
605
|
|
|
602
|
-
_See code: [src/commands/integration/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
606
|
+
_See code: [src/commands/integration/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/integration/delete.js)_
|
|
603
607
|
|
|
604
608
|
## `swaggerhub integration:execute`
|
|
605
609
|
|
|
@@ -619,7 +623,7 @@ EXAMPLE
|
|
|
619
623
|
swaggerhub integration:execute organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704
|
|
620
624
|
```
|
|
621
625
|
|
|
622
|
-
_See code: [src/commands/integration/execute.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
626
|
+
_See code: [src/commands/integration/execute.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/integration/execute.js)_
|
|
623
627
|
|
|
624
628
|
## `swaggerhub integration:get`
|
|
625
629
|
|
|
@@ -639,7 +643,7 @@ EXAMPLE
|
|
|
639
643
|
swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704
|
|
640
644
|
```
|
|
641
645
|
|
|
642
|
-
_See code: [src/commands/integration/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
646
|
+
_See code: [src/commands/integration/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/integration/get.js)_
|
|
643
647
|
|
|
644
648
|
## `swaggerhub integration:list`
|
|
645
649
|
|
|
@@ -659,7 +663,7 @@ EXAMPLE
|
|
|
659
663
|
swaggerhub integration:list organization/api/1.0.0
|
|
660
664
|
```
|
|
661
665
|
|
|
662
|
-
_See code: [src/commands/integration/list.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
666
|
+
_See code: [src/commands/integration/list.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/integration/list.js)_
|
|
663
667
|
|
|
664
668
|
## `swaggerhub integration:update`
|
|
665
669
|
|
|
@@ -680,7 +684,7 @@ EXAMPLE
|
|
|
680
684
|
swaggerhub integration:update organization/api/1.0.0/503c2db6-448a-4678-abcd-0123456789abc --file config.json
|
|
681
685
|
```
|
|
682
686
|
|
|
683
|
-
_See code: [src/commands/integration/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
687
|
+
_See code: [src/commands/integration/update.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/integration/update.js)_
|
|
684
688
|
|
|
685
689
|
## `swaggerhub plugins`
|
|
686
690
|
|
|
@@ -839,7 +843,7 @@ EXAMPLE
|
|
|
839
843
|
swaggerhub project:api:add organization/project_name my_api
|
|
840
844
|
```
|
|
841
845
|
|
|
842
|
-
_See code: [src/commands/project/api/add.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
846
|
+
_See code: [src/commands/project/api/add.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/api/add.js)_
|
|
843
847
|
|
|
844
848
|
## `swaggerhub project:api:remove`
|
|
845
849
|
|
|
@@ -860,7 +864,7 @@ EXAMPLE
|
|
|
860
864
|
swaggerhub project:api:remove organization/project_name my_api
|
|
861
865
|
```
|
|
862
866
|
|
|
863
|
-
_See code: [src/commands/project/api/remove.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
867
|
+
_See code: [src/commands/project/api/remove.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/api/remove.js)_
|
|
864
868
|
|
|
865
869
|
## `swaggerhub project:create`
|
|
866
870
|
|
|
@@ -888,7 +892,7 @@ EXAMPLES
|
|
|
888
892
|
swaggerhub project:create organization/new_project_name -a "testapi1" -d "testdomain3" --description "description"
|
|
889
893
|
```
|
|
890
894
|
|
|
891
|
-
_See code: [src/commands/project/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
895
|
+
_See code: [src/commands/project/create.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/create.js)_
|
|
892
896
|
|
|
893
897
|
## `swaggerhub project:delete`
|
|
894
898
|
|
|
@@ -908,7 +912,7 @@ EXAMPLE
|
|
|
908
912
|
swaggerhub project:delete organization/project_name
|
|
909
913
|
```
|
|
910
914
|
|
|
911
|
-
_See code: [src/commands/project/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
915
|
+
_See code: [src/commands/project/delete.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/delete.js)_
|
|
912
916
|
|
|
913
917
|
## `swaggerhub project:domain:add`
|
|
914
918
|
|
|
@@ -929,7 +933,7 @@ EXAMPLE
|
|
|
929
933
|
swaggerhub project:domain:add organization/project_name my_domain
|
|
930
934
|
```
|
|
931
935
|
|
|
932
|
-
_See code: [src/commands/project/domain/add.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
936
|
+
_See code: [src/commands/project/domain/add.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/domain/add.js)_
|
|
933
937
|
|
|
934
938
|
## `swaggerhub project:domain:remove`
|
|
935
939
|
|
|
@@ -950,7 +954,7 @@ EXAMPLE
|
|
|
950
954
|
swaggerhub project:domain:remove organization/project_name my_domain
|
|
951
955
|
```
|
|
952
956
|
|
|
953
|
-
_See code: [src/commands/project/domain/remove.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
957
|
+
_See code: [src/commands/project/domain/remove.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/domain/remove.js)_
|
|
954
958
|
|
|
955
959
|
## `swaggerhub project:get`
|
|
956
960
|
|
|
@@ -970,7 +974,7 @@ EXAMPLE
|
|
|
970
974
|
swaggerhub project:get organization/project_name
|
|
971
975
|
```
|
|
972
976
|
|
|
973
|
-
_See code: [src/commands/project/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
977
|
+
_See code: [src/commands/project/get.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/get.js)_
|
|
974
978
|
|
|
975
979
|
## `swaggerhub project:list`
|
|
976
980
|
|
|
@@ -991,7 +995,7 @@ EXAMPLES
|
|
|
991
995
|
swaggerhub project:list organization
|
|
992
996
|
```
|
|
993
997
|
|
|
994
|
-
_See code: [src/commands/project/list.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
998
|
+
_See code: [src/commands/project/list.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/list.js)_
|
|
995
999
|
|
|
996
1000
|
## `swaggerhub project:member:list`
|
|
997
1001
|
|
|
@@ -1011,7 +1015,7 @@ EXAMPLE
|
|
|
1011
1015
|
swaggerhub project:member:list organisation/project_name
|
|
1012
1016
|
```
|
|
1013
1017
|
|
|
1014
|
-
_See code: [src/commands/project/member/list.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.
|
|
1018
|
+
_See code: [src/commands/project/member/list.js](https://github.com/SmartBear/swaggerhub-cli/blob/v0.6.4/src/commands/project/member/list.js)_
|
|
1015
1019
|
<!-- commandsstop -->
|
|
1016
1020
|
|
|
1017
1021
|
# Plugins
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.6.2","commands":{"configure":{"id":"configure","description":"configure application settings\nEnter the SwaggerHub URL - default is https://api.swaggerhub.com\nCustomers with on-premise installations need to point this to their on-premise API, which is http(s)://{swaggerhub-host}/v1\nEnter the API Key - this can be retrieved from https://app.swaggerhub.com/settings/apiKey\nYou can set these as environment variables: SWAGGERHUB_URL, SWAGGERHUB_API_KEY. These take priority over config settings.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"api:create":{"id":"api:create","description":"creates a new API / API version from a YAML/JSON file\nThe API version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the API version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:create organization/api/1.0.0 --file api.yaml --visibility public","swaggerhub api:create organization/api --file api.yaml","swaggerhub api:create organization/api/1.0.0 --published=publish --file api.json","swaggerhub api:create organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:create organization/api/1.0.0 --published=publish --setdefault --file api.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"],"default":"private"},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the API version","required":false,"options":["publish","unpublish"],"default":"unpublish"},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to create in SwaggerHub","required":true}]},"api:delete":{"id":"api:delete","description":"delete an API or API version\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:delete organization/api/1.0.0","swaggerhub api:delete organization/api","swaggerhub api:delete organization/api --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"delete API without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to delete in SwaggerHub","required":true}]},"api:get":{"id":"api:get","description":"fetches an API definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the API in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:get organization/api","swaggerhub api:get organization/api/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the API in JSON format.","allowNo":false},"resolved":{"name":"resolved","type":"boolean","char":"r","description":"gets the resolved API definition (supported in v1.25+). ","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"SwaggerHub API to fetch","required":true}]},"api:publish":{"id":"api:publish","description":"publish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:publish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:setdefault":{"id":"api:setdefault","description":"set the default version of an API","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:setdefault organization/api/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:unpublish":{"id":"api:unpublish","description":"unpublish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:unpublish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:update":{"id":"api:update","description":"update an API\nThe API version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default API version will be updated.\nThe API visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:update organization/api --file api.yaml","swaggerhub api:update organization/api/1.0.0 --file api.json","swaggerhub api:update organization/api/1.0.0 --published=publish --file api.json","swaggerhub api:update organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --published=unpublish --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"]},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the API version","required":false,"options":["publish","unpublish"]},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to update in SwaggerHub","required":true}]},"api:validate":{"id":"api:validate","description":"get validation result for an API version\nWhen VERSION is not included in the argument, the default version will be validated.\nAn error will occur if the API version does not exist.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:validate organization/api/1.0.0","swaggerhub api:validate organization/api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API Identifier","required":true}]},"domain:create":{"id":"domain:create","description":"creates a new domain / domain version from a YAML/JSON file\nThe domain version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the domain version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:create organization/domain/1.0.0 --file domain.yaml --visibility public","swaggerhub domain:create organization/domain --file domain.yaml","swaggerhub domain:create organization/domain/1.0.0 --publish --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"],"default":"private"},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the domain version","required":false,"options":["publish","unpublish"],"default":"unpublish"},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to create in SwaggerHub","required":true}]},"domain:delete":{"id":"domain:delete","description":"delete a domain or domain version\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:delete organization/domain/1.0.0","swaggerhub domain:delete organization/domain","swaggerhub domain:delete organization/domain --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"delete domain without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to delete in SwaggerHub","required":true}]},"domain:get":{"id":"domain:get","description":"fetches a domain definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the domain in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:get organization/domain","swaggerhub domain:get organization/domain/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the domain in JSON format.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"SwaggerHub domain to fetch","required":true}]},"domain:publish":{"id":"domain:publish","description":"publish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:publish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:setdefault":{"id":"domain:setdefault","description":"set the default version of a domain","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:setdefault organization/domain/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"domain identifier","required":true}]},"domain:unpublish":{"id":"domain:unpublish","description":"unpublish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:unpublish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:update":{"id":"domain:update","description":"update a domain\nThe domain version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default domain version will be updated.\nThe domain visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:update organization/domain --file domain.yaml","swaggerhub domain:update organization/domain/1.0.0 --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --published=publish --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --published=unpublish --setdefault --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"]},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the domain version","required":false,"options":["publish","unpublish"]},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"domain to update in SwaggerHub","required":true}]},"integration:create":{"id":"integration:create","description":"creates a new API integration from a JSON configuration file.\nSee the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/master/examples/integrations\nWhen VERSION is not included in the argument, the integration will be added to be default API version.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:create organization/api/1.0.0 --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API where integration will be added","required":true}]},"integration:delete":{"id":"integration:delete","description":"deletes the integration from the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:delete organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to delete","required":true}]},"integration:execute":{"id":"integration:execute","description":"executes an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:execute organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to execute for given API","required":true}]},"integration:get":{"id":"integration:get","description":"retieves an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to fetch for given API","required":true}]},"integration:list":{"id":"integration:list","description":"list integrations on an API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:list organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to list integrations on","required":true}]},"integration:update":{"id":"integration:update","description":"update the configuration of an API integration.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:update organization/api/1.0.0/503c2db6-448a-4678-abcd-0123456789abc --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to update on the given API","required":true}]},"project:create":{"id":"project:create","description":"Creates a new project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:create organization/new_project_name --description \"project description\"","swaggerhub project:create organization/new_project_name -a \"testapi1,testapi2\"","swaggerhub project:create organization/new_project_name --apis \"testapi1,testapi2\"","swaggerhub project:create organization/new_project_name -d \"testdomain3,testdomain4\"","swaggerhub project:create organization/new_project_name --domains \"testdomain3,testdomain4\"","swaggerhub project:create organization/new_project_name -a \"testapi1\" -d \"testdomain3\" --description \"description\""],"flags":{"description":{"name":"description","type":"option","description":"Description of project","required":false},"apis":{"name":"apis","type":"option","char":"a","description":"Comma separated list of api names to include in project","required":false},"domains":{"name":"domains","type":"option","char":"d","description":"Comma separated list of domain names to include in project","required":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The new project to create","required":true}]},"project:delete":{"id":"project:delete","description":"Deletes a project from SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:delete organization/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to delete","required":true}]},"project:get":{"id":"project:get","description":"Retrieves the details for a project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:get organization/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to retrieve the details for","required":true}]},"project:list":{"id":"project:list","description":"list projects","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:list","swaggerhub project:list organization"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER","description":"Organization to list projects for","required":false}]},"project:api:add":{"id":"project:api:add","description":"Adds an API to an existing project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:api:add organization/project_name my_api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project to add the API to","required":true},{"name":"API","description":"The name of the API to add","required":true}]},"project:api:remove":{"id":"project:api:remove","description":"Removes an API from a project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:api:remove organization/project_name my_api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project remove the API from","required":true},{"name":"API","description":"The API to remove","required":true}]},"project:domain:add":{"id":"project:domain:add","description":"Adds a domain to an existing project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:domain:add organization/project_name my_domain"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project to add the domain to","required":true},{"name":"DOMAIN","description":"The name of the domain to add","required":true}]},"project:domain:remove":{"id":"project:domain:remove","description":"Removes a domain from a project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:domain:remove organization/project_name my_domain"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project remove the domain from","required":true},{"name":"DOMAIN","description":"The domain to remove","required":true}]},"project:member:list":{"id":"project:member:list","description":"list members of a project","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:member:list organisation/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to list members of","required":true}]}}}
|
|
1
|
+
{"version":"0.6.4","commands":{"configure":{"id":"configure","description":"configure application settings\nEnter the SwaggerHub URL - default is https://api.swaggerhub.com\nCustomers with on-premise installations need to point this to their on-premise API, which is http(s)://{swaggerhub-host}/v1\nEnter the API Key - this can be retrieved from https://app.swaggerhub.com/settings/apiKey\nYou can set these as environment variables: SWAGGERHUB_URL, SWAGGERHUB_API_KEY. These take priority over config settings.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"api:create":{"id":"api:create","description":"creates a new API / API version from a YAML/JSON file\nThe API version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the API version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:create organization/api/1.0.0 --file api.yaml --visibility public","swaggerhub api:create organization/api --file api.yaml","swaggerhub api:create organization/api/1.0.0 --published=publish --file api.json","swaggerhub api:create organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:create organization/api/1.0.0 --published=publish --setdefault --file api.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"],"default":"private"},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the API version","required":false,"options":["publish","unpublish"],"default":"unpublish"},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to create in SwaggerHub","required":true}]},"api:delete":{"id":"api:delete","description":"delete an API or API version\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:delete organization/api/1.0.0","swaggerhub api:delete organization/api","swaggerhub api:delete organization/api --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"delete API without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to delete in SwaggerHub","required":true}]},"api:get":{"id":"api:get","description":"fetches an API definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the API in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:get organization/api","swaggerhub api:get organization/api/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the API in JSON format.","allowNo":false},"resolved":{"name":"resolved","type":"boolean","char":"r","description":"gets the resolved API definition (supported in v1.25+). ","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"SwaggerHub API to fetch","required":true}]},"api:publish":{"id":"api:publish","description":"publish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:publish organization/api/1.0.0","swaggerhub api:publish organization/api/1.0.0 --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"publish API without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:setdefault":{"id":"api:setdefault","description":"set the default version of an API","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:setdefault organization/api/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:unpublish":{"id":"api:unpublish","description":"unpublish an API version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:unpublish organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION","description":"API identifier","required":true}]},"api:update":{"id":"api:update","description":"update an API\nThe API version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default API version will be updated.\nThe API visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:update organization/api --file api.yaml","swaggerhub api:update organization/api/1.0.0 --file api.json","swaggerhub api:update organization/api/1.0.0 --published=publish --file api.json","swaggerhub api:update organization/api/1.0.0 --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --published=unpublish --setdefault --file api.json","swaggerhub api:update organization/api/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of API to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of API in SwaggerHub","options":["public","private"]},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the API version","required":false,"options":["publish","unpublish"]},"setdefault":{"name":"setdefault","type":"boolean","description":"sets API version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to update in SwaggerHub","required":true}]},"api:validate":{"id":"api:validate","description":"get validation result for an API version\nWhen VERSION is not included in the argument, the default version will be validated.\nAn error will occur if the API version does not exist.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub api:validate organization/api/1.0.0","swaggerhub api:validate organization/api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API Identifier","required":true}]},"domain:create":{"id":"domain:create","description":"creates a new domain / domain version from a YAML/JSON file\nThe domain version from the file will be used unless the version is specified in the command argument.\nAn error will occur if the domain version already exists.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:create organization/domain/1.0.0 --file domain.yaml --visibility public","swaggerhub domain:create organization/domain --file domain.yaml","swaggerhub domain:create organization/domain/1.0.0 --publish --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to create","required":true},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"],"default":"private"},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the domain version","required":false,"options":["publish","unpublish"],"default":"unpublish"},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to create in SwaggerHub","required":true}]},"domain:delete":{"id":"domain:delete","description":"delete a domain or domain version\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:delete organization/domain/1.0.0","swaggerhub domain:delete organization/domain","swaggerhub domain:delete organization/domain --force"],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"delete domain without prompting for confirmation","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"Domain to delete in SwaggerHub","required":true}]},"domain:get":{"id":"domain:get","description":"fetches a domain definition\nWhen VERSION is not included in the argument, the default version will be returned.\nReturns the domain in YAML format by default.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:get organization/domain","swaggerhub domain:get organization/domain/1.0.0 --json"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"returns the domain in JSON format.","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"SwaggerHub domain to fetch","required":true}]},"domain:publish":{"id":"domain:publish","description":"publish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:publish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:setdefault":{"id":"domain:setdefault","description":"set the default version of a domain","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:setdefault organization/domain/2.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"domain identifier","required":true}]},"domain:unpublish":{"id":"domain:unpublish","description":"unpublish a domain version","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:unpublish organization/domain/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/VERSION","description":"Domain identifier","required":true}]},"domain:update":{"id":"domain:update","description":"update a domain\nThe domain version from the file will be used unless the version is specified in the command argument.\nWhen no file is specified then the default domain version will be updated.\nThe domain visibility can be changed by using visibility flag.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub domain:update organization/domain --file domain.yaml","swaggerhub domain:update organization/domain/1.0.0 --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --published=publish --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --setdefault --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --published=unpublish --setdefault --file domain.json","swaggerhub domain:update organization/domain/1.0.0 --visibility=private"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"file location of domain to update","required":false},"visibility":{"name":"visibility","type":"option","description":"visibility of domain in SwaggerHub","options":["public","private"]},"published":{"name":"published","type":"option","description":"sets the lifecycle setting of the domain version","required":false,"options":["publish","unpublish"]},"setdefault":{"name":"setdefault","type":"boolean","description":"sets domain version to be the default","required":false,"allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/DOMAIN_NAME/[VERSION]","description":"domain to update in SwaggerHub","required":true}]},"integration:create":{"id":"integration:create","description":"creates a new API integration from a JSON configuration file.\nSee the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/master/examples/integrations\nWhen VERSION is not included in the argument, the integration will be added to be default API version.\n","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:create organization/api/1.0.0 --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API where integration will be added","required":true}]},"integration:delete":{"id":"integration:delete","description":"deletes the integration from the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:delete organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to delete","required":true}]},"integration:execute":{"id":"integration:execute","description":"executes an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:execute organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to execute for given API","required":true}]},"integration:get":{"id":"integration:get","description":"retieves an integration for the given API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to fetch for given API","required":true}]},"integration:list":{"id":"integration:list","description":"list integrations on an API.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:list organization/api/1.0.0"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/[VERSION]","description":"API to list integrations on","required":true}]},"integration:update":{"id":"integration:update","description":"update the configuration of an API integration.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub integration:update organization/api/1.0.0/503c2db6-448a-4678-abcd-0123456789abc --file config.json"],"flags":{"file":{"name":"file","type":"option","char":"f","description":"location of integration configuration file","required":true},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/API_NAME/VERSION/INTEGRATION_ID","description":"Integration to update on the given API","required":true}]},"project:create":{"id":"project:create","description":"Creates a new project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:create organization/new_project_name --description \"project description\"","swaggerhub project:create organization/new_project_name -a \"testapi1,testapi2\"","swaggerhub project:create organization/new_project_name --apis \"testapi1,testapi2\"","swaggerhub project:create organization/new_project_name -d \"testdomain3,testdomain4\"","swaggerhub project:create organization/new_project_name --domains \"testdomain3,testdomain4\"","swaggerhub project:create organization/new_project_name -a \"testapi1\" -d \"testdomain3\" --description \"description\""],"flags":{"description":{"name":"description","type":"option","description":"Description of project","required":false},"apis":{"name":"apis","type":"option","char":"a","description":"Comma separated list of api names to include in project","required":false},"domains":{"name":"domains","type":"option","char":"d","description":"Comma separated list of domain names to include in project","required":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The new project to create","required":true}]},"project:delete":{"id":"project:delete","description":"Deletes a project from SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:delete organization/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to delete","required":true}]},"project:get":{"id":"project:get","description":"Retrieves the details for a project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:get organization/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to retrieve the details for","required":true}]},"project:list":{"id":"project:list","description":"list projects","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:list","swaggerhub project:list organization"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER","description":"Organization to list projects for","required":false}]},"project:api:add":{"id":"project:api:add","description":"Adds an API to an existing project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:api:add organization/project_name my_api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project to add the API to","required":true},{"name":"API","description":"The name of the API to add","required":true}]},"project:api:remove":{"id":"project:api:remove","description":"Removes an API from a project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:api:remove organization/project_name my_api"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project remove the API from","required":true},{"name":"API","description":"The API to remove","required":true}]},"project:domain:add":{"id":"project:domain:add","description":"Adds a domain to an existing project.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:domain:add organization/project_name my_domain"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project to add the domain to","required":true},{"name":"DOMAIN","description":"The name of the domain to add","required":true}]},"project:domain:remove":{"id":"project:domain:remove","description":"Removes a domain from a project in SwaggerHub.","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:domain:remove organization/project_name my_domain"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"The project remove the domain from","required":true},{"name":"DOMAIN","description":"The domain to remove","required":true}]},"project:member:list":{"id":"project:member:list","description":"list members of a project","pluginName":"swaggerhub-cli","pluginType":"core","aliases":[],"examples":["swaggerhub project:member:list organisation/project_name"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"OWNER/PROJECT_NAME","description":"Project to list members of","required":true}]}}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ const { flags } = require('@oclif/command')
|
|
|
2
2
|
const { readFileSync } = require('fs-extra')
|
|
3
3
|
const { getApi, postApi } = require('../../requests/api')
|
|
4
4
|
const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
|
|
5
|
-
const {
|
|
5
|
+
const { getVersion, parseDefinition, getSpecification } = require('../../utils/definitions')
|
|
6
6
|
const BaseCommand = require('../../support/command/base-command')
|
|
7
7
|
const UpdateCommand = require('../../support/command/update-command')
|
|
8
8
|
|
|
@@ -18,13 +18,13 @@ class CreateAPICommand extends UpdateCommand {
|
|
|
18
18
|
})
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
async tryCreateApi({ path, version,
|
|
21
|
+
async tryCreateApi({ path, version, specification, flags }) {
|
|
22
22
|
const isNameAvailable = await this.checkApiName(path)
|
|
23
23
|
const pathHasVersion = path.length === 3
|
|
24
24
|
const fullPath = pathHasVersion ? path : [...path, version]
|
|
25
25
|
|
|
26
26
|
if (isNameAvailable) {
|
|
27
|
-
await this.createApi(fullPath,
|
|
27
|
+
await this.createApi(fullPath, specification, flags, pathHasVersion)
|
|
28
28
|
return true
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -38,12 +38,12 @@ class CreateAPICommand extends UpdateCommand {
|
|
|
38
38
|
})
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
async createApi([owner, name, version],
|
|
41
|
+
async createApi([owner, name, version], specification, flags, pathHasVersion) {
|
|
42
42
|
const isPrivate = flags.visibility === 'private'
|
|
43
43
|
|
|
44
44
|
const createApiObj = {
|
|
45
45
|
pathParams: [owner, name],
|
|
46
|
-
queryParams: { version, isPrivate,
|
|
46
|
+
queryParams: { version, isPrivate, specification },
|
|
47
47
|
body: readFileSync(flags.file)
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -61,7 +61,7 @@ class CreateAPICommand extends UpdateCommand {
|
|
|
61
61
|
async run() {
|
|
62
62
|
const { args, flags } = this.parse(CreateAPICommand)
|
|
63
63
|
const definition = parseDefinition(flags.file)
|
|
64
|
-
const
|
|
64
|
+
const specification = getSpecification(definition)
|
|
65
65
|
const apiVersion = getVersion(definition)
|
|
66
66
|
const apiPath = getApiIdentifierArg(args)
|
|
67
67
|
const [owner, name, version = apiVersion] = splitPathParams(apiPath)
|
|
@@ -71,7 +71,7 @@ class CreateAPICommand extends UpdateCommand {
|
|
|
71
71
|
path: [owner, name],
|
|
72
72
|
version,
|
|
73
73
|
flags,
|
|
74
|
-
|
|
74
|
+
specification
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const createdApi = (
|
|
@@ -1,29 +1,50 @@
|
|
|
1
|
+
const { flags } = require('@oclif/command')
|
|
1
2
|
const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
|
|
2
3
|
const BaseCommand = require('../../support/command/base-command')
|
|
3
4
|
const UpdateCommand = require('../../support/command/update-command')
|
|
5
|
+
const inquirer = require('inquirer')
|
|
4
6
|
|
|
5
7
|
class PublishCommand extends UpdateCommand {
|
|
6
8
|
async run() {
|
|
7
|
-
const { args } = this.parse(PublishCommand)
|
|
9
|
+
const { args, flags } = this.parse(PublishCommand)
|
|
8
10
|
const apiPath = getApiIdentifierArg(args)
|
|
9
11
|
const [owner, name, version] = splitPathParams(apiPath)
|
|
10
12
|
|
|
11
|
-
await this.updatePublish('apis', owner, name, version, true)
|
|
13
|
+
await this.updatePublish('apis', owner, name, version, true, flags)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async confirmPublish() {
|
|
17
|
+
const confirm = await inquirer.prompt([
|
|
18
|
+
{
|
|
19
|
+
type: 'confirm',
|
|
20
|
+
name: 'answer',
|
|
21
|
+
message: `You are about to publish an API referencing unpublished Domains. If those Domains change, it may affect your API definition. Do you wish to continue?`,
|
|
22
|
+
default: false
|
|
23
|
+
}
|
|
24
|
+
])
|
|
25
|
+
return confirm.answer
|
|
12
26
|
}
|
|
13
27
|
}
|
|
14
28
|
|
|
15
29
|
PublishCommand.description = 'publish an API version'
|
|
16
30
|
|
|
17
31
|
PublishCommand.examples = [
|
|
18
|
-
'swaggerhub api:publish organization/api/1.0.0'
|
|
32
|
+
'swaggerhub api:publish organization/api/1.0.0',
|
|
33
|
+
'swaggerhub api:publish organization/api/1.0.0 --force'
|
|
19
34
|
]
|
|
20
35
|
|
|
21
|
-
PublishCommand.args = [{
|
|
36
|
+
PublishCommand.args = [{
|
|
22
37
|
name: 'OWNER/API_NAME/VERSION',
|
|
23
38
|
required: true,
|
|
24
39
|
description: 'API identifier'
|
|
25
40
|
}]
|
|
26
41
|
|
|
27
|
-
PublishCommand.flags =
|
|
42
|
+
PublishCommand.flags = {
|
|
43
|
+
force: flags.boolean({
|
|
44
|
+
char: 'f',
|
|
45
|
+
description: 'publish API without prompting for confirmation'
|
|
46
|
+
}),
|
|
47
|
+
...BaseCommand.flags
|
|
48
|
+
}
|
|
28
49
|
|
|
29
50
|
module.exports = PublishCommand
|
|
@@ -2,7 +2,7 @@ const { flags } = require('@oclif/command')
|
|
|
2
2
|
const { readFileSync } = require('fs-extra')
|
|
3
3
|
const { getApi, postApi } = require('../../requests/api')
|
|
4
4
|
const { getApiIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
|
|
5
|
-
const { getVersion, parseDefinition } = require('../../utils/
|
|
5
|
+
const { getVersion, parseDefinition } = require('../../utils/definitions')
|
|
6
6
|
const BaseCommand = require('../../support/command/base-command')
|
|
7
7
|
const UpdateCommand = require('../../support/command/update-command')
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ const { flags } = require('@oclif/command')
|
|
|
2
2
|
const { readFileSync } = require('fs-extra')
|
|
3
3
|
const { getDomain, postDomain } = require('../../requests/domain')
|
|
4
4
|
const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
|
|
5
|
-
const { getVersion, parseDefinition } = require('../../utils/
|
|
5
|
+
const { getVersion, parseDefinition } = require('../../utils/definitions')
|
|
6
6
|
const BaseCommand = require('../../support/command/base-command')
|
|
7
7
|
const UpdateCommand = require('../../support/command/update-command')
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ const { flags } = require('@oclif/command')
|
|
|
2
2
|
const { readFileSync } = require('fs-extra')
|
|
3
3
|
const { getDomain, postDomain } = require('../../requests/domain')
|
|
4
4
|
const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
|
|
5
|
-
const { getVersion, parseDefinition } = require('../../utils/
|
|
5
|
+
const { getVersion, parseDefinition } = require('../../utils/definitions')
|
|
6
6
|
const BaseCommand = require('../../support/command/base-command')
|
|
7
7
|
const UpdateCommand = require('../../support/command/update-command')
|
|
8
8
|
|
package/src/requests/spec.js
CHANGED
|
@@ -23,15 +23,16 @@ const getSpec = (specType, pathParams, queryParams, accept) => {
|
|
|
23
23
|
})
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const putSpec = (specType, pathParams, body) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const putSpec = (specType, pathParams, body, query) => {
|
|
27
|
+
const { SWAGGERHUB_URL, SWAGGERHUB_API_KEY } = config.getConfig()
|
|
28
|
+
return http({
|
|
29
|
+
url: [SWAGGERHUB_URL, specType, ...pathParams],
|
|
30
|
+
auth: SWAGGERHUB_API_KEY,
|
|
31
|
+
contentType: 'json',
|
|
32
|
+
method: 'PUT',
|
|
33
|
+
query,
|
|
34
|
+
body
|
|
35
|
+
})
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const postSpec = (specType, pathParams, queryParams, body) => {
|
|
@@ -1,29 +1,46 @@
|
|
|
1
1
|
const BaseCommand = require('./base-command')
|
|
2
2
|
const { putSpec } = require('../../requests/spec')
|
|
3
|
+
const { handleErrors } = require('./handle-response')
|
|
3
4
|
|
|
4
5
|
class UpdateCommand extends BaseCommand {
|
|
5
6
|
|
|
6
|
-
async updatePublish(type, owner, name, version, isPublished) {
|
|
7
|
+
async updatePublish(type, owner, name, version, isPublished, flags = { force: false }) {
|
|
7
8
|
const pathParams = [owner, name, version, 'settings', 'lifecycle']
|
|
8
9
|
const body = JSON.stringify({ published: isPublished })
|
|
9
10
|
const successMessage = isPublished ? 'published' : 'unpublished'
|
|
10
11
|
|
|
11
12
|
await this.executeHttp({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
execute: () => flags.force ? putSpec(type, pathParams, body, flags) : putSpec(type, pathParams, body),
|
|
14
|
+
onResolve: this.setSuccessMessage(successMessage)({
|
|
15
|
+
type: type === 'apis' ? 'API' : 'domain',
|
|
16
|
+
path: `${owner}/${name}/${version}`
|
|
17
|
+
}),
|
|
18
|
+
onReject: async (err) => {
|
|
19
|
+
if (err.status === 424 && type === 'apis') {
|
|
20
|
+
if (await this.confirmPublish() === true) {
|
|
21
|
+
this.executeHttp({
|
|
22
|
+
execute: () => putSpec(type, pathParams, body, { 'force': 'true' }),
|
|
23
|
+
onResolve: this.setSuccessMessage(successMessage)({
|
|
24
|
+
type: 'API',
|
|
25
|
+
path: `${owner}/${name}/${version}`
|
|
26
|
+
}),
|
|
27
|
+
options: { resolveStatus: [403] }
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
handleErrors(err)
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
options: { resolveStatus: [403] }
|
|
18
35
|
})
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
async updateDefault(type, owner, name, version) {
|
|
22
39
|
const pathParams = [owner, name, 'settings', 'default']
|
|
23
40
|
const body = JSON.stringify({ version })
|
|
24
|
-
|
|
41
|
+
|
|
25
42
|
await this.executeHttp({
|
|
26
|
-
execute: () => putSpec(type, pathParams, body),
|
|
43
|
+
execute: () => putSpec(type, pathParams, body),
|
|
27
44
|
onResolve: this.setSuccessMessage('setDefault')({
|
|
28
45
|
owner,
|
|
29
46
|
name,
|
|
@@ -11,7 +11,7 @@ const errorMsg = {
|
|
|
11
11
|
|
|
12
12
|
cannotParseDefinition: 'There was a problem with parsing {{filename}}. \nReason: {{e}}',
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
cannotParseSpecification: 'Cannot determine specification from file',
|
|
15
15
|
|
|
16
16
|
cannotParseVersion: 'Cannot determine version from file',
|
|
17
17
|
|
|
@@ -4,11 +4,20 @@ const yaml = require('js-yaml')
|
|
|
4
4
|
const { existsSync, readFileSync } = require('fs-extra')
|
|
5
5
|
const { errorMsg } = require('../template-strings')
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
|
|
7
|
+
const specVersionToSpecification = specVersion => {
|
|
8
|
+
if (/2.0$/.test(specVersion))
|
|
9
|
+
return 'openapi-2.0'
|
|
10
|
+
if (/2.\d+.\d+$/.test(specVersion))
|
|
11
|
+
return 'asyncapi-2.x.x'
|
|
12
|
+
return 'openapi-3.0.0'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const getSpecification = ({ swagger, openapi, asyncapi }) => {
|
|
16
|
+
if (!swagger && !openapi && !asyncapi) {
|
|
17
|
+
throw new CLIError(errorMsg.cannotParseSpecification())
|
|
10
18
|
}
|
|
11
|
-
|
|
19
|
+
const specVersion = [swagger, openapi, asyncapi].filter(version => Boolean(version))[0]
|
|
20
|
+
return specVersionToSpecification(specVersion)
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
const getVersion = definition => {
|
|
@@ -34,7 +43,7 @@ const parseDefinition = filename => {
|
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
module.exports = {
|
|
37
|
-
|
|
46
|
+
getSpecification,
|
|
38
47
|
getVersion,
|
|
39
48
|
parseDefinition,
|
|
40
49
|
}
|