@redocly/cli 1.34.3 → 2.0.0-next.0
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 +34 -3
- package/bin/cli.js +1 -1
- package/lib/auth/device-flow.d.ts +1 -0
- package/lib/auth/device-flow.d.ts.map +1 -0
- package/lib/auth/device-flow.js +15 -17
- package/lib/auth/device-flow.js.map +1 -0
- package/lib/auth/oauth-client.d.ts +1 -0
- package/lib/auth/oauth-client.d.ts.map +1 -0
- package/lib/auth/oauth-client.js +21 -23
- package/lib/auth/oauth-client.js.map +1 -0
- package/lib/commands/auth.d.ts +3 -5
- package/lib/commands/auth.d.ts.map +1 -0
- package/lib/commands/auth.js +19 -44
- package/lib/commands/auth.js.map +1 -0
- package/lib/commands/build-docs/index.d.ts +4 -3
- package/lib/commands/build-docs/index.d.ts.map +1 -0
- package/lib/commands/build-docs/index.js +23 -24
- package/lib/commands/build-docs/index.js.map +1 -0
- package/lib/commands/build-docs/types.d.ts +2 -1
- package/lib/commands/build-docs/types.d.ts.map +1 -0
- package/lib/commands/build-docs/types.js +2 -2
- package/lib/commands/build-docs/types.js.map +1 -0
- package/lib/commands/build-docs/utils.d.ts +3 -2
- package/lib/commands/build-docs/utils.d.ts.map +1 -0
- package/lib/commands/build-docs/utils.js +35 -37
- package/lib/commands/build-docs/utils.js.map +1 -0
- package/lib/commands/bundle.d.ts +6 -3
- package/lib/commands/bundle.d.ts.map +1 -0
- package/lib/commands/bundle.js +34 -38
- package/lib/commands/bundle.js.map +1 -0
- package/lib/commands/eject.d.ts +3 -2
- package/lib/commands/eject.d.ts.map +1 -0
- package/lib/commands/eject.js +11 -13
- package/lib/commands/eject.js.map +1 -0
- package/lib/commands/join.d.ts +4 -3
- package/lib/commands/join.d.ts.map +1 -0
- package/lib/commands/join.js +79 -81
- package/lib/commands/join.js.map +1 -0
- package/lib/commands/lint.d.ts +8 -6
- package/lib/commands/lint.d.ts.map +1 -0
- package/lib/commands/lint.js +53 -62
- package/lib/commands/lint.js.map +1 -0
- package/lib/commands/preview-project/constants.d.ts +2 -1
- package/lib/commands/preview-project/constants.d.ts.map +1 -0
- package/lib/commands/preview-project/constants.js +4 -6
- package/lib/commands/preview-project/constants.js.map +1 -0
- package/lib/commands/preview-project/index.d.ts +3 -2
- package/lib/commands/preview-project/index.d.ts.map +1 -0
- package/lib/commands/preview-project/index.js +21 -23
- package/lib/commands/preview-project/index.js.map +1 -0
- package/lib/commands/preview-project/types.d.ts +3 -2
- package/lib/commands/preview-project/types.d.ts.map +1 -0
- package/lib/commands/preview-project/types.js +2 -2
- package/lib/commands/preview-project/types.js.map +1 -0
- package/lib/commands/split/index.d.ts +4 -3
- package/lib/commands/split/index.d.ts.map +1 -0
- package/lib/commands/split/index.js +53 -57
- package/lib/commands/split/index.js.map +1 -0
- package/lib/commands/split/types.d.ts +2 -2
- package/lib/commands/split/types.d.ts.map +1 -0
- package/lib/commands/split/types.js +11 -13
- package/lib/commands/split/types.js.map +1 -0
- package/lib/commands/stats.d.ts +3 -2
- package/lib/commands/stats.d.ts.map +1 -0
- package/lib/commands/stats.js +21 -24
- package/lib/commands/stats.js.map +1 -0
- package/lib/commands/translations.d.ts +3 -2
- package/lib/commands/translations.d.ts.map +1 -0
- package/lib/commands/translations.js +11 -13
- package/lib/commands/translations.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +109 -239
- package/lib/index.js.map +1 -0
- package/lib/otel.d.ts +2 -1
- package/lib/otel.d.ts.map +1 -0
- package/lib/otel.js +22 -23
- package/lib/otel.js.map +1 -0
- package/lib/reunite/api/api-client.d.ts +4 -3
- package/lib/reunite/api/api-client.d.ts.map +1 -0
- package/lib/reunite/api/api-client.js +14 -20
- package/lib/reunite/api/api-client.js.map +1 -0
- package/lib/reunite/api/api-keys.d.ts +2 -1
- package/lib/reunite/api/api-keys.d.ts.map +1 -0
- package/lib/reunite/api/api-keys.js +4 -20
- package/lib/reunite/api/api-keys.js.map +1 -0
- package/lib/reunite/api/domains.d.ts +5 -2
- package/lib/reunite/api/domains.d.ts.map +1 -0
- package/lib/reunite/api/domains.js +6 -15
- package/lib/reunite/api/domains.js.map +1 -0
- package/lib/reunite/api/index.d.ts +4 -3
- package/lib/reunite/api/index.d.ts.map +1 -0
- package/lib/reunite/api/index.js +4 -19
- package/lib/reunite/api/index.js.map +1 -0
- package/lib/reunite/api/types.d.ts +1 -0
- package/lib/reunite/api/types.d.ts.map +1 -0
- package/lib/reunite/api/types.js +2 -2
- package/lib/reunite/api/types.js.map +1 -0
- package/lib/reunite/commands/push-status.d.ts +6 -5
- package/lib/reunite/commands/push-status.d.ts.map +1 -0
- package/lib/reunite/commands/push-status.js +31 -37
- package/lib/reunite/commands/push-status.js.map +1 -0
- package/lib/reunite/commands/push.d.ts +6 -6
- package/lib/reunite/commands/push.d.ts.map +1 -0
- package/lib/reunite/commands/push.js +31 -40
- package/lib/reunite/commands/push.js.map +1 -0
- package/lib/reunite/commands/utils.d.ts +4 -3
- package/lib/reunite/commands/utils.d.ts.map +1 -0
- package/lib/reunite/commands/utils.js +9 -12
- package/lib/reunite/commands/utils.js.map +1 -0
- package/lib/reunite/utils.d.ts +1 -0
- package/lib/reunite/utils.d.ts.map +1 -0
- package/lib/reunite/utils.js +2 -5
- package/lib/reunite/utils.js.map +1 -0
- package/lib/types.d.ts +15 -27
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -5
- package/lib/types.js.map +1 -0
- package/lib/utils/assert-node-version.d.ts +1 -0
- package/lib/utils/assert-node-version.d.ts.map +1 -0
- package/lib/utils/assert-node-version.js +8 -10
- package/lib/utils/assert-node-version.js.map +1 -0
- package/lib/utils/error.d.ts +4 -0
- package/lib/utils/error.d.ts.map +1 -0
- package/lib/utils/error.js +8 -0
- package/lib/utils/error.js.map +1 -0
- package/lib/utils/fetch-with-timeout.d.ts +1 -0
- package/lib/utils/fetch-with-timeout.d.ts.map +1 -0
- package/lib/utils/fetch-with-timeout.js +6 -8
- package/lib/utils/fetch-with-timeout.js.map +1 -0
- package/lib/utils/{getCommandNameFromArgs.d.ts → get-command-name-from-args.d.ts} +1 -0
- package/lib/utils/get-command-name-from-args.d.ts.map +1 -0
- package/lib/utils/get-command-name-from-args.js +4 -0
- package/lib/utils/get-command-name-from-args.js.map +1 -0
- package/lib/utils/js-utils.d.ts +1 -0
- package/lib/utils/js-utils.d.ts.map +1 -0
- package/lib/utils/js-utils.js +8 -12
- package/lib/utils/js-utils.js.map +1 -0
- package/lib/utils/miscellaneous.d.ts +9 -48
- package/lib/utils/miscellaneous.d.ts.map +1 -0
- package/lib/utils/miscellaneous.js +131 -269
- package/lib/utils/miscellaneous.js.map +1 -0
- package/lib/utils/package.d.ts +2 -0
- package/lib/utils/package.d.ts.map +1 -0
- package/lib/utils/package.js +4 -0
- package/lib/utils/package.js.map +1 -0
- package/lib/utils/platform.d.ts +1 -0
- package/lib/utils/platform.d.ts.map +1 -0
- package/lib/utils/platform.js +5 -9
- package/lib/utils/platform.js.map +1 -0
- package/lib/utils/proxy-agent.d.ts +3 -0
- package/lib/utils/proxy-agent.d.ts.map +1 -0
- package/lib/utils/proxy-agent.js +6 -0
- package/lib/utils/proxy-agent.js.map +1 -0
- package/lib/utils/spinner.d.ts +1 -0
- package/lib/utils/spinner.d.ts.map +1 -0
- package/lib/utils/spinner.js +8 -10
- package/lib/utils/spinner.js.map +1 -0
- package/lib/utils/telemetry.d.ts +40 -0
- package/lib/utils/telemetry.d.ts.map +1 -0
- package/lib/utils/telemetry.js +138 -0
- package/lib/utils/telemetry.js.map +1 -0
- package/lib/utils/update-version-notifier.d.ts +1 -1
- package/lib/utils/update-version-notifier.d.ts.map +1 -0
- package/lib/utils/update-version-notifier.js +35 -38
- package/lib/utils/update-version-notifier.js.map +1 -0
- package/lib/utils/validate-positive-number.d.ts +2 -0
- package/lib/utils/validate-positive-number.d.ts.map +1 -0
- package/lib/utils/validate-positive-number.js +13 -0
- package/lib/utils/validate-positive-number.js.map +1 -0
- package/lib/wrapper.d.ts +3 -3
- package/lib/wrapper.d.ts.map +1 -0
- package/lib/wrapper.js +39 -26
- package/lib/wrapper.js.map +1 -0
- package/package.json +15 -16
- package/CHANGELOG.md +0 -770
- package/lib/__mocks__/@redocly/openapi-core.d.ts +0 -99
- package/lib/__mocks__/@redocly/openapi-core.js +0 -84
- package/lib/__mocks__/documents.d.ts +0 -150
- package/lib/__mocks__/documents.js +0 -123
- package/lib/__mocks__/fs.d.ts +0 -8
- package/lib/__mocks__/fs.js +0 -9
- package/lib/__mocks__/perf_hooks.d.ts +0 -3
- package/lib/__mocks__/perf_hooks.js +0 -6
- package/lib/__mocks__/redoc.d.ts +0 -6
- package/lib/__mocks__/redoc.js +0 -5
- package/lib/__tests__/commands/build-docs.test.d.ts +0 -1
- package/lib/__tests__/commands/build-docs.test.js +0 -54
- package/lib/__tests__/commands/bundle.test.d.ts +0 -1
- package/lib/__tests__/commands/bundle.test.js +0 -235
- package/lib/__tests__/commands/join.test.d.ts +0 -1
- package/lib/__tests__/commands/join.test.js +0 -274
- package/lib/__tests__/commands/lint.test.d.ts +0 -1
- package/lib/__tests__/commands/lint.test.js +0 -149
- package/lib/__tests__/commands/push-region.test.d.ts +0 -1
- package/lib/__tests__/commands/push-region.test.js +0 -90
- package/lib/__tests__/commands/push.test.d.ts +0 -1
- package/lib/__tests__/commands/push.test.js +0 -496
- package/lib/__tests__/fetch-with-timeout.test.d.ts +0 -1
- package/lib/__tests__/fetch-with-timeout.test.js +0 -64
- package/lib/__tests__/fixtures/config.d.ts +0 -21
- package/lib/__tests__/fixtures/config.js +0 -24
- package/lib/__tests__/spinner.test.d.ts +0 -1
- package/lib/__tests__/spinner.test.js +0 -43
- package/lib/__tests__/utils.test.d.ts +0 -1
- package/lib/__tests__/utils.test.js +0 -651
- package/lib/__tests__/wrapper.test.d.ts +0 -1
- package/lib/__tests__/wrapper.test.js +0 -76
- package/lib/auth/__tests__/device-flow.test.d.ts +0 -1
- package/lib/auth/__tests__/device-flow.test.js +0 -62
- package/lib/auth/__tests__/oauth-client.test.d.ts +0 -1
- package/lib/auth/__tests__/oauth-client.test.js +0 -93
- package/lib/commands/preview-docs/index.d.ts +0 -12
- package/lib/commands/preview-docs/index.js +0 -127
- package/lib/commands/preview-docs/preview-server/default.hbs +0 -24
- package/lib/commands/preview-docs/preview-server/hot.js +0 -59
- package/lib/commands/preview-docs/preview-server/oauth2-redirect.html +0 -21
- package/lib/commands/preview-docs/preview-server/preview-server.d.ts +0 -5
- package/lib/commands/preview-docs/preview-server/preview-server.js +0 -113
- package/lib/commands/preview-docs/preview-server/server.d.ts +0 -22
- package/lib/commands/preview-docs/preview-server/server.js +0 -85
- package/lib/commands/push.d.ts +0 -44
- package/lib/commands/push.js +0 -301
- package/lib/commands/split/__tests__/index.test.d.ts +0 -1
- package/lib/commands/split/__tests__/index.test.js +0 -91
- package/lib/reunite/api/__tests__/api-keys.test.d.ts +0 -1
- package/lib/reunite/api/__tests__/api-keys.test.js +0 -26
- package/lib/reunite/api/__tests__/api.client.test.d.ts +0 -1
- package/lib/reunite/api/__tests__/api.client.test.js +0 -337
- package/lib/reunite/api/__tests__/domains.test.d.ts +0 -1
- package/lib/reunite/api/__tests__/domains.test.js +0 -32
- package/lib/reunite/commands/__tests__/push-status.test.d.ts +0 -1
- package/lib/reunite/commands/__tests__/push-status.test.js +0 -563
- package/lib/reunite/commands/__tests__/push.test.d.ts +0 -1
- package/lib/reunite/commands/__tests__/push.test.js +0 -315
- package/lib/reunite/commands/__tests__/utils.test.d.ts +0 -1
- package/lib/reunite/commands/__tests__/utils.test.js +0 -51
- package/lib/utils/__mocks__/miscellaneous.d.ts +0 -43
- package/lib/utils/__mocks__/miscellaneous.js +0 -24
- package/lib/utils/getCommandNameFromArgs.js +0 -6
- package/src/__mocks__/@redocly/openapi-core.ts +0 -88
- package/src/__mocks__/documents.ts +0 -124
- package/src/__mocks__/fs.ts +0 -6
- package/src/__mocks__/perf_hooks.ts +0 -3
- package/src/__mocks__/redoc.ts +0 -2
- package/src/__tests__/commands/build-docs.test.ts +0 -59
- package/src/__tests__/commands/bundle.test.ts +0 -285
- package/src/__tests__/commands/join.test.ts +0 -334
- package/src/__tests__/commands/lint.test.ts +0 -190
- package/src/__tests__/commands/push-region.test.ts +0 -104
- package/src/__tests__/commands/push.test.ts +0 -553
- package/src/__tests__/fetch-with-timeout.test.ts +0 -81
- package/src/__tests__/fixtures/config.ts +0 -21
- package/src/__tests__/fixtures/openapi.json +0 -0
- package/src/__tests__/fixtures/openapi.yaml +0 -0
- package/src/__tests__/fixtures/redocly.yaml +0 -0
- package/src/__tests__/spinner.test.ts +0 -51
- package/src/__tests__/utils.test.ts +0 -781
- package/src/__tests__/wrapper.test.ts +0 -91
- package/src/auth/__tests__/device-flow.test.ts +0 -73
- package/src/auth/__tests__/oauth-client.test.ts +0 -117
- package/src/auth/device-flow.ts +0 -175
- package/src/auth/oauth-client.ts +0 -111
- package/src/commands/auth.ts +0 -66
- package/src/commands/build-docs/index.ts +0 -55
- package/src/commands/build-docs/template.hbs +0 -23
- package/src/commands/build-docs/types.ts +0 -25
- package/src/commands/build-docs/utils.ts +0 -110
- package/src/commands/bundle.ts +0 -154
- package/src/commands/eject.ts +0 -42
- package/src/commands/join.ts +0 -794
- package/src/commands/lint.ts +0 -169
- package/src/commands/preview-docs/index.ts +0 -183
- package/src/commands/preview-docs/preview-server/default.hbs +0 -24
- package/src/commands/preview-docs/preview-server/hot.js +0 -59
- package/src/commands/preview-docs/preview-server/oauth2-redirect.html +0 -21
- package/src/commands/preview-docs/preview-server/preview-server.ts +0 -159
- package/src/commands/preview-docs/preview-server/server.ts +0 -92
- package/src/commands/preview-project/constants.ts +0 -23
- package/src/commands/preview-project/index.ts +0 -71
- package/src/commands/preview-project/types.ts +0 -12
- package/src/commands/push.ts +0 -470
- package/src/commands/split/__tests__/fixtures/samples.json +0 -61
- package/src/commands/split/__tests__/fixtures/spec.json +0 -70
- package/src/commands/split/__tests__/fixtures/webhooks.json +0 -85
- package/src/commands/split/__tests__/index.test.ts +0 -156
- package/src/commands/split/index.ts +0 -397
- package/src/commands/split/types.ts +0 -60
- package/src/commands/stats.ts +0 -140
- package/src/commands/translations.ts +0 -32
- package/src/custom.d.ts +0 -1
- package/src/index.ts +0 -970
- package/src/otel.ts +0 -59
- package/src/reunite/api/__tests__/api-keys.test.ts +0 -37
- package/src/reunite/api/__tests__/api.client.test.ts +0 -452
- package/src/reunite/api/__tests__/domains.test.ts +0 -41
- package/src/reunite/api/api-client.ts +0 -381
- package/src/reunite/api/api-keys.ts +0 -26
- package/src/reunite/api/domains.ts +0 -23
- package/src/reunite/api/index.ts +0 -3
- package/src/reunite/api/types.ts +0 -108
- package/src/reunite/commands/__tests__/push-status.test.ts +0 -653
- package/src/reunite/commands/__tests__/push.test.ts +0 -385
- package/src/reunite/commands/__tests__/utils.test.ts +0 -62
- package/src/reunite/commands/push-status.ts +0 -325
- package/src/reunite/commands/push.ts +0 -235
- package/src/reunite/commands/utils.ts +0 -66
- package/src/reunite/utils.ts +0 -1
- package/src/types.ts +0 -64
- package/src/utils/__mocks__/miscellaneous.ts +0 -24
- package/src/utils/assert-node-version.ts +0 -19
- package/src/utils/fetch-with-timeout.ts +0 -30
- package/src/utils/getCommandNameFromArgs.ts +0 -5
- package/src/utils/js-utils.ts +0 -24
- package/src/utils/miscellaneous.ts +0 -729
- package/src/utils/platform.ts +0 -31
- package/src/utils/spinner.ts +0 -50
- package/src/utils/update-version-notifier.ts +0 -115
- package/src/wrapper.ts +0 -77
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.0.1",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "TEST",
|
|
5
|
-
"description": "TEST",
|
|
6
|
-
"version": "v1",
|
|
7
|
-
"license": {
|
|
8
|
-
"name": "Apache 2.0",
|
|
9
|
-
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"servers": [
|
|
13
|
-
{
|
|
14
|
-
"url": "http://petstore.swagger.io/v1"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"components": {
|
|
18
|
-
"schemas": {
|
|
19
|
-
"Test": {
|
|
20
|
-
"nullable": true
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"paths": {
|
|
25
|
-
"/test": {
|
|
26
|
-
"get": {
|
|
27
|
-
"summary": "test",
|
|
28
|
-
"operationId": "test",
|
|
29
|
-
"responses": {
|
|
30
|
-
"202": {
|
|
31
|
-
"description": "Test",
|
|
32
|
-
"content": {
|
|
33
|
-
"application/json": {
|
|
34
|
-
"schema": {
|
|
35
|
-
"$ref": "#/components/schemas/Test"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"400": {
|
|
41
|
-
"description": "An error response"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"x-codeSamples": [
|
|
45
|
-
{
|
|
46
|
-
"lang": "C#",
|
|
47
|
-
"source": "PetStore.v1.Pet pet = new PetStore.v1.Pet();"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"lang": "C/AL",
|
|
51
|
-
"source": "PetStore.v1.Pet pet = new PetStore.v1.Pet();"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"lang": "Visual Basic",
|
|
55
|
-
"source": "PetStore.v1.Pet pet = new PetStore.v1.Pet();"
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.0.1",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "TEST",
|
|
5
|
-
"description": "TEST",
|
|
6
|
-
"version": "v1",
|
|
7
|
-
"license": {
|
|
8
|
-
"name": "Apache 2.0",
|
|
9
|
-
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"servers": [
|
|
13
|
-
{
|
|
14
|
-
"url": "http://petstore.swagger.io/v1"
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"components": {
|
|
18
|
-
"schemas": {
|
|
19
|
-
"Test": {
|
|
20
|
-
"nullable": true
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"paths": {
|
|
25
|
-
"/test": {
|
|
26
|
-
"get": {
|
|
27
|
-
"summary": "test",
|
|
28
|
-
"operationId": "test",
|
|
29
|
-
"responses": {
|
|
30
|
-
"202": {
|
|
31
|
-
"description": "Test",
|
|
32
|
-
"content": {
|
|
33
|
-
"application/json": {
|
|
34
|
-
"schema": {
|
|
35
|
-
"$ref": "#/components/schemas/Test"
|
|
36
|
-
},
|
|
37
|
-
"example": {}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"400": {
|
|
42
|
-
"description": "An error response"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"x-webhooks": {
|
|
49
|
-
"test": {
|
|
50
|
-
"post": {
|
|
51
|
-
"summary": "New pet",
|
|
52
|
-
"description": "Information about a new pet in the systems",
|
|
53
|
-
"operationId": "newPet",
|
|
54
|
-
"tags": ["pet"],
|
|
55
|
-
"requestBody": {
|
|
56
|
-
"content": {
|
|
57
|
-
"application/json": {
|
|
58
|
-
"schema": { "$ref": "#/components/schemas/Test" }
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"responses": {
|
|
63
|
-
"200": {
|
|
64
|
-
"description": "Return a 200 status to indicate that the data was received successfully"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.1.0",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "Webhook Example",
|
|
5
|
-
"version": "1.0.0"
|
|
6
|
-
},
|
|
7
|
-
"paths": {
|
|
8
|
-
"/pets": {
|
|
9
|
-
"get": {
|
|
10
|
-
"summary": "List all pets",
|
|
11
|
-
"operationId": "listPets",
|
|
12
|
-
"parameters": [
|
|
13
|
-
{
|
|
14
|
-
"name": "limit",
|
|
15
|
-
"in": "query",
|
|
16
|
-
"description": "How many items to return at one time (max 100)",
|
|
17
|
-
"required": false,
|
|
18
|
-
"schema": {
|
|
19
|
-
"type": "integer",
|
|
20
|
-
"format": "int32"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"responses": {
|
|
25
|
-
"200": {
|
|
26
|
-
"description": "A paged array of pets",
|
|
27
|
-
"content": {
|
|
28
|
-
"application/json": {
|
|
29
|
-
"schema": {
|
|
30
|
-
"$ref": "#/components/schemas/Pets"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"webhooks": {
|
|
40
|
-
"test": {
|
|
41
|
-
"post": {
|
|
42
|
-
"requestBody": {
|
|
43
|
-
"description": "Information about a new pet in the system",
|
|
44
|
-
"content": {
|
|
45
|
-
"application/json": {
|
|
46
|
-
"schema": {
|
|
47
|
-
"$ref": "#/components/schemas/Pet"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"responses": {
|
|
53
|
-
"200": {
|
|
54
|
-
"description": "Return a 200 status to indicate that the data was received successfully"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"components": {
|
|
61
|
-
"schemas": {
|
|
62
|
-
"Pet": {
|
|
63
|
-
"required": ["id", "name"],
|
|
64
|
-
"properties": {
|
|
65
|
-
"id": {
|
|
66
|
-
"type": "integer",
|
|
67
|
-
"format": "int64"
|
|
68
|
-
},
|
|
69
|
-
"name": {
|
|
70
|
-
"type": "string"
|
|
71
|
-
},
|
|
72
|
-
"tag": {
|
|
73
|
-
"type": "string"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"Pets": {
|
|
78
|
-
"type": "array",
|
|
79
|
-
"items": {
|
|
80
|
-
"$ref": "#/components/schemas/Pet"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { iteratePathItems, handleSplit } from '../index';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import * as openapiCore from '@redocly/openapi-core';
|
|
4
|
-
import { ComponentsFiles } from '../types';
|
|
5
|
-
import { blue, green } from 'colorette';
|
|
6
|
-
import { loadConfigAndHandleErrors } from '../../../utils/__mocks__/miscellaneous';
|
|
7
|
-
|
|
8
|
-
import type { Config } from '@redocly/openapi-core';
|
|
9
|
-
|
|
10
|
-
const utils = require('../../../utils/miscellaneous');
|
|
11
|
-
|
|
12
|
-
jest.mock('../../../utils/miscellaneous', () => ({
|
|
13
|
-
...jest.requireActual('../../../utils/miscellaneous'),
|
|
14
|
-
writeToFileByExtension: jest.fn(),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
jest.mock('@redocly/openapi-core', () => ({
|
|
18
|
-
...jest.requireActual('@redocly/openapi-core'),
|
|
19
|
-
isRef: jest.fn(),
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
describe('#split', () => {
|
|
23
|
-
const openapiDir = 'test';
|
|
24
|
-
const componentsFiles: ComponentsFiles = {};
|
|
25
|
-
|
|
26
|
-
it('should split the file and show the success message', async () => {
|
|
27
|
-
const filePath = 'packages/cli/src/commands/split/__tests__/fixtures/spec.json';
|
|
28
|
-
jest.spyOn(process.stderr, 'write').mockImplementation(() => true);
|
|
29
|
-
|
|
30
|
-
await handleSplit({
|
|
31
|
-
argv: {
|
|
32
|
-
api: filePath,
|
|
33
|
-
outDir: openapiDir,
|
|
34
|
-
separator: '_',
|
|
35
|
-
},
|
|
36
|
-
config: loadConfigAndHandleErrors() as any as Config,
|
|
37
|
-
version: 'cli-version',
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
expect(process.stderr.write).toBeCalledTimes(2);
|
|
41
|
-
expect((process.stderr.write as jest.Mock).mock.calls[0][0]).toBe(
|
|
42
|
-
`🪓 Document: ${blue(filePath!)} ${green('is successfully split')}
|
|
43
|
-
and all related files are saved to the directory: ${blue(openapiDir)} \n`
|
|
44
|
-
);
|
|
45
|
-
expect((process.stderr.write as jest.Mock).mock.calls[1][0]).toContain(
|
|
46
|
-
`${filePath}: split processed in <test>ms`
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should use the correct separator', async () => {
|
|
51
|
-
const filePath = 'packages/cli/src/commands/split/__tests__/fixtures/spec.json';
|
|
52
|
-
|
|
53
|
-
jest.spyOn(utils, 'pathToFilename').mockImplementation(() => 'newFilePath');
|
|
54
|
-
|
|
55
|
-
await handleSplit({
|
|
56
|
-
argv: {
|
|
57
|
-
api: filePath,
|
|
58
|
-
outDir: openapiDir,
|
|
59
|
-
separator: '_',
|
|
60
|
-
},
|
|
61
|
-
config: loadConfigAndHandleErrors() as any as Config,
|
|
62
|
-
version: 'cli-version',
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
expect(utils.pathToFilename).toBeCalledWith(expect.anything(), '_');
|
|
66
|
-
utils.pathToFilename.mockRestore();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should have correct path with paths', () => {
|
|
70
|
-
const openapi = require('./fixtures/spec.json');
|
|
71
|
-
|
|
72
|
-
jest.spyOn(openapiCore, 'slash').mockImplementation(() => 'paths/test.yaml');
|
|
73
|
-
jest.spyOn(path, 'relative').mockImplementation(() => 'paths/test.yaml');
|
|
74
|
-
iteratePathItems(
|
|
75
|
-
openapi.paths,
|
|
76
|
-
openapiDir,
|
|
77
|
-
path.join(openapiDir, 'paths'),
|
|
78
|
-
componentsFiles,
|
|
79
|
-
'_',
|
|
80
|
-
undefined,
|
|
81
|
-
'yaml'
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
expect(openapiCore.slash).toHaveBeenCalledWith('paths/test.yaml');
|
|
85
|
-
expect(path.relative).toHaveBeenCalledWith('test', 'test/paths/test.yaml');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should have correct path with webhooks', () => {
|
|
89
|
-
const openapi = require('./fixtures/webhooks.json');
|
|
90
|
-
|
|
91
|
-
jest.spyOn(openapiCore, 'slash').mockImplementation(() => 'webhooks/test.yaml');
|
|
92
|
-
jest.spyOn(path, 'relative').mockImplementation(() => 'webhooks/test.yaml');
|
|
93
|
-
iteratePathItems(
|
|
94
|
-
openapi.webhooks,
|
|
95
|
-
openapiDir,
|
|
96
|
-
path.join(openapiDir, 'webhooks'),
|
|
97
|
-
componentsFiles,
|
|
98
|
-
'webhook_',
|
|
99
|
-
undefined,
|
|
100
|
-
'yaml'
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
expect(openapiCore.slash).toHaveBeenCalledWith('webhooks/test.yaml');
|
|
104
|
-
expect(path.relative).toHaveBeenCalledWith('test', 'test/webhooks/test.yaml');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should have correct path with x-webhooks', () => {
|
|
108
|
-
const openapi = require('./fixtures/spec.json');
|
|
109
|
-
|
|
110
|
-
jest.spyOn(openapiCore, 'slash').mockImplementation(() => 'webhooks/test.yaml');
|
|
111
|
-
jest.spyOn(path, 'relative').mockImplementation(() => 'webhooks/test.yaml');
|
|
112
|
-
iteratePathItems(
|
|
113
|
-
openapi['x-webhooks'],
|
|
114
|
-
openapiDir,
|
|
115
|
-
path.join(openapiDir, 'webhooks'),
|
|
116
|
-
componentsFiles,
|
|
117
|
-
'webhook_',
|
|
118
|
-
undefined,
|
|
119
|
-
'yaml'
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
expect(openapiCore.slash).toHaveBeenCalledWith('webhooks/test.yaml');
|
|
123
|
-
expect(path.relative).toHaveBeenCalledWith('test', 'test/webhooks/test.yaml');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('should create correct folder name for code samples', async () => {
|
|
127
|
-
const openapi = require('./fixtures/samples.json');
|
|
128
|
-
|
|
129
|
-
const fs = require('fs');
|
|
130
|
-
jest.spyOn(fs, 'writeFileSync').mockImplementation(() => {});
|
|
131
|
-
|
|
132
|
-
jest.spyOn(utils, 'escapeLanguageName');
|
|
133
|
-
iteratePathItems(
|
|
134
|
-
openapi.paths,
|
|
135
|
-
openapiDir,
|
|
136
|
-
path.join(openapiDir, 'paths'),
|
|
137
|
-
componentsFiles,
|
|
138
|
-
'_',
|
|
139
|
-
undefined,
|
|
140
|
-
'yaml'
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
expect(utils.escapeLanguageName).nthCalledWith(1, 'C#');
|
|
144
|
-
expect(utils.escapeLanguageName).nthReturnedWith(1, 'C_sharp');
|
|
145
|
-
|
|
146
|
-
expect(utils.escapeLanguageName).nthCalledWith(2, 'C/AL');
|
|
147
|
-
expect(utils.escapeLanguageName).nthReturnedWith(2, 'C_AL');
|
|
148
|
-
|
|
149
|
-
expect(utils.escapeLanguageName).nthCalledWith(3, 'Visual Basic');
|
|
150
|
-
expect(utils.escapeLanguageName).nthReturnedWith(3, 'VisualBasic');
|
|
151
|
-
|
|
152
|
-
expect(utils.escapeLanguageName).toBeCalledTimes(3);
|
|
153
|
-
|
|
154
|
-
utils.escapeLanguageName.mockRestore();
|
|
155
|
-
});
|
|
156
|
-
});
|