@redocly/openapi-core 1.0.0-rc.3 → 1.0.1
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/CHANGELOG.md +7 -0
- package/__tests__/utils.ts +88 -0
- package/lib/config/all.js +0 -1
- package/lib/config/minimal.js +0 -1
- package/lib/config/recommended.js +0 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/bundle.test.ts.snap +437 -0
- package/src/__tests__/bundle.test.ts +236 -0
- package/src/__tests__/codeframes.test.ts +530 -0
- package/src/__tests__/fixtures/.redocly.lint-ignore.yaml +5 -0
- package/src/__tests__/fixtures/extension.js +24 -0
- package/src/__tests__/fixtures/refs/definitions.yaml +3 -0
- package/src/__tests__/fixtures/refs/examples.yaml +8 -0
- package/src/__tests__/fixtures/refs/external-request-body.yaml +13 -0
- package/src/__tests__/fixtures/refs/externalref.yaml +35 -0
- package/src/__tests__/fixtures/refs/hosted.yaml +35 -0
- package/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml +21 -0
- package/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml +33 -0
- package/src/__tests__/fixtures/refs/openapi-with-url-refs.yaml +18 -0
- package/src/__tests__/fixtures/refs/param-b.yaml +1 -0
- package/src/__tests__/fixtures/refs/param-c.yaml +1 -0
- package/src/__tests__/fixtures/refs/rename.yaml +1 -0
- package/src/__tests__/fixtures/refs/requestBody.yaml +9 -0
- package/src/__tests__/fixtures/refs/schema-a.yaml +1 -0
- package/src/__tests__/fixtures/refs/simple.yaml +1 -0
- package/src/__tests__/fixtures/refs/vendor.schema.yaml +20 -0
- package/src/__tests__/fixtures/resolve/External.yaml +10 -0
- package/src/__tests__/fixtures/resolve/External2.yaml +4 -0
- package/src/__tests__/fixtures/resolve/description.md +3 -0
- package/src/__tests__/fixtures/resolve/externalInfo.yaml +4 -0
- package/src/__tests__/fixtures/resolve/externalLicense.yaml +1 -0
- package/src/__tests__/fixtures/resolve/openapi-with-back.yaml +13 -0
- package/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml +5 -0
- package/src/__tests__/fixtures/resolve/openapi.yaml +28 -0
- package/src/__tests__/fixtures/resolve/schemas/type-a.yaml +10 -0
- package/src/__tests__/fixtures/resolve/schemas/type-b.yaml +6 -0
- package/src/__tests__/fixtures/resolve/transitive/a.yaml +1 -0
- package/src/__tests__/fixtures/resolve/transitive/components.yaml +5 -0
- package/src/__tests__/fixtures/resolve/transitive/schemas.yaml +3 -0
- package/src/__tests__/format.test.ts +76 -0
- package/src/__tests__/js-yaml.test.ts +73 -0
- package/src/__tests__/lint.test.ts +392 -0
- package/src/__tests__/logger-browser.test.ts +53 -0
- package/src/__tests__/logger.test.ts +47 -0
- package/src/__tests__/login.test.ts +17 -0
- package/src/__tests__/normalizeVisitors.test.ts +151 -0
- package/src/__tests__/output-browser.test.ts +18 -0
- package/src/__tests__/output.test.ts +15 -0
- package/src/__tests__/ref-utils.test.ts +120 -0
- package/src/__tests__/resolve-http.test.ts +77 -0
- package/src/__tests__/resolve.test.ts +431 -0
- package/src/__tests__/utils-browser.test.ts +11 -0
- package/src/__tests__/utils.test.ts +144 -0
- package/src/__tests__/walk.test.ts +1545 -0
- package/src/benchmark/benches/lint-with-many-rules.bench.ts +35 -0
- package/src/benchmark/benches/lint-with-nested-rule.bench.ts +39 -0
- package/src/benchmark/benches/lint-with-no-rules.bench.ts +20 -0
- package/src/benchmark/benches/lint-with-top-level-rule-report.bench.ts +35 -0
- package/src/benchmark/benches/lint-with-top-level-rule.bench.ts +32 -0
- package/src/benchmark/benches/rebilly.yaml +32275 -0
- package/src/benchmark/benches/recommended-oas3.bench.ts +22 -0
- package/src/benchmark/benches/resolve-with-no-external.bench.ts +23 -0
- package/src/benchmark/benchmark.js +311 -0
- package/src/benchmark/colors.js +29 -0
- package/src/benchmark/fork.js +83 -0
- package/src/benchmark/utils.ts +36 -0
- package/src/bundle.ts +417 -0
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +164 -0
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +144 -0
- package/src/config/__tests__/config-resolvers.test.ts +491 -0
- package/src/config/__tests__/config.test.ts +312 -0
- package/src/config/__tests__/fixtures/ingore-file.ts +8 -0
- package/src/config/__tests__/fixtures/load-redocly.yaml +2 -0
- package/src/config/__tests__/fixtures/plugin-config.yaml +2 -0
- package/src/config/__tests__/fixtures/plugin.js +56 -0
- package/src/config/__tests__/fixtures/resolve-config/api/nested-config.yaml +11 -0
- package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +69 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-circular.yaml +7 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-custom-function.yaml +17 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-file.yaml +18 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-wrong-custom-function.yaml +15 -0
- package/src/config/__tests__/fixtures/resolve-config/local-config.yaml +9 -0
- package/src/config/__tests__/fixtures/resolve-config/plugin.js +80 -0
- package/src/config/__tests__/fixtures/resolve-remote-configs/nested-remote-config.yaml +3 -0
- package/src/config/__tests__/fixtures/resolve-remote-configs/remote-config.yaml +4 -0
- package/src/config/__tests__/load.test.ts +167 -0
- package/src/config/__tests__/resolve-plugins.test.ts +27 -0
- package/src/config/__tests__/utils.test.ts +204 -0
- package/src/config/all.ts +74 -0
- package/src/config/builtIn.ts +37 -0
- package/src/config/config-resolvers.ts +474 -0
- package/src/config/config.ts +332 -0
- package/src/config/index.ts +7 -0
- package/src/config/load.ts +144 -0
- package/src/config/minimal.ts +61 -0
- package/src/config/recommended.ts +61 -0
- package/src/config/rules.ts +54 -0
- package/src/config/types.ts +231 -0
- package/src/config/utils.ts +349 -0
- package/src/decorators/__tests__/filter-in.test.ts +310 -0
- package/src/decorators/__tests__/filter-out.test.ts +335 -0
- package/src/decorators/__tests__/media-type-examples-override.test.ts +665 -0
- package/src/decorators/__tests__/remove-x-internal.test.ts +316 -0
- package/src/decorators/__tests__/resources/request.yaml +3 -0
- package/src/decorators/__tests__/resources/response.yaml +3 -0
- package/src/decorators/common/filters/filter-helper.ts +72 -0
- package/src/decorators/common/filters/filter-in.ts +18 -0
- package/src/decorators/common/filters/filter-out.ts +18 -0
- package/src/decorators/common/info-description-override.ts +24 -0
- package/src/decorators/common/info-override.ts +15 -0
- package/src/decorators/common/media-type-examples-override.ts +79 -0
- package/src/decorators/common/operation-description-override.ts +30 -0
- package/src/decorators/common/registry-dependencies.ts +25 -0
- package/src/decorators/common/remove-x-internal.ts +59 -0
- package/src/decorators/common/tag-description-override.ts +25 -0
- package/src/decorators/oas2/index.ts +20 -0
- package/src/decorators/oas3/index.ts +22 -0
- package/src/env.ts +5 -0
- package/src/format/codeframes.ts +216 -0
- package/src/format/format.ts +375 -0
- package/src/index.ts +71 -0
- package/src/js-yaml/index.ts +14 -0
- package/src/lint.ts +148 -0
- package/src/logger.ts +34 -0
- package/src/oas-types.ts +57 -0
- package/src/output.ts +7 -0
- package/src/redocly/__tests__/redocly-client.test.ts +146 -0
- package/src/redocly/index.ts +187 -0
- package/src/redocly/redocly-client-types.ts +10 -0
- package/src/redocly/registry-api-types.ts +32 -0
- package/src/redocly/registry-api.ts +150 -0
- package/src/ref-utils.ts +85 -0
- package/src/resolve.ts +417 -0
- package/src/rules/__tests__/fixtures/code-sample.php +9 -0
- package/src/rules/__tests__/fixtures/invalid-yaml.yaml +1 -0
- package/src/rules/__tests__/fixtures/ref.yaml +1 -0
- package/src/rules/__tests__/no-unresolved-refs.test.ts +257 -0
- package/src/rules/__tests__/utils.test.ts +160 -0
- package/src/rules/ajv.ts +102 -0
- package/src/rules/common/__tests__/info-license.test.ts +62 -0
- package/src/rules/common/__tests__/license-url.test.ts +63 -0
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +96 -0
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +210 -0
- package/src/rules/common/__tests__/no-identical-paths.test.ts +58 -0
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +85 -0
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +192 -0
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +231 -0
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +76 -0
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +45 -0
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +167 -0
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +72 -0
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +95 -0
- package/src/rules/common/__tests__/path-not-include-query.test.ts +64 -0
- package/src/rules/common/__tests__/path-params-defined.test.ts +202 -0
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +108 -0
- package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +264 -0
- package/src/rules/common/__tests__/security-defined.test.ts +175 -0
- package/src/rules/common/__tests__/spec-strict-refs.test.ts +69 -0
- package/src/rules/common/__tests__/spec.test.ts +610 -0
- package/src/rules/common/__tests__/tag-description.test.ts +65 -0
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +64 -0
- package/src/rules/common/assertions/__tests__/asserts.test.ts +869 -0
- package/src/rules/common/assertions/__tests__/index.test.ts +100 -0
- package/src/rules/common/assertions/__tests__/utils.test.ts +236 -0
- package/src/rules/common/assertions/asserts.ts +357 -0
- package/src/rules/common/assertions/index.ts +53 -0
- package/src/rules/common/assertions/utils.ts +331 -0
- package/src/rules/common/info-contact.ts +15 -0
- package/src/rules/common/info-license-url.ts +10 -0
- package/src/rules/common/info-license.ts +15 -0
- package/src/rules/common/no-ambiguous-paths.ts +50 -0
- package/src/rules/common/no-enum-type-mismatch.ts +52 -0
- package/src/rules/common/no-http-verbs-in-paths.ts +36 -0
- package/src/rules/common/no-identical-paths.ts +24 -0
- package/src/rules/common/no-invalid-parameter-examples.ts +36 -0
- package/src/rules/common/no-invalid-schema-examples.ts +27 -0
- package/src/rules/common/no-path-trailing-slash.ts +15 -0
- package/src/rules/common/operation-2xx-response.ts +24 -0
- package/src/rules/common/operation-4xx-response.ts +24 -0
- package/src/rules/common/operation-description.ts +13 -0
- package/src/rules/common/operation-operationId-unique.ts +21 -0
- package/src/rules/common/operation-operationId-url-safe.ts +19 -0
- package/src/rules/common/operation-operationId.ts +17 -0
- package/src/rules/common/operation-parameters-unique.ts +48 -0
- package/src/rules/common/operation-singular-tag.ts +17 -0
- package/src/rules/common/operation-summary.ts +13 -0
- package/src/rules/common/operation-tag-defined.ts +26 -0
- package/src/rules/common/parameter-description.ts +22 -0
- package/src/rules/common/path-declaration-must-exist.ts +15 -0
- package/src/rules/common/path-excludes-patterns.ts +23 -0
- package/src/rules/common/path-http-verbs-order.ts +30 -0
- package/src/rules/common/path-not-include-query.ts +17 -0
- package/src/rules/common/path-params-defined.ts +65 -0
- package/src/rules/common/path-segment-plural.ts +31 -0
- package/src/rules/common/paths-kebab-case.ts +19 -0
- package/src/rules/common/required-string-property-missing-min-length.ts +44 -0
- package/src/rules/common/response-contains-header.ts +35 -0
- package/src/rules/common/scalar-property-missing-example.ts +58 -0
- package/src/rules/common/security-defined.ts +65 -0
- package/src/rules/common/spec-strict-refs.ts +30 -0
- package/src/rules/common/spec.ts +175 -0
- package/src/rules/common/tag-description.ts +10 -0
- package/src/rules/common/tags-alphabetical.ts +20 -0
- package/src/rules/no-unresolved-refs.ts +51 -0
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +110 -0
- package/src/rules/oas2/__tests__/response-contains-header.test.ts +174 -0
- package/src/rules/oas2/__tests__/response-contains-property.test.ts +155 -0
- package/src/rules/oas2/__tests__/spec/fixtures/description.md +1 -0
- package/src/rules/oas2/__tests__/spec/info.test.ts +355 -0
- package/src/rules/oas2/__tests__/spec/operation.test.ts +123 -0
- package/src/rules/oas2/__tests__/spec/paths.test.ts +245 -0
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +35 -0
- package/src/rules/oas2/__tests__/spec/utils.ts +32 -0
- package/src/rules/oas2/boolean-parameter-prefixes.ts +26 -0
- package/src/rules/oas2/index.ts +91 -0
- package/src/rules/oas2/remove-unused-components.ts +81 -0
- package/src/rules/oas2/request-mime-type.ts +16 -0
- package/src/rules/oas2/response-contains-property.ts +36 -0
- package/src/rules/oas2/response-mime-type.ts +16 -0
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +111 -0
- package/src/rules/oas3/__tests__/component-name-unique.test.ts +823 -0
- package/src/rules/oas3/__tests__/fixtures/common.yaml +11 -0
- package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +205 -0
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +65 -0
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +473 -0
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +60 -0
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +79 -0
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +131 -0
- package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +145 -0
- package/src/rules/oas3/__tests__/response-contains-header.test.ts +389 -0
- package/src/rules/oas3/__tests__/response-contains-property.test.ts +403 -0
- package/src/rules/oas3/__tests__/spec/callbacks.test.ts +41 -0
- package/src/rules/oas3/__tests__/spec/fixtures/description.md +1 -0
- package/src/rules/oas3/__tests__/spec/info.test.ts +391 -0
- package/src/rules/oas3/__tests__/spec/operation.test.ts +253 -0
- package/src/rules/oas3/__tests__/spec/paths.test.ts +284 -0
- package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +77 -0
- package/src/rules/oas3/__tests__/spec/servers.test.ts +505 -0
- package/src/rules/oas3/__tests__/spec/spec.test.ts +298 -0
- package/src/rules/oas3/__tests__/spec/utils.ts +32 -0
- package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +276 -0
- package/src/rules/oas3/__tests__/utils/lint-document-for-test.ts +23 -0
- package/src/rules/oas3/boolean-parameter-prefixes.ts +28 -0
- package/src/rules/oas3/component-name-unique.ts +158 -0
- package/src/rules/oas3/index.ts +113 -0
- package/src/rules/oas3/no-empty-servers.ts +22 -0
- package/src/rules/oas3/no-example-value-and-externalValue.ts +14 -0
- package/src/rules/oas3/no-invalid-media-type-examples.ts +49 -0
- package/src/rules/oas3/no-server-example.com.ts +14 -0
- package/src/rules/oas3/no-server-trailing-slash.ts +15 -0
- package/src/rules/oas3/no-server-variables-empty-enum.ts +66 -0
- package/src/rules/oas3/no-undefined-server-variable.ts +30 -0
- package/src/rules/oas3/no-unused-components.ts +75 -0
- package/src/rules/oas3/operation-4xx-problem-details-rfc7807.ts +35 -0
- package/src/rules/oas3/remove-unused-components.ts +95 -0
- package/src/rules/oas3/request-mime-type.ts +30 -0
- package/src/rules/oas3/response-contains-property.ts +38 -0
- package/src/rules/oas3/response-mime-type.ts +30 -0
- package/src/rules/oas3/spec-components-invalid-map-name.ts +69 -0
- package/src/rules/other/stats.ts +73 -0
- package/src/rules/utils.ts +193 -0
- package/src/types/config-external-schemas.ts +917 -0
- package/src/types/index.ts +149 -0
- package/src/types/oas2.ts +478 -0
- package/src/types/oas3.ts +597 -0
- package/src/types/oas3_1.ts +258 -0
- package/src/types/redocly-yaml.ts +1040 -0
- package/src/typings/common.ts +17 -0
- package/src/typings/openapi.ts +298 -0
- package/src/typings/swagger.ts +236 -0
- package/src/utils.ts +276 -0
- package/src/visitors.ts +491 -0
- package/src/walk.ts +439 -0
- package/tsconfig.json +8 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
import {
|
|
2
|
+
devOnboardingConfigSchema,
|
|
3
|
+
i18nConfigSchema,
|
|
4
|
+
mockServerConfigSchema,
|
|
5
|
+
rbacConfigSchema,
|
|
6
|
+
redirectConfigSchema,
|
|
7
|
+
responseHeaderSchema,
|
|
8
|
+
seoConfigSchema,
|
|
9
|
+
ssoConfigSchema,
|
|
10
|
+
themeConfigSchema,
|
|
11
|
+
} from './config-external-schemas';
|
|
12
|
+
import { NodeType, listOf } from '.';
|
|
13
|
+
import { omitObjectProps, pickObjectProps, isCustomRuleId } from '../utils';
|
|
14
|
+
|
|
15
|
+
const builtInRulesList = [
|
|
16
|
+
'spec',
|
|
17
|
+
'info-contact',
|
|
18
|
+
'info-license',
|
|
19
|
+
'info-license-url',
|
|
20
|
+
'operation-2xx-response',
|
|
21
|
+
'operation-4xx-response',
|
|
22
|
+
'operation-4xx-problem-details-rfc7807',
|
|
23
|
+
'assertions',
|
|
24
|
+
'operation-operationId-unique',
|
|
25
|
+
'operation-parameters-unique',
|
|
26
|
+
'path-parameters-defined',
|
|
27
|
+
'operation-tag-defined',
|
|
28
|
+
'no-example-value-and-externalValue',
|
|
29
|
+
'no-enum-type-mismatch',
|
|
30
|
+
'no-path-trailing-slash',
|
|
31
|
+
'no-empty-servers',
|
|
32
|
+
'path-declaration-must-exist',
|
|
33
|
+
'operation-operationId-url-safe',
|
|
34
|
+
'operation-operationId',
|
|
35
|
+
'operation-summary',
|
|
36
|
+
'tags-alphabetical',
|
|
37
|
+
'no-server-example.com',
|
|
38
|
+
'no-server-trailing-slash',
|
|
39
|
+
'tag-description',
|
|
40
|
+
'operation-description',
|
|
41
|
+
'no-unused-components',
|
|
42
|
+
'path-not-include-query',
|
|
43
|
+
'path-params-defined',
|
|
44
|
+
'parameter-description',
|
|
45
|
+
'operation-singular-tag',
|
|
46
|
+
'security-defined',
|
|
47
|
+
'no-unresolved-refs',
|
|
48
|
+
'paths-kebab-case',
|
|
49
|
+
'boolean-parameter-prefixes',
|
|
50
|
+
'path-http-verbs-order',
|
|
51
|
+
'no-invalid-media-type-examples',
|
|
52
|
+
'no-identical-paths',
|
|
53
|
+
'no-ambiguous-paths',
|
|
54
|
+
'no-undefined-server-variable',
|
|
55
|
+
'no-server-variables-empty-enum',
|
|
56
|
+
'no-http-verbs-in-paths',
|
|
57
|
+
'path-excludes-patterns',
|
|
58
|
+
'request-mime-type',
|
|
59
|
+
'response-mime-type',
|
|
60
|
+
'path-segment-plural',
|
|
61
|
+
'no-invalid-schema-examples',
|
|
62
|
+
'no-invalid-parameter-examples',
|
|
63
|
+
'response-contains-header',
|
|
64
|
+
'response-contains-property',
|
|
65
|
+
'scalar-property-missing-example',
|
|
66
|
+
'spec-components-invalid-map-name',
|
|
67
|
+
'required-string-property-missing-min-length',
|
|
68
|
+
'spec-strict-refs',
|
|
69
|
+
'component-name-unique',
|
|
70
|
+
];
|
|
71
|
+
const nodeTypesList = [
|
|
72
|
+
'any',
|
|
73
|
+
'Root',
|
|
74
|
+
'Tag',
|
|
75
|
+
'TagList',
|
|
76
|
+
'ExternalDocs',
|
|
77
|
+
'Server',
|
|
78
|
+
'ServerList',
|
|
79
|
+
'ServerVariable',
|
|
80
|
+
'ServerVariablesMap',
|
|
81
|
+
'SecurityRequirement',
|
|
82
|
+
'SecurityRequirementList',
|
|
83
|
+
'Info',
|
|
84
|
+
'Contact',
|
|
85
|
+
'License',
|
|
86
|
+
'Paths',
|
|
87
|
+
'PathItem',
|
|
88
|
+
'Parameter',
|
|
89
|
+
'ParameterList',
|
|
90
|
+
'Operation',
|
|
91
|
+
'Callback',
|
|
92
|
+
'CallbacksMap',
|
|
93
|
+
'RequestBody',
|
|
94
|
+
'MediaTypesMap',
|
|
95
|
+
'MediaType',
|
|
96
|
+
'Example',
|
|
97
|
+
'ExamplesMap',
|
|
98
|
+
'Encoding',
|
|
99
|
+
'EncodingMap',
|
|
100
|
+
'Header',
|
|
101
|
+
'HeadersMap',
|
|
102
|
+
'Responses',
|
|
103
|
+
'Response',
|
|
104
|
+
'Link',
|
|
105
|
+
'LinksMap',
|
|
106
|
+
'Schema',
|
|
107
|
+
'Xml',
|
|
108
|
+
'SchemaProperties',
|
|
109
|
+
'DiscriminatorMapping',
|
|
110
|
+
'Discriminator',
|
|
111
|
+
'Components',
|
|
112
|
+
'NamedSchemas',
|
|
113
|
+
'NamedResponses',
|
|
114
|
+
'NamedParameters',
|
|
115
|
+
'NamedExamples',
|
|
116
|
+
'NamedRequestBodies',
|
|
117
|
+
'NamedHeaders',
|
|
118
|
+
'NamedSecuritySchemes',
|
|
119
|
+
'NamedLinks',
|
|
120
|
+
'NamedCallbacks',
|
|
121
|
+
'ImplicitFlow',
|
|
122
|
+
'PasswordFlow',
|
|
123
|
+
'ClientCredentials',
|
|
124
|
+
'AuthorizationCode',
|
|
125
|
+
'OAuth2Flows',
|
|
126
|
+
'SecurityScheme',
|
|
127
|
+
'XCodeSample',
|
|
128
|
+
'XCodeSampleList',
|
|
129
|
+
'WebhooksMap',
|
|
130
|
+
'SpecExtension',
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
const ConfigStyleguide: NodeType = {
|
|
134
|
+
properties: {
|
|
135
|
+
extends: {
|
|
136
|
+
type: 'array',
|
|
137
|
+
items: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
rules: 'Rules',
|
|
142
|
+
oas2Rules: 'Rules',
|
|
143
|
+
oas3_0Rules: 'Rules',
|
|
144
|
+
oas3_1Rules: 'Rules',
|
|
145
|
+
preprocessors: { type: 'object' },
|
|
146
|
+
oas2Preprocessors: { type: 'object' },
|
|
147
|
+
oas3_0Preprocessors: { type: 'object' },
|
|
148
|
+
oas3_1Preprocessors: { type: 'object' },
|
|
149
|
+
decorators: { type: 'object' },
|
|
150
|
+
oas2Decorators: { type: 'object' },
|
|
151
|
+
oas3_0Decorators: { type: 'object' },
|
|
152
|
+
oas3_1Decorators: { type: 'object' },
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const RootConfigStyleguide: NodeType = {
|
|
157
|
+
properties: {
|
|
158
|
+
plugins: {
|
|
159
|
+
type: 'array',
|
|
160
|
+
items: { type: 'string' },
|
|
161
|
+
},
|
|
162
|
+
...ConfigStyleguide.properties,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const ConfigRoot: NodeType = {
|
|
167
|
+
properties: {
|
|
168
|
+
organization: { type: 'string' },
|
|
169
|
+
apis: 'ConfigApis',
|
|
170
|
+
...RootConfigStyleguide.properties,
|
|
171
|
+
theme: 'ConfigRootTheme',
|
|
172
|
+
'features.openapi': 'ConfigReferenceDocs', // deprecated
|
|
173
|
+
'features.mockServer': 'ConfigMockServer', // deprecated
|
|
174
|
+
region: { enum: ['us', 'eu'] },
|
|
175
|
+
telemetry: { enum: ['on', 'off'] },
|
|
176
|
+
resolve: {
|
|
177
|
+
properties: {
|
|
178
|
+
http: 'ConfigHTTP',
|
|
179
|
+
doNotResolveExamples: { type: 'boolean' },
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
files: {
|
|
183
|
+
type: 'array',
|
|
184
|
+
items: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
redirects: { type: 'object', additionalProperties: redirectConfigSchema },
|
|
189
|
+
licenseKey: { type: 'string' },
|
|
190
|
+
seo: seoConfigSchema,
|
|
191
|
+
rbac: rbacConfigSchema,
|
|
192
|
+
responseHeaders: responseHeaderSchema,
|
|
193
|
+
mockServer: mockServerConfigSchema,
|
|
194
|
+
sso: ssoConfigSchema,
|
|
195
|
+
developerOnboarding: devOnboardingConfigSchema,
|
|
196
|
+
i18n: i18nConfigSchema,
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const ConfigApis: NodeType = {
|
|
201
|
+
properties: {},
|
|
202
|
+
additionalProperties: 'ConfigApisProperties',
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const ConfigApisProperties: NodeType = {
|
|
206
|
+
properties: {
|
|
207
|
+
root: { type: 'string' },
|
|
208
|
+
labels: {
|
|
209
|
+
type: 'array',
|
|
210
|
+
items: {
|
|
211
|
+
type: 'string',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
lint: 'ConfigStyleguide', // deprecated
|
|
215
|
+
styleguide: 'ConfigStyleguide', // deprecated
|
|
216
|
+
...ConfigStyleguide.properties,
|
|
217
|
+
'features.openapi': 'ConfigReferenceDocs', // deprecated
|
|
218
|
+
'features.mockServer': 'ConfigMockServer', // deprecated
|
|
219
|
+
theme: 'ConfigRootTheme',
|
|
220
|
+
files: {
|
|
221
|
+
type: 'array',
|
|
222
|
+
items: {
|
|
223
|
+
type: 'string',
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
title: { type: 'string' },
|
|
227
|
+
rbac: { type: 'object' },
|
|
228
|
+
metadata: { type: 'object' },
|
|
229
|
+
},
|
|
230
|
+
required: ['root'],
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const ConfigHTTP: NodeType = {
|
|
234
|
+
properties: {
|
|
235
|
+
headers: {
|
|
236
|
+
type: 'array',
|
|
237
|
+
items: {
|
|
238
|
+
type: 'string',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const ConfigRootTheme: NodeType = {
|
|
245
|
+
properties: {
|
|
246
|
+
...themeConfigSchema.properties,
|
|
247
|
+
openapi: 'ConfigReferenceDocs',
|
|
248
|
+
mockServer: 'ConfigMockServer',
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const Rules: NodeType = {
|
|
253
|
+
properties: {},
|
|
254
|
+
additionalProperties: (value: unknown, key: string) => {
|
|
255
|
+
if (key.startsWith('rule/')) {
|
|
256
|
+
return 'Assert';
|
|
257
|
+
} else if (key.startsWith('assert/')) {
|
|
258
|
+
// keep the old assert/ prefix as an alias
|
|
259
|
+
return 'Assert';
|
|
260
|
+
} else if (builtInRulesList.includes(key) || isCustomRuleId(key)) {
|
|
261
|
+
if (typeof value === 'string') {
|
|
262
|
+
return { enum: ['error', 'warn', 'off'] };
|
|
263
|
+
} else {
|
|
264
|
+
return 'ObjectRule';
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Otherwise is considered as invalid
|
|
268
|
+
return;
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const ObjectRule: NodeType = {
|
|
273
|
+
properties: {
|
|
274
|
+
severity: { enum: ['error', 'warn', 'off'] },
|
|
275
|
+
},
|
|
276
|
+
additionalProperties: {},
|
|
277
|
+
required: ['severity'],
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const AssertionDefinitionSubject: NodeType = {
|
|
281
|
+
properties: {
|
|
282
|
+
type: { enum: nodeTypesList },
|
|
283
|
+
property: (value: unknown) => {
|
|
284
|
+
if (Array.isArray(value)) {
|
|
285
|
+
return { type: 'array', items: { type: 'string' } };
|
|
286
|
+
} else if (value === null) {
|
|
287
|
+
return null;
|
|
288
|
+
} else {
|
|
289
|
+
return { type: 'string' };
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
filterInParentKeys: { type: 'array', items: { type: 'string' } },
|
|
293
|
+
filterOutParentKeys: { type: 'array', items: { type: 'string' } },
|
|
294
|
+
matchParentKeys: { type: 'string' },
|
|
295
|
+
},
|
|
296
|
+
required: ['type'],
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const AssertionDefinitionAssertions: NodeType = {
|
|
300
|
+
properties: {
|
|
301
|
+
enum: { type: 'array', items: { type: 'string' } },
|
|
302
|
+
pattern: { type: 'string' },
|
|
303
|
+
notPattern: { type: 'string' },
|
|
304
|
+
casing: {
|
|
305
|
+
enum: [
|
|
306
|
+
'camelCase',
|
|
307
|
+
'kebab-case',
|
|
308
|
+
'snake_case',
|
|
309
|
+
'PascalCase',
|
|
310
|
+
'MACRO_CASE',
|
|
311
|
+
'COBOL-CASE',
|
|
312
|
+
'flatcase',
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
mutuallyExclusive: { type: 'array', items: { type: 'string' } },
|
|
316
|
+
mutuallyRequired: { type: 'array', items: { type: 'string' } },
|
|
317
|
+
required: { type: 'array', items: { type: 'string' } },
|
|
318
|
+
requireAny: { type: 'array', items: { type: 'string' } },
|
|
319
|
+
disallowed: { type: 'array', items: { type: 'string' } },
|
|
320
|
+
defined: { type: 'boolean' },
|
|
321
|
+
// undefined: { type: 'boolean' }, // TODO: Remove `undefined` assertion from codebase overall
|
|
322
|
+
nonEmpty: { type: 'boolean' },
|
|
323
|
+
minLength: { type: 'integer' },
|
|
324
|
+
maxLength: { type: 'integer' },
|
|
325
|
+
ref: (value: string | boolean) =>
|
|
326
|
+
typeof value === 'string' ? { type: 'string' } : { type: 'boolean' },
|
|
327
|
+
const: (value: string | boolean | number) => {
|
|
328
|
+
if (typeof value === 'string') {
|
|
329
|
+
return { type: 'string' };
|
|
330
|
+
}
|
|
331
|
+
if (typeof value === 'number') {
|
|
332
|
+
return { type: 'number' };
|
|
333
|
+
}
|
|
334
|
+
if (typeof value === 'boolean') {
|
|
335
|
+
return { type: 'boolean' };
|
|
336
|
+
} else {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
additionalProperties: (_value: unknown, key: string) => {
|
|
342
|
+
if (/^\w+\/\w+$/.test(key)) return { type: 'object' };
|
|
343
|
+
return;
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const AssertDefinition: NodeType = {
|
|
348
|
+
properties: {
|
|
349
|
+
subject: 'AssertionDefinitionSubject',
|
|
350
|
+
assertions: 'AssertionDefinitionAssertions',
|
|
351
|
+
},
|
|
352
|
+
required: ['subject', 'assertions'],
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const Assert: NodeType = {
|
|
356
|
+
properties: {
|
|
357
|
+
subject: 'AssertionDefinitionSubject',
|
|
358
|
+
assertions: 'AssertionDefinitionAssertions',
|
|
359
|
+
where: listOf('AssertDefinition'),
|
|
360
|
+
message: { type: 'string' },
|
|
361
|
+
suggest: { type: 'array', items: { type: 'string' } },
|
|
362
|
+
severity: { enum: ['error', 'warn', 'off'] },
|
|
363
|
+
},
|
|
364
|
+
required: ['subject', 'assertions'],
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const ConfigLanguage: NodeType = {
|
|
368
|
+
properties: {
|
|
369
|
+
label: { type: 'string' },
|
|
370
|
+
lang: {
|
|
371
|
+
enum: [
|
|
372
|
+
'curl',
|
|
373
|
+
'C#',
|
|
374
|
+
'Go',
|
|
375
|
+
'Java',
|
|
376
|
+
'Java8+Apache',
|
|
377
|
+
'JavaScript',
|
|
378
|
+
'Node.js',
|
|
379
|
+
'PHP',
|
|
380
|
+
'Python',
|
|
381
|
+
'R',
|
|
382
|
+
'Ruby',
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
required: ['lang'],
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const ConfigLabels: NodeType = {
|
|
390
|
+
properties: {
|
|
391
|
+
enum: { type: 'string' },
|
|
392
|
+
enumSingleValue: { type: 'string' },
|
|
393
|
+
enumArray: { type: 'string' },
|
|
394
|
+
default: { type: 'string' },
|
|
395
|
+
deprecated: { type: 'string' },
|
|
396
|
+
example: { type: 'string' },
|
|
397
|
+
examples: { type: 'string' },
|
|
398
|
+
nullable: { type: 'string' },
|
|
399
|
+
recursive: { type: 'string' },
|
|
400
|
+
arrayOf: { type: 'string' },
|
|
401
|
+
webhook: { type: 'string' },
|
|
402
|
+
authorizations: { type: 'string' },
|
|
403
|
+
tryItAuthBasicUsername: { type: 'string' },
|
|
404
|
+
tryItAuthBasicPassword: { type: 'string' },
|
|
405
|
+
},
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const ConfigSidebarLinks: NodeType = {
|
|
409
|
+
properties: {
|
|
410
|
+
beforeInfo: listOf('CommonConfigSidebarLinks'),
|
|
411
|
+
end: listOf('CommonConfigSidebarLinks'),
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
const CommonConfigSidebarLinks: NodeType = {
|
|
416
|
+
properties: {
|
|
417
|
+
label: { type: 'string' },
|
|
418
|
+
link: { type: 'string' },
|
|
419
|
+
target: { type: 'string' },
|
|
420
|
+
},
|
|
421
|
+
required: ['label', 'link'],
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const CommonThemeColors: NodeType = {
|
|
425
|
+
properties: {
|
|
426
|
+
main: { type: 'string' },
|
|
427
|
+
light: { type: 'string' },
|
|
428
|
+
dark: { type: 'string' },
|
|
429
|
+
contrastText: { type: 'string' },
|
|
430
|
+
},
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const CommonColorProps: NodeType = {
|
|
434
|
+
properties: {
|
|
435
|
+
backgroundColor: { type: 'string' },
|
|
436
|
+
borderColor: { type: 'string' },
|
|
437
|
+
color: { type: 'string' },
|
|
438
|
+
tabTextColor: { type: 'string' },
|
|
439
|
+
},
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
const BorderThemeColors: NodeType = {
|
|
443
|
+
properties: pickObjectProps(CommonThemeColors.properties, ['light', 'dark']),
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const HttpColors: NodeType = {
|
|
447
|
+
properties: {
|
|
448
|
+
basic: { type: 'string' },
|
|
449
|
+
delete: { type: 'string' },
|
|
450
|
+
get: { type: 'string' },
|
|
451
|
+
head: { type: 'string' },
|
|
452
|
+
link: { type: 'string' },
|
|
453
|
+
options: { type: 'string' },
|
|
454
|
+
patch: { type: 'string' },
|
|
455
|
+
post: { type: 'string' },
|
|
456
|
+
put: { type: 'string' },
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
const ResponseColors: NodeType = {
|
|
461
|
+
properties: {
|
|
462
|
+
error: 'CommonColorProps',
|
|
463
|
+
info: 'CommonColorProps',
|
|
464
|
+
redirect: 'CommonColorProps',
|
|
465
|
+
success: 'CommonColorProps',
|
|
466
|
+
},
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
const SecondaryColors: NodeType = {
|
|
470
|
+
properties: omitObjectProps(CommonThemeColors.properties, ['dark']),
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const TextThemeColors: NodeType = {
|
|
474
|
+
properties: {
|
|
475
|
+
primary: { type: 'string' },
|
|
476
|
+
secondary: { type: 'string' },
|
|
477
|
+
light: { type: 'string' },
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const ThemeColors: NodeType = {
|
|
482
|
+
properties: {
|
|
483
|
+
accent: 'CommonThemeColors',
|
|
484
|
+
border: 'BorderThemeColors',
|
|
485
|
+
error: 'CommonThemeColors',
|
|
486
|
+
http: 'HttpColors',
|
|
487
|
+
primary: 'CommonThemeColors',
|
|
488
|
+
responses: 'ResponseColors',
|
|
489
|
+
secondary: 'SecondaryColors',
|
|
490
|
+
success: 'CommonThemeColors',
|
|
491
|
+
text: 'TextThemeColors',
|
|
492
|
+
tonalOffset: { type: 'number' },
|
|
493
|
+
warning: 'CommonThemeColors',
|
|
494
|
+
},
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
const SizeProps: NodeType = {
|
|
498
|
+
properties: {
|
|
499
|
+
fontSize: { type: 'string' },
|
|
500
|
+
padding: { type: 'string' },
|
|
501
|
+
minWidth: { type: 'string' },
|
|
502
|
+
},
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
const Sizes: NodeType = {
|
|
506
|
+
properties: {
|
|
507
|
+
small: 'SizeProps',
|
|
508
|
+
medium: 'SizeProps',
|
|
509
|
+
large: 'SizeProps',
|
|
510
|
+
xlarge: 'SizeProps',
|
|
511
|
+
},
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
const FontConfig: NodeType = {
|
|
515
|
+
properties: {
|
|
516
|
+
fontFamily: { type: 'string' },
|
|
517
|
+
fontSize: { type: 'string' },
|
|
518
|
+
fontWeight: { type: 'string' },
|
|
519
|
+
lineHeight: { type: 'string' },
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
const ButtonsConfig: NodeType = {
|
|
524
|
+
properties: {
|
|
525
|
+
...omitObjectProps(FontConfig.properties, ['fontSize', 'lineHeight']),
|
|
526
|
+
borderRadius: { type: 'string' },
|
|
527
|
+
hoverStyle: { type: 'string' },
|
|
528
|
+
boxShadow: { type: 'string' },
|
|
529
|
+
hoverBoxShadow: { type: 'string' },
|
|
530
|
+
sizes: 'Sizes',
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
const BadgeFontConfig: NodeType = {
|
|
535
|
+
properties: pickObjectProps(FontConfig.properties, ['fontSize', 'lineHeight']),
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
const BadgeSizes: NodeType = {
|
|
539
|
+
properties: {
|
|
540
|
+
medium: 'BadgeFontConfig',
|
|
541
|
+
small: 'BadgeFontConfig',
|
|
542
|
+
},
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
const HttpBadgesConfig: NodeType = {
|
|
546
|
+
properties: {
|
|
547
|
+
...omitObjectProps(FontConfig.properties, ['fontSize', 'lineHeight']),
|
|
548
|
+
borderRadius: { type: 'string' },
|
|
549
|
+
color: { type: 'string' },
|
|
550
|
+
sizes: 'BadgeSizes',
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
const LabelControls: NodeType = {
|
|
555
|
+
properties: {
|
|
556
|
+
top: { type: 'string' },
|
|
557
|
+
width: { type: 'string' },
|
|
558
|
+
height: { type: 'string' },
|
|
559
|
+
},
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
const Panels: NodeType = {
|
|
563
|
+
properties: {
|
|
564
|
+
borderRadius: { type: 'string' },
|
|
565
|
+
backgroundColor: { type: 'string' },
|
|
566
|
+
},
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
const TryItButton: NodeType = {
|
|
570
|
+
properties: {
|
|
571
|
+
fullWidth: { type: 'boolean' },
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
const Components: NodeType = {
|
|
576
|
+
properties: {
|
|
577
|
+
buttons: 'ButtonsConfig',
|
|
578
|
+
httpBadges: 'HttpBadgesConfig',
|
|
579
|
+
layoutControls: 'LabelControls',
|
|
580
|
+
panels: 'Panels',
|
|
581
|
+
tryItButton: 'TryItButton',
|
|
582
|
+
tryItSendButton: 'TryItButton',
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
const Breakpoints: NodeType = {
|
|
587
|
+
properties: {
|
|
588
|
+
small: { type: 'string' },
|
|
589
|
+
medium: { type: 'string' },
|
|
590
|
+
large: { type: 'string' },
|
|
591
|
+
},
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
const StackedConfig: NodeType = {
|
|
595
|
+
properties: {
|
|
596
|
+
maxWidth: 'Breakpoints',
|
|
597
|
+
},
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const ThreePanelConfig: NodeType = {
|
|
601
|
+
properties: {
|
|
602
|
+
maxWidth: 'Breakpoints',
|
|
603
|
+
middlePanelMaxWidth: 'Breakpoints',
|
|
604
|
+
},
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
const Layout: NodeType = {
|
|
608
|
+
properties: {
|
|
609
|
+
showDarkRightPanel: { type: 'boolean' },
|
|
610
|
+
stacked: 'StackedConfig',
|
|
611
|
+
'three-panel': 'ThreePanelConfig',
|
|
612
|
+
},
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
const SchemaColorsConfig: NodeType = {
|
|
616
|
+
properties: {
|
|
617
|
+
backgroundColor: { type: 'string' },
|
|
618
|
+
border: { type: 'string' },
|
|
619
|
+
},
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
const Schema: NodeType = {
|
|
623
|
+
properties: {
|
|
624
|
+
breakFieldNames: { type: 'boolean' },
|
|
625
|
+
caretColor: { type: 'string' },
|
|
626
|
+
caretSize: { type: 'string' },
|
|
627
|
+
constraints: 'SchemaColorsConfig',
|
|
628
|
+
defaultDetailsWidth: { type: 'string' },
|
|
629
|
+
examples: 'SchemaColorsConfig',
|
|
630
|
+
labelsTextSize: { type: 'string' },
|
|
631
|
+
linesColor: { type: 'string' },
|
|
632
|
+
nestedBackground: { type: 'string' },
|
|
633
|
+
nestingSpacing: { type: 'string' },
|
|
634
|
+
requireLabelColor: { type: 'string' },
|
|
635
|
+
typeNameColor: { type: 'string' },
|
|
636
|
+
typeTitleColor: { type: 'string' },
|
|
637
|
+
},
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
const GroupItemsConfig: NodeType = {
|
|
641
|
+
properties: {
|
|
642
|
+
subItemsColor: { type: 'string' },
|
|
643
|
+
textTransform: { type: 'string' },
|
|
644
|
+
fontWeight: { type: 'string' },
|
|
645
|
+
},
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
const Level1Items: NodeType = {
|
|
649
|
+
properties: pickObjectProps(GroupItemsConfig.properties, ['textTransform']),
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
const SpacingConfig: NodeType = {
|
|
653
|
+
properties: {
|
|
654
|
+
unit: { type: 'number' },
|
|
655
|
+
paddingHorizontal: { type: 'string' },
|
|
656
|
+
paddingVertical: { type: 'string' },
|
|
657
|
+
offsetTop: { type: 'string' },
|
|
658
|
+
offsetLeft: { type: 'string' },
|
|
659
|
+
offsetNesting: { type: 'string' },
|
|
660
|
+
},
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
const Sidebar: NodeType = {
|
|
664
|
+
properties: {
|
|
665
|
+
...omitObjectProps(FontConfig.properties, ['fontWeight', 'lineHeight']),
|
|
666
|
+
activeBgColor: { type: 'string' },
|
|
667
|
+
activeTextColor: { type: 'string' },
|
|
668
|
+
backgroundColor: { type: 'string' },
|
|
669
|
+
borderRadius: { type: 'string' },
|
|
670
|
+
breakPath: { type: 'boolean' },
|
|
671
|
+
caretColor: { type: 'string' },
|
|
672
|
+
caretSize: { type: 'string' },
|
|
673
|
+
groupItems: 'GroupItemsConfig',
|
|
674
|
+
level1items: 'Level1Items',
|
|
675
|
+
rightLineColor: { type: 'string' },
|
|
676
|
+
separatorLabelColor: { type: 'string' },
|
|
677
|
+
showAtBreakpoint: { type: 'string' },
|
|
678
|
+
spacing: 'SpacingConfig',
|
|
679
|
+
textColor: { type: 'string' },
|
|
680
|
+
width: { type: 'string' },
|
|
681
|
+
},
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
const Heading: NodeType = {
|
|
685
|
+
properties: {
|
|
686
|
+
...FontConfig.properties,
|
|
687
|
+
color: { type: 'string' },
|
|
688
|
+
transform: { type: 'string' },
|
|
689
|
+
},
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
const CodeConfig: NodeType = {
|
|
693
|
+
properties: {
|
|
694
|
+
...FontConfig.properties,
|
|
695
|
+
backgroundColor: { type: 'string' },
|
|
696
|
+
color: { type: 'string' },
|
|
697
|
+
wordBreak: {
|
|
698
|
+
enum: [
|
|
699
|
+
'break-all',
|
|
700
|
+
'break-word',
|
|
701
|
+
'keep-all',
|
|
702
|
+
'normal',
|
|
703
|
+
'revert',
|
|
704
|
+
'unset',
|
|
705
|
+
'inherit',
|
|
706
|
+
'initial',
|
|
707
|
+
],
|
|
708
|
+
},
|
|
709
|
+
wrap: { type: 'boolean' },
|
|
710
|
+
},
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
const HeadingsConfig: NodeType = {
|
|
714
|
+
properties: omitObjectProps(FontConfig.properties, ['fontSize']),
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
const LinksConfig: NodeType = {
|
|
718
|
+
properties: {
|
|
719
|
+
color: { type: 'string' },
|
|
720
|
+
hover: { type: 'string' },
|
|
721
|
+
textDecoration: { type: 'string' },
|
|
722
|
+
hoverTextDecoration: { type: 'string' },
|
|
723
|
+
visited: { type: 'string' },
|
|
724
|
+
},
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
const Typography: NodeType = {
|
|
728
|
+
properties: {
|
|
729
|
+
code: 'CodeConfig',
|
|
730
|
+
fieldName: 'FontConfig',
|
|
731
|
+
...pickObjectProps(FontConfig.properties, ['fontSize', 'fontFamily']),
|
|
732
|
+
fontWeightBold: { type: 'string' },
|
|
733
|
+
fontWeightLight: { type: 'string' },
|
|
734
|
+
fontWeightRegular: { type: 'string' },
|
|
735
|
+
heading1: 'Heading',
|
|
736
|
+
heading2: 'Heading',
|
|
737
|
+
heading3: 'Heading',
|
|
738
|
+
headings: 'HeadingsConfig',
|
|
739
|
+
lineHeight: { type: 'string' },
|
|
740
|
+
links: 'LinksConfig',
|
|
741
|
+
optimizeSpeed: { type: 'boolean' },
|
|
742
|
+
rightPanelHeading: 'Heading',
|
|
743
|
+
smoothing: { enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'] },
|
|
744
|
+
},
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
const TokenProps: NodeType = {
|
|
748
|
+
properties: {
|
|
749
|
+
color: { type: 'string' },
|
|
750
|
+
...omitObjectProps(FontConfig.properties, ['fontWeight']),
|
|
751
|
+
},
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
const CodeBlock: NodeType = {
|
|
755
|
+
properties: {
|
|
756
|
+
backgroundColor: { type: 'string' },
|
|
757
|
+
borderRadius: { type: 'string' },
|
|
758
|
+
tokens: 'TokenProps',
|
|
759
|
+
},
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
const Logo: NodeType = {
|
|
763
|
+
properties: {
|
|
764
|
+
gutter: { type: 'string' },
|
|
765
|
+
maxHeight: { type: 'string' },
|
|
766
|
+
maxWidth: { type: 'string' },
|
|
767
|
+
},
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
const Fab: NodeType = {
|
|
771
|
+
properties: {
|
|
772
|
+
backgroundColor: { type: 'string' },
|
|
773
|
+
color: { type: 'string' },
|
|
774
|
+
},
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
const ButtonOverrides: NodeType = {
|
|
778
|
+
properties: {
|
|
779
|
+
custom: { type: 'string' },
|
|
780
|
+
},
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const Overrides: NodeType = {
|
|
784
|
+
properties: {
|
|
785
|
+
DownloadButton: 'ButtonOverrides',
|
|
786
|
+
NextSectionButton: 'ButtonOverrides',
|
|
787
|
+
},
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
const RightPanel: NodeType = {
|
|
791
|
+
properties: {
|
|
792
|
+
backgroundColor: { type: 'string' },
|
|
793
|
+
panelBackgroundColor: { type: 'string' },
|
|
794
|
+
panelControlsBackgroundColor: { type: 'string' },
|
|
795
|
+
showAtBreakpoint: { type: 'string' },
|
|
796
|
+
textColor: { type: 'string' },
|
|
797
|
+
width: { type: 'string' },
|
|
798
|
+
},
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
const Shape: NodeType = {
|
|
802
|
+
properties: { borderRadius: { type: 'string' } },
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
const ThemeSpacing: NodeType = {
|
|
806
|
+
properties: {
|
|
807
|
+
sectionHorizontal: { type: 'number' },
|
|
808
|
+
sectionVertical: { type: 'number' },
|
|
809
|
+
unit: { type: 'number' },
|
|
810
|
+
},
|
|
811
|
+
};
|
|
812
|
+
|
|
813
|
+
const ConfigTheme: NodeType = {
|
|
814
|
+
properties: {
|
|
815
|
+
breakpoints: 'Breakpoints',
|
|
816
|
+
codeBlock: 'CodeBlock',
|
|
817
|
+
colors: 'ThemeColors',
|
|
818
|
+
components: 'Components',
|
|
819
|
+
layout: 'Layout',
|
|
820
|
+
logo: 'Logo',
|
|
821
|
+
fab: 'Fab',
|
|
822
|
+
overrides: 'Overrides',
|
|
823
|
+
rightPanel: 'RightPanel',
|
|
824
|
+
schema: 'Schema',
|
|
825
|
+
shape: 'Shape',
|
|
826
|
+
sidebar: 'Sidebar',
|
|
827
|
+
spacing: 'ThemeSpacing',
|
|
828
|
+
typography: 'Typography',
|
|
829
|
+
links: { properties: { color: { type: 'string' } } }, // deprecated
|
|
830
|
+
codeSample: { properties: { backgroundColor: { type: 'string' } } }, // deprecated
|
|
831
|
+
},
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
const GenerateCodeSamples: NodeType = {
|
|
835
|
+
properties: {
|
|
836
|
+
skipOptionalParameters: { type: 'boolean' },
|
|
837
|
+
languages: listOf('ConfigLanguage'),
|
|
838
|
+
},
|
|
839
|
+
required: ['languages'],
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
const ConfigReferenceDocs: NodeType = {
|
|
843
|
+
properties: {
|
|
844
|
+
theme: 'ConfigTheme',
|
|
845
|
+
corsProxyUrl: { type: 'string' },
|
|
846
|
+
ctrlFHijack: { type: 'boolean' },
|
|
847
|
+
defaultSampleLanguage: { type: 'string' },
|
|
848
|
+
disableDeepLinks: { type: 'boolean' },
|
|
849
|
+
disableSearch: { type: 'boolean' },
|
|
850
|
+
disableSidebar: { type: 'boolean' },
|
|
851
|
+
downloadDefinitionUrl: { type: 'string' },
|
|
852
|
+
expandDefaultServerVariables: { type: 'boolean' },
|
|
853
|
+
enumSkipQuotes: { type: 'boolean' },
|
|
854
|
+
expandDefaultRequest: { type: 'boolean' },
|
|
855
|
+
expandDefaultResponse: { type: 'boolean' },
|
|
856
|
+
expandResponses: { type: 'string' },
|
|
857
|
+
expandSingleSchemaField: { type: 'boolean' },
|
|
858
|
+
generateCodeSamples: 'GenerateCodeSamples',
|
|
859
|
+
generatedPayloadSamplesMaxDepth: { type: 'number' },
|
|
860
|
+
hideDownloadButton: { type: 'boolean' },
|
|
861
|
+
hideHostname: { type: 'boolean' },
|
|
862
|
+
hideInfoSection: { type: 'boolean' },
|
|
863
|
+
hideLoading: { type: 'boolean' },
|
|
864
|
+
hideLogo: { type: 'boolean' },
|
|
865
|
+
hideRequestPayloadSample: { type: 'boolean' },
|
|
866
|
+
hideRightPanel: { type: 'boolean' },
|
|
867
|
+
hideSchemaPattern: { type: 'boolean' },
|
|
868
|
+
hideSchemaTitles: { type: 'boolean' },
|
|
869
|
+
hideSingleRequestSampleTab: { type: 'boolean' },
|
|
870
|
+
hideSecuritySection: { type: 'boolean' },
|
|
871
|
+
hideTryItPanel: { type: 'boolean' },
|
|
872
|
+
hideFab: { type: 'boolean' },
|
|
873
|
+
hideOneOfDescription: { type: 'boolean' },
|
|
874
|
+
htmlTemplate: { type: 'string' },
|
|
875
|
+
jsonSampleExpandLevel: (value: unknown) => {
|
|
876
|
+
if (typeof value === 'number') {
|
|
877
|
+
return { type: 'number', minimum: 1 };
|
|
878
|
+
} else {
|
|
879
|
+
return { type: 'string' };
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
labels: 'ConfigLabels',
|
|
883
|
+
layout: { enum: ['stacked', 'three-panel'] },
|
|
884
|
+
maxDisplayedEnumValues: { type: 'number' },
|
|
885
|
+
menuToggle: { type: 'boolean' },
|
|
886
|
+
nativeScrollbars: { type: 'boolean' },
|
|
887
|
+
noAutoAuth: { type: 'boolean' }, // deprecated
|
|
888
|
+
oAuth2RedirectURI: { type: 'string' },
|
|
889
|
+
onDeepLinkClick: { type: 'object' },
|
|
890
|
+
onlyRequiredInSamples: { type: 'boolean' },
|
|
891
|
+
pagination: { enum: ['none', 'section', 'item'] },
|
|
892
|
+
pathInMiddlePanel: { type: 'boolean' },
|
|
893
|
+
payloadSampleIdx: { type: 'number', minimum: 0 },
|
|
894
|
+
requestInterceptor: { type: 'object' },
|
|
895
|
+
requiredPropsFirst: { type: 'boolean' },
|
|
896
|
+
routingBasePath: { type: 'string' },
|
|
897
|
+
routingStrategy: { type: 'string' }, // deprecated
|
|
898
|
+
samplesTabsMaxCount: { type: 'number' },
|
|
899
|
+
schemaExpansionLevel: (value: unknown) => {
|
|
900
|
+
if (typeof value === 'number') {
|
|
901
|
+
return { type: 'number', minimum: 0 };
|
|
902
|
+
} else {
|
|
903
|
+
return { type: 'string' };
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
schemaDefinitionsTagName: { type: 'string' },
|
|
907
|
+
minCharacterLengthToInitSearch: { type: 'number', minimum: 1 },
|
|
908
|
+
maxResponseHeadersToShowInTryIt: { type: 'number', minimum: 0 },
|
|
909
|
+
scrollYOffset: (value: unknown) => {
|
|
910
|
+
if (typeof value === 'number') {
|
|
911
|
+
return { type: 'number' };
|
|
912
|
+
} else {
|
|
913
|
+
return { type: 'string' };
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
searchAutoExpand: { type: 'boolean' },
|
|
917
|
+
searchFieldLevelBoost: { type: 'number', minimum: 0 },
|
|
918
|
+
searchMaxDepth: { type: 'number', minimum: 1 },
|
|
919
|
+
searchMode: { enum: ['default', 'path-only'] },
|
|
920
|
+
searchOperationTitleBoost: { type: 'number' },
|
|
921
|
+
searchTagTitleBoost: { type: 'number' },
|
|
922
|
+
sendXUserAgentInTryIt: { type: 'boolean' },
|
|
923
|
+
showChangeLayoutButton: { type: 'boolean' },
|
|
924
|
+
showConsole: { type: 'boolean' }, // deprecated
|
|
925
|
+
showExtensions: (value: unknown) => {
|
|
926
|
+
if (typeof value === 'boolean') {
|
|
927
|
+
return { type: 'boolean' };
|
|
928
|
+
} else {
|
|
929
|
+
return {
|
|
930
|
+
type: 'array',
|
|
931
|
+
items: {
|
|
932
|
+
type: 'string',
|
|
933
|
+
},
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
showNextButton: { type: 'boolean' },
|
|
938
|
+
showRightPanelToggle: { type: 'boolean' },
|
|
939
|
+
showSecuritySchemeType: { type: 'boolean' },
|
|
940
|
+
showWebhookVerb: { type: 'boolean' },
|
|
941
|
+
showObjectSchemaExamples: { type: 'boolean' },
|
|
942
|
+
disableTryItRequestUrlEncoding: { type: 'boolean' },
|
|
943
|
+
sidebarLinks: 'ConfigSidebarLinks',
|
|
944
|
+
sideNavStyle: { enum: ['summary-only', 'path-first', 'id-only'] },
|
|
945
|
+
simpleOneOfTypeLabel: { type: 'boolean' },
|
|
946
|
+
sortEnumValuesAlphabetically: { type: 'boolean' },
|
|
947
|
+
sortOperationsAlphabetically: { type: 'boolean' },
|
|
948
|
+
sortPropsAlphabetically: { type: 'boolean' },
|
|
949
|
+
sortTagsAlphabetically: { type: 'boolean' },
|
|
950
|
+
suppressWarnings: { type: 'boolean' }, // deprecated
|
|
951
|
+
unstable_externalDescription: { type: 'boolean' }, // deprecated
|
|
952
|
+
unstable_ignoreMimeParameters: { type: 'boolean' },
|
|
953
|
+
untrustedDefinition: { type: 'boolean' },
|
|
954
|
+
mockServer: {
|
|
955
|
+
properties: {
|
|
956
|
+
url: { type: 'string' },
|
|
957
|
+
position: { enum: ['first', 'last', 'replace', 'off'] },
|
|
958
|
+
description: { type: 'string' },
|
|
959
|
+
},
|
|
960
|
+
},
|
|
961
|
+
showAccessMode: { type: 'boolean' },
|
|
962
|
+
preserveOriginalExtensionsName: { type: 'boolean' },
|
|
963
|
+
markdownHeadingsAnchorLevel: { type: 'number' },
|
|
964
|
+
},
|
|
965
|
+
additionalProperties: { type: 'string' },
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
const ConfigMockServer: NodeType = {
|
|
969
|
+
properties: {
|
|
970
|
+
strictExamples: { type: 'boolean' },
|
|
971
|
+
errorIfForcedExampleNotFound: { type: 'boolean' },
|
|
972
|
+
},
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
export const ConfigTypes: Record<string, NodeType> = {
|
|
976
|
+
Assert,
|
|
977
|
+
ConfigRoot,
|
|
978
|
+
ConfigApis,
|
|
979
|
+
ConfigApisProperties,
|
|
980
|
+
RootConfigStyleguide,
|
|
981
|
+
ConfigStyleguide,
|
|
982
|
+
ConfigReferenceDocs,
|
|
983
|
+
ConfigMockServer,
|
|
984
|
+
ConfigHTTP,
|
|
985
|
+
ConfigLanguage,
|
|
986
|
+
ConfigLabels,
|
|
987
|
+
ConfigSidebarLinks,
|
|
988
|
+
CommonConfigSidebarLinks,
|
|
989
|
+
ConfigTheme,
|
|
990
|
+
ConfigRootTheme,
|
|
991
|
+
AssertDefinition,
|
|
992
|
+
ThemeColors,
|
|
993
|
+
CommonThemeColors,
|
|
994
|
+
BorderThemeColors,
|
|
995
|
+
HttpColors,
|
|
996
|
+
ResponseColors,
|
|
997
|
+
SecondaryColors,
|
|
998
|
+
TextThemeColors,
|
|
999
|
+
Sizes,
|
|
1000
|
+
ButtonsConfig,
|
|
1001
|
+
CommonColorProps,
|
|
1002
|
+
BadgeFontConfig,
|
|
1003
|
+
BadgeSizes,
|
|
1004
|
+
HttpBadgesConfig,
|
|
1005
|
+
LabelControls,
|
|
1006
|
+
Panels,
|
|
1007
|
+
TryItButton,
|
|
1008
|
+
Breakpoints,
|
|
1009
|
+
StackedConfig,
|
|
1010
|
+
ThreePanelConfig,
|
|
1011
|
+
SchemaColorsConfig,
|
|
1012
|
+
SizeProps,
|
|
1013
|
+
Level1Items,
|
|
1014
|
+
SpacingConfig,
|
|
1015
|
+
FontConfig,
|
|
1016
|
+
CodeConfig,
|
|
1017
|
+
HeadingsConfig,
|
|
1018
|
+
LinksConfig,
|
|
1019
|
+
TokenProps,
|
|
1020
|
+
CodeBlock,
|
|
1021
|
+
Logo,
|
|
1022
|
+
Fab,
|
|
1023
|
+
ButtonOverrides,
|
|
1024
|
+
Overrides,
|
|
1025
|
+
ObjectRule,
|
|
1026
|
+
RightPanel,
|
|
1027
|
+
Rules,
|
|
1028
|
+
Shape,
|
|
1029
|
+
ThemeSpacing,
|
|
1030
|
+
GenerateCodeSamples,
|
|
1031
|
+
GroupItemsConfig,
|
|
1032
|
+
Components,
|
|
1033
|
+
Layout,
|
|
1034
|
+
Schema,
|
|
1035
|
+
Sidebar,
|
|
1036
|
+
Heading,
|
|
1037
|
+
Typography,
|
|
1038
|
+
AssertionDefinitionAssertions,
|
|
1039
|
+
AssertionDefinitionSubject,
|
|
1040
|
+
};
|