@redocly/openapi-core 0.0.0-snapshot.1744188073 → 0.0.0-snapshot.1744801622
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/lib/benchmark/benches/lint-with-many-rules.bench.d.ts +1 -2
- package/lib/benchmark/benches/lint-with-many-rules.bench.js +19 -17
- package/lib/benchmark/benches/lint-with-nested-rule.bench.d.ts +1 -2
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js +19 -15
- package/lib/benchmark/benches/lint-with-no-rules.bench.d.ts +1 -2
- package/lib/benchmark/benches/lint-with-no-rules.bench.js +19 -15
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.d.ts +1 -2
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +19 -15
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.d.ts +1 -2
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +19 -15
- package/lib/benchmark/benches/recommended-oas3.bench.d.ts +1 -2
- package/lib/benchmark/benches/recommended-oas3.bench.js +18 -15
- package/lib/benchmark/benches/resolve-with-no-external.bench.d.ts +1 -2
- package/lib/benchmark/benches/resolve-with-no-external.bench.js +17 -14
- package/lib/benchmark/utils.d.ts +4 -5
- package/lib/benchmark/utils.js +14 -11
- package/lib/bundle.d.ts +9 -8
- package/lib/bundle.js +84 -72
- package/lib/config/all.d.ts +1 -2
- package/lib/config/all.js +3 -2
- package/lib/config/builtIn.d.ts +1 -2
- package/lib/config/builtIn.js +49 -44
- package/lib/config/config-resolvers.d.ts +5 -6
- package/lib/config/config-resolvers.js +94 -85
- package/lib/config/config.d.ts +8 -6
- package/lib/config/config.js +73 -66
- package/lib/config/index.d.ts +7 -8
- package/lib/config/index.js +23 -8
- package/lib/config/load.d.ts +8 -5
- package/lib/config/load.js +73 -28
- package/lib/config/minimal.d.ts +1 -2
- package/lib/config/minimal.js +3 -2
- package/lib/config/recommended-strict.d.ts +1 -2
- package/lib/config/recommended-strict.js +3 -2
- package/lib/config/recommended.d.ts +1 -2
- package/lib/config/recommended.js +3 -2
- package/lib/config/rules.d.ts +3 -4
- package/lib/config/rules.js +6 -4
- package/lib/config/spec.d.ts +1 -2
- package/lib/config/spec.js +3 -2
- package/lib/config/types.d.ts +13 -6
- package/lib/config/types.js +2 -2
- package/lib/config/utils.d.ts +2 -3
- package/lib/config/utils.js +89 -75
- package/lib/decorators/arazzo/index.d.ts +0 -1
- package/lib/decorators/arazzo/index.js +4 -2
- package/lib/decorators/async2/index.d.ts +0 -1
- package/lib/decorators/async2/index.js +4 -2
- package/lib/decorators/async3/index.d.ts +0 -1
- package/lib/decorators/async3/index.js +4 -2
- package/lib/decorators/common/filters/filter-helper.d.ts +1 -2
- package/lib/decorators/common/filters/filter-helper.js +12 -9
- package/lib/decorators/common/filters/filter-in.d.ts +1 -2
- package/lib/decorators/common/filters/filter-in.js +8 -5
- package/lib/decorators/common/filters/filter-out.d.ts +1 -2
- package/lib/decorators/common/filters/filter-out.js +8 -5
- package/lib/decorators/common/info-description-override.d.ts +1 -2
- package/lib/decorators/common/info-description-override.js +7 -4
- package/lib/decorators/common/info-override.d.ts +1 -2
- package/lib/decorators/common/info-override.js +5 -2
- package/lib/decorators/common/media-type-examples-override.d.ts +1 -2
- package/lib/decorators/common/media-type-examples-override.js +10 -7
- package/lib/decorators/common/operation-description-override.d.ts +1 -2
- package/lib/decorators/common/operation-description-override.js +7 -4
- package/lib/decorators/common/registry-dependencies.d.ts +2 -0
- package/lib/decorators/common/registry-dependencies.js +24 -0
- package/lib/decorators/common/remove-x-internal.d.ts +1 -2
- package/lib/decorators/common/remove-x-internal.js +14 -11
- package/lib/decorators/common/tag-description-override.d.ts +1 -2
- package/lib/decorators/common/tag-description-override.js +7 -4
- package/lib/decorators/oas2/index.d.ts +2 -2
- package/lib/decorators/oas2/index.js +20 -16
- package/lib/decorators/oas2/remove-unused-components.d.ts +1 -2
- package/lib/decorators/oas2/remove-unused-components.js +7 -4
- package/lib/decorators/oas3/index.d.ts +2 -2
- package/lib/decorators/oas3/index.js +22 -18
- package/lib/decorators/oas3/remove-unused-components.d.ts +1 -2
- package/lib/decorators/oas3/remove-unused-components.js +8 -5
- package/lib/decorators/overlay1/index.d.ts +0 -1
- package/lib/decorators/overlay1/index.js +4 -2
- package/lib/env.d.ts +0 -1
- package/lib/env.js +5 -3
- package/lib/format/codeframes.d.ts +1 -2
- package/lib/format/codeframes.js +19 -15
- package/lib/format/format.d.ts +1 -2
- package/lib/format/format.js +62 -57
- package/lib/index.d.ts +26 -29
- package/lib/index.js +98 -24
- package/lib/js-yaml/index.d.ts +0 -1
- package/lib/js-yaml/index.js +11 -7
- package/lib/lint.d.ts +10 -11
- package/lib/lint.js +44 -39
- package/lib/logger.d.ts +1 -2
- package/lib/logger.js +17 -15
- package/lib/oas-types.d.ts +3 -4
- package/lib/oas-types.js +32 -27
- package/lib/output.d.ts +3 -0
- package/lib/output.js +9 -0
- package/lib/redocly/domains.d.ts +14 -0
- package/lib/redocly/domains.js +41 -0
- package/lib/redocly/index.d.ts +30 -0
- package/lib/redocly/index.js +131 -0
- package/lib/redocly/redocly-client-types.d.ts +8 -0
- package/lib/redocly/redocly-client-types.js +2 -0
- package/lib/redocly/registry-api-types.d.ts +29 -0
- package/lib/redocly/registry-api-types.js +2 -0
- package/lib/redocly/registry-api.d.ts +17 -0
- package/lib/redocly/registry-api.js +100 -0
- package/lib/ref-utils.d.ts +2 -3
- package/lib/ref-utils.js +33 -18
- package/lib/resolve.d.ts +2 -3
- package/lib/resolve.js +45 -36
- package/lib/rules/ajv.d.ts +3 -4
- package/lib/rules/ajv.js +10 -7
- package/lib/rules/arazzo/criteria-unique.d.ts +1 -2
- package/lib/rules/arazzo/criteria-unique.js +5 -2
- package/lib/rules/arazzo/index.d.ts +1 -2
- package/lib/rules/arazzo/index.js +35 -33
- package/lib/rules/arazzo/parameters-unique.d.ts +1 -2
- package/lib/rules/arazzo/parameters-unique.js +5 -2
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +1 -2
- package/lib/rules/arazzo/requestBody-replacements-unique.js +5 -2
- package/lib/rules/arazzo/sourceDescription-type.d.ts +1 -2
- package/lib/rules/arazzo/sourceDescription-type.js +5 -2
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +1 -2
- package/lib/rules/arazzo/sourceDescriptions-name-unique.js +5 -2
- package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts +1 -2
- package/lib/rules/arazzo/sourceDescriptions-not-empty.js +5 -2
- package/lib/rules/arazzo/step-onFailure-unique.d.ts +1 -2
- package/lib/rules/arazzo/step-onFailure-unique.js +5 -2
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts +1 -2
- package/lib/rules/arazzo/step-onSuccess-unique.js +5 -2
- package/lib/rules/arazzo/stepId-unique.d.ts +1 -2
- package/lib/rules/arazzo/stepId-unique.js +5 -2
- package/lib/rules/arazzo/workflow-dependsOn.d.ts +1 -2
- package/lib/rules/arazzo/workflow-dependsOn.js +5 -2
- package/lib/rules/arazzo/workflowId-unique.d.ts +1 -2
- package/lib/rules/arazzo/workflowId-unique.js +5 -2
- package/lib/rules/async2/channels-kebab-case.d.ts +1 -2
- package/lib/rules/async2/channels-kebab-case.js +5 -2
- package/lib/rules/async2/index.d.ts +1 -2
- package/lib/rules/async2/index.js +24 -22
- package/lib/rules/async2/no-channel-trailing-slash.d.ts +1 -2
- package/lib/rules/async2/no-channel-trailing-slash.js +5 -2
- package/lib/rules/async3/channels-kebab-case.d.ts +1 -2
- package/lib/rules/async3/channels-kebab-case.js +5 -2
- package/lib/rules/async3/index.d.ts +1 -2
- package/lib/rules/async3/index.js +24 -22
- package/lib/rules/async3/no-channel-trailing-slash.d.ts +1 -2
- package/lib/rules/async3/no-channel-trailing-slash.js +6 -3
- package/lib/rules/common/assertions/asserts.d.ts +2 -3
- package/lib/rules/common/assertions/asserts.js +38 -35
- package/lib/rules/common/assertions/index.d.ts +3 -4
- package/lib/rules/common/assertions/index.js +10 -7
- package/lib/rules/common/assertions/utils.d.ts +4 -5
- package/lib/rules/common/assertions/utils.js +29 -21
- package/lib/rules/common/info-contact.d.ts +1 -2
- package/lib/rules/common/info-contact.js +7 -4
- package/lib/rules/common/info-license-strict.d.ts +1 -2
- package/lib/rules/common/info-license-strict.js +10 -7
- package/lib/rules/common/info-license-url.d.ts +1 -2
- package/lib/rules/common/info-license-url.js +7 -4
- package/lib/rules/common/info-license.d.ts +1 -2
- package/lib/rules/common/info-license.js +7 -4
- package/lib/rules/common/no-ambiguous-paths.d.ts +1 -2
- package/lib/rules/common/no-ambiguous-paths.js +5 -2
- package/lib/rules/common/no-enum-type-mismatch.d.ts +1 -2
- package/lib/rules/common/no-enum-type-mismatch.js +9 -6
- package/lib/rules/common/no-http-verbs-in-paths.d.ts +1 -2
- package/lib/rules/common/no-http-verbs-in-paths.js +8 -5
- package/lib/rules/common/no-identical-paths.d.ts +1 -2
- package/lib/rules/common/no-identical-paths.js +5 -2
- package/lib/rules/common/no-invalid-parameter-examples.d.ts +0 -1
- package/lib/rules/common/no-invalid-parameter-examples.js +9 -6
- package/lib/rules/common/no-invalid-schema-examples.d.ts +1 -2
- package/lib/rules/common/no-invalid-schema-examples.js +9 -6
- package/lib/rules/common/no-path-trailing-slash.d.ts +1 -2
- package/lib/rules/common/no-path-trailing-slash.js +5 -2
- package/lib/rules/common/no-required-schema-properties-undefined.d.ts +1 -2
- package/lib/rules/common/no-required-schema-properties-undefined.js +7 -4
- package/lib/rules/common/no-schema-type-mismatch.d.ts +1 -2
- package/lib/rules/common/no-schema-type-mismatch.js +5 -2
- package/lib/rules/common/operation-2xx-response.d.ts +1 -2
- package/lib/rules/common/operation-2xx-response.js +8 -5
- package/lib/rules/common/operation-4xx-response.d.ts +1 -2
- package/lib/rules/common/operation-4xx-response.js +8 -5
- package/lib/rules/common/operation-description.d.ts +1 -2
- package/lib/rules/common/operation-description.js +7 -4
- package/lib/rules/common/operation-operationId-unique.d.ts +1 -2
- package/lib/rules/common/operation-operationId-unique.js +5 -2
- package/lib/rules/common/operation-operationId-url-safe.d.ts +1 -2
- package/lib/rules/common/operation-operationId-url-safe.js +5 -2
- package/lib/rules/common/operation-operationId.d.ts +1 -2
- package/lib/rules/common/operation-operationId.js +7 -4
- package/lib/rules/common/operation-parameters-unique.d.ts +1 -2
- package/lib/rules/common/operation-parameters-unique.js +5 -2
- package/lib/rules/common/operation-singular-tag.d.ts +1 -2
- package/lib/rules/common/operation-singular-tag.js +5 -2
- package/lib/rules/common/operation-summary.d.ts +1 -2
- package/lib/rules/common/operation-summary.js +7 -4
- package/lib/rules/common/operation-tag-defined.d.ts +1 -2
- package/lib/rules/common/operation-tag-defined.js +5 -2
- package/lib/rules/common/parameter-description.d.ts +1 -2
- package/lib/rules/common/parameter-description.js +5 -2
- package/lib/rules/common/path-declaration-must-exist.d.ts +1 -2
- package/lib/rules/common/path-declaration-must-exist.js +5 -2
- package/lib/rules/common/path-excludes-patterns.d.ts +1 -2
- package/lib/rules/common/path-excludes-patterns.js +5 -2
- package/lib/rules/common/path-http-verbs-order.d.ts +1 -2
- package/lib/rules/common/path-http-verbs-order.js +5 -2
- package/lib/rules/common/path-not-include-query.d.ts +1 -2
- package/lib/rules/common/path-not-include-query.js +5 -2
- package/lib/rules/common/path-params-defined.d.ts +1 -2
- package/lib/rules/common/path-params-defined.js +5 -2
- package/lib/rules/common/path-segment-plural.d.ts +1 -2
- package/lib/rules/common/path-segment-plural.js +8 -5
- package/lib/rules/common/paths-kebab-case.d.ts +1 -2
- package/lib/rules/common/paths-kebab-case.js +5 -2
- package/lib/rules/common/required-string-property-missing-min-length.d.ts +1 -2
- package/lib/rules/common/required-string-property-missing-min-length.js +5 -2
- package/lib/rules/common/response-contains-header.d.ts +1 -2
- package/lib/rules/common/response-contains-header.js +8 -5
- package/lib/rules/common/scalar-property-missing-example.d.ts +1 -2
- package/lib/rules/common/scalar-property-missing-example.js +7 -4
- package/lib/rules/common/security-defined.d.ts +1 -2
- package/lib/rules/common/security-defined.js +5 -2
- package/lib/rules/common/spec-strict-refs.d.ts +1 -2
- package/lib/rules/common/spec-strict-refs.js +7 -4
- package/lib/rules/common/struct.d.ts +1 -2
- package/lib/rules/common/struct.js +21 -18
- package/lib/rules/common/tag-description.d.ts +1 -2
- package/lib/rules/common/tag-description.js +7 -4
- package/lib/rules/common/tags-alphabetical.d.ts +1 -2
- package/lib/rules/common/tags-alphabetical.js +5 -2
- package/lib/rules/no-unresolved-refs.d.ts +3 -4
- package/lib/rules/no-unresolved-refs.js +9 -5
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -2
- package/lib/rules/oas2/boolean-parameter-prefixes.js +5 -2
- package/lib/rules/oas2/index.d.ts +1 -2
- package/lib/rules/oas2/index.js +97 -95
- package/lib/rules/oas2/request-mime-type.d.ts +1 -2
- package/lib/rules/oas2/request-mime-type.js +8 -5
- package/lib/rules/oas2/response-contains-property.d.ts +1 -2
- package/lib/rules/oas2/response-contains-property.js +8 -5
- package/lib/rules/oas2/response-mime-type.d.ts +1 -2
- package/lib/rules/oas2/response-mime-type.js +8 -5
- package/lib/rules/oas3/array-parameter-serialization.d.ts +1 -2
- package/lib/rules/oas3/array-parameter-serialization.js +7 -4
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -2
- package/lib/rules/oas3/boolean-parameter-prefixes.js +5 -2
- package/lib/rules/oas3/component-name-unique.d.ts +1 -2
- package/lib/rules/oas3/component-name-unique.js +5 -2
- package/lib/rules/oas3/index.d.ts +1 -2
- package/lib/rules/oas3/index.js +121 -119
- package/lib/rules/oas3/no-empty-servers.d.ts +1 -2
- package/lib/rules/oas3/no-empty-servers.js +5 -2
- package/lib/rules/oas3/no-example-value-and-externalValue.d.ts +1 -2
- package/lib/rules/oas3/no-example-value-and-externalValue.js +5 -2
- package/lib/rules/oas3/no-invalid-media-type-examples.d.ts +1 -2
- package/lib/rules/oas3/no-invalid-media-type-examples.js +10 -7
- package/lib/rules/oas3/no-server-example.com.d.ts +1 -2
- package/lib/rules/oas3/no-server-example.com.js +5 -2
- package/lib/rules/oas3/no-server-trailing-slash.d.ts +1 -2
- package/lib/rules/oas3/no-server-trailing-slash.js +5 -2
- package/lib/rules/oas3/no-server-variables-empty-enum.d.ts +1 -2
- package/lib/rules/oas3/no-server-variables-empty-enum.js +5 -2
- package/lib/rules/oas3/no-undefined-server-variable.d.ts +1 -2
- package/lib/rules/oas3/no-undefined-server-variable.js +5 -2
- package/lib/rules/oas3/no-unused-components.d.ts +1 -2
- package/lib/rules/oas3/no-unused-components.js +5 -2
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts +1 -2
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +9 -6
- package/lib/rules/oas3/request-mime-type.d.ts +1 -2
- package/lib/rules/oas3/request-mime-type.js +9 -6
- package/lib/rules/oas3/response-contains-property.d.ts +1 -2
- package/lib/rules/oas3/response-contains-property.js +8 -5
- package/lib/rules/oas3/response-mime-type.d.ts +1 -2
- package/lib/rules/oas3/response-mime-type.js +9 -6
- package/lib/rules/oas3/spec-components-invalid-map-name.d.ts +1 -2
- package/lib/rules/oas3/spec-components-invalid-map-name.js +5 -2
- package/lib/rules/other/stats.d.ts +3 -4
- package/lib/rules/other/stats.js +5 -2
- package/lib/rules/overlay1/index.d.ts +1 -2
- package/lib/rules/overlay1/index.js +11 -9
- package/lib/rules/respect/no-criteria-xpath.d.ts +1 -2
- package/lib/rules/respect/no-criteria-xpath.js +5 -2
- package/lib/rules/respect/respect-supported-versions.d.ts +1 -2
- package/lib/rules/respect/respect-supported-versions.js +10 -7
- package/lib/rules/utils.d.ts +3 -4
- package/lib/rules/utils.js +36 -23
- package/lib/types/arazzo.d.ts +1 -2
- package/lib/types/arazzo.js +23 -21
- package/lib/types/asyncapi2.d.ts +1 -2
- package/lib/types/asyncapi2.js +56 -54
- package/lib/types/asyncapi3.d.ts +1 -2
- package/lib/types/asyncapi3.js +43 -41
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +13 -7
- package/lib/types/json-schema-adapter.d.ts +1 -2
- package/lib/types/json-schema-adapter.js +17 -15
- package/lib/types/oas2.d.ts +2 -3
- package/lib/types/oas2.js +19 -17
- package/lib/types/oas3.d.ts +2 -3
- package/lib/types/oas3.js +41 -39
- package/lib/types/oas3_1.d.ts +2 -3
- package/lib/types/oas3_1.js +20 -18
- package/lib/types/overlay.d.ts +1 -2
- package/lib/types/overlay.js +6 -4
- package/lib/types/redocly-yaml.d.ts +3 -4
- package/lib/types/redocly-yaml.js +48 -31
- package/lib/typings/arazzo.d.ts +0 -1
- package/lib/typings/arazzo.js +5 -3
- package/lib/typings/asyncapi.d.ts +0 -1
- package/lib/typings/asyncapi.js +2 -2
- package/lib/typings/asyncapi3.d.ts +0 -1
- package/lib/typings/asyncapi3.js +2 -2
- package/lib/typings/common.d.ts +0 -1
- package/lib/typings/common.js +2 -2
- package/lib/typings/openapi.d.ts +0 -1
- package/lib/typings/openapi.js +2 -2
- package/lib/typings/overlay.d.ts +0 -1
- package/lib/typings/overlay.js +4 -2
- package/lib/typings/swagger.d.ts +1 -2
- package/lib/typings/swagger.js +2 -2
- package/lib/utils.d.ts +5 -4
- package/lib/utils.js +99 -53
- package/lib/visitors.d.ts +10 -11
- package/lib/visitors.js +6 -4
- package/lib/walk.d.ts +8 -9
- package/lib/walk.js +25 -23
- package/package.json +9 -30
- package/lib/benchmark/benches/lint-with-many-rules.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/lint-with-many-rules.bench.js.map +0 -1
- package/lib/benchmark/benches/lint-with-nested-rule.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js.map +0 -1
- package/lib/benchmark/benches/lint-with-no-rules.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/lint-with-no-rules.bench.js.map +0 -1
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js.map +0 -1
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js.map +0 -1
- package/lib/benchmark/benches/recommended-oas3.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/recommended-oas3.bench.js.map +0 -1
- package/lib/benchmark/benches/resolve-with-no-external.bench.d.ts.map +0 -1
- package/lib/benchmark/benches/resolve-with-no-external.bench.js.map +0 -1
- package/lib/benchmark/utils.d.ts.map +0 -1
- package/lib/benchmark/utils.js.map +0 -1
- package/lib/bundle.d.ts.map +0 -1
- package/lib/bundle.js.map +0 -1
- package/lib/config/all.d.ts.map +0 -1
- package/lib/config/all.js.map +0 -1
- package/lib/config/builtIn.d.ts.map +0 -1
- package/lib/config/builtIn.js.map +0 -1
- package/lib/config/config-resolvers.d.ts.map +0 -1
- package/lib/config/config-resolvers.js.map +0 -1
- package/lib/config/config.d.ts.map +0 -1
- package/lib/config/config.js.map +0 -1
- package/lib/config/index.d.ts.map +0 -1
- package/lib/config/index.js.map +0 -1
- package/lib/config/load.d.ts.map +0 -1
- package/lib/config/load.js.map +0 -1
- package/lib/config/minimal.d.ts.map +0 -1
- package/lib/config/minimal.js.map +0 -1
- package/lib/config/recommended-strict.d.ts.map +0 -1
- package/lib/config/recommended-strict.js.map +0 -1
- package/lib/config/recommended.d.ts.map +0 -1
- package/lib/config/recommended.js.map +0 -1
- package/lib/config/rules.d.ts.map +0 -1
- package/lib/config/rules.js.map +0 -1
- package/lib/config/spec.d.ts.map +0 -1
- package/lib/config/spec.js.map +0 -1
- package/lib/config/types.d.ts.map +0 -1
- package/lib/config/types.js.map +0 -1
- package/lib/config/utils.d.ts.map +0 -1
- package/lib/config/utils.js.map +0 -1
- package/lib/decorators/arazzo/index.d.ts.map +0 -1
- package/lib/decorators/arazzo/index.js.map +0 -1
- package/lib/decorators/async2/index.d.ts.map +0 -1
- package/lib/decorators/async2/index.js.map +0 -1
- package/lib/decorators/async3/index.d.ts.map +0 -1
- package/lib/decorators/async3/index.js.map +0 -1
- package/lib/decorators/common/filters/filter-helper.d.ts.map +0 -1
- package/lib/decorators/common/filters/filter-helper.js.map +0 -1
- package/lib/decorators/common/filters/filter-in.d.ts.map +0 -1
- package/lib/decorators/common/filters/filter-in.js.map +0 -1
- package/lib/decorators/common/filters/filter-out.d.ts.map +0 -1
- package/lib/decorators/common/filters/filter-out.js.map +0 -1
- package/lib/decorators/common/info-description-override.d.ts.map +0 -1
- package/lib/decorators/common/info-description-override.js.map +0 -1
- package/lib/decorators/common/info-override.d.ts.map +0 -1
- package/lib/decorators/common/info-override.js.map +0 -1
- package/lib/decorators/common/media-type-examples-override.d.ts.map +0 -1
- package/lib/decorators/common/media-type-examples-override.js.map +0 -1
- package/lib/decorators/common/operation-description-override.d.ts.map +0 -1
- package/lib/decorators/common/operation-description-override.js.map +0 -1
- package/lib/decorators/common/remove-x-internal.d.ts.map +0 -1
- package/lib/decorators/common/remove-x-internal.js.map +0 -1
- package/lib/decorators/common/tag-description-override.d.ts.map +0 -1
- package/lib/decorators/common/tag-description-override.js.map +0 -1
- package/lib/decorators/oas2/index.d.ts.map +0 -1
- package/lib/decorators/oas2/index.js.map +0 -1
- package/lib/decorators/oas2/remove-unused-components.d.ts.map +0 -1
- package/lib/decorators/oas2/remove-unused-components.js.map +0 -1
- package/lib/decorators/oas3/index.d.ts.map +0 -1
- package/lib/decorators/oas3/index.js.map +0 -1
- package/lib/decorators/oas3/remove-unused-components.d.ts.map +0 -1
- package/lib/decorators/oas3/remove-unused-components.js.map +0 -1
- package/lib/decorators/overlay1/index.d.ts.map +0 -1
- package/lib/decorators/overlay1/index.js.map +0 -1
- package/lib/env.d.ts.map +0 -1
- package/lib/env.js.map +0 -1
- package/lib/format/codeframes.d.ts.map +0 -1
- package/lib/format/codeframes.js.map +0 -1
- package/lib/format/format.d.ts.map +0 -1
- package/lib/format/format.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/js-yaml/index.d.ts.map +0 -1
- package/lib/js-yaml/index.js.map +0 -1
- package/lib/lint.d.ts.map +0 -1
- package/lib/lint.js.map +0 -1
- package/lib/logger.d.ts.map +0 -1
- package/lib/logger.js.map +0 -1
- package/lib/oas-types.d.ts.map +0 -1
- package/lib/oas-types.js.map +0 -1
- package/lib/ref-utils.d.ts.map +0 -1
- package/lib/ref-utils.js.map +0 -1
- package/lib/resolve.d.ts.map +0 -1
- package/lib/resolve.js.map +0 -1
- package/lib/rules/ajv.d.ts.map +0 -1
- package/lib/rules/ajv.js.map +0 -1
- package/lib/rules/arazzo/criteria-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/criteria-unique.js.map +0 -1
- package/lib/rules/arazzo/index.d.ts.map +0 -1
- package/lib/rules/arazzo/index.js.map +0 -1
- package/lib/rules/arazzo/parameters-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/parameters-unique.js.map +0 -1
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/requestBody-replacements-unique.js.map +0 -1
- package/lib/rules/arazzo/sourceDescription-type.d.ts.map +0 -1
- package/lib/rules/arazzo/sourceDescription-type.js.map +0 -1
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/sourceDescriptions-name-unique.js.map +0 -1
- package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts.map +0 -1
- package/lib/rules/arazzo/sourceDescriptions-not-empty.js.map +0 -1
- package/lib/rules/arazzo/step-onFailure-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/step-onFailure-unique.js.map +0 -1
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/step-onSuccess-unique.js.map +0 -1
- package/lib/rules/arazzo/stepId-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/stepId-unique.js.map +0 -1
- package/lib/rules/arazzo/workflow-dependsOn.d.ts.map +0 -1
- package/lib/rules/arazzo/workflow-dependsOn.js.map +0 -1
- package/lib/rules/arazzo/workflowId-unique.d.ts.map +0 -1
- package/lib/rules/arazzo/workflowId-unique.js.map +0 -1
- package/lib/rules/async2/channels-kebab-case.d.ts.map +0 -1
- package/lib/rules/async2/channels-kebab-case.js.map +0 -1
- package/lib/rules/async2/index.d.ts.map +0 -1
- package/lib/rules/async2/index.js.map +0 -1
- package/lib/rules/async2/no-channel-trailing-slash.d.ts.map +0 -1
- package/lib/rules/async2/no-channel-trailing-slash.js.map +0 -1
- package/lib/rules/async3/channels-kebab-case.d.ts.map +0 -1
- package/lib/rules/async3/channels-kebab-case.js.map +0 -1
- package/lib/rules/async3/index.d.ts.map +0 -1
- package/lib/rules/async3/index.js.map +0 -1
- package/lib/rules/async3/no-channel-trailing-slash.d.ts.map +0 -1
- package/lib/rules/async3/no-channel-trailing-slash.js.map +0 -1
- package/lib/rules/common/assertions/asserts.d.ts.map +0 -1
- package/lib/rules/common/assertions/asserts.js.map +0 -1
- package/lib/rules/common/assertions/index.d.ts.map +0 -1
- package/lib/rules/common/assertions/index.js.map +0 -1
- package/lib/rules/common/assertions/utils.d.ts.map +0 -1
- package/lib/rules/common/assertions/utils.js.map +0 -1
- package/lib/rules/common/info-contact.d.ts.map +0 -1
- package/lib/rules/common/info-contact.js.map +0 -1
- package/lib/rules/common/info-license-strict.d.ts.map +0 -1
- package/lib/rules/common/info-license-strict.js.map +0 -1
- package/lib/rules/common/info-license-url.d.ts.map +0 -1
- package/lib/rules/common/info-license-url.js.map +0 -1
- package/lib/rules/common/info-license.d.ts.map +0 -1
- package/lib/rules/common/info-license.js.map +0 -1
- package/lib/rules/common/no-ambiguous-paths.d.ts.map +0 -1
- package/lib/rules/common/no-ambiguous-paths.js.map +0 -1
- package/lib/rules/common/no-enum-type-mismatch.d.ts.map +0 -1
- package/lib/rules/common/no-enum-type-mismatch.js.map +0 -1
- package/lib/rules/common/no-http-verbs-in-paths.d.ts.map +0 -1
- package/lib/rules/common/no-http-verbs-in-paths.js.map +0 -1
- package/lib/rules/common/no-identical-paths.d.ts.map +0 -1
- package/lib/rules/common/no-identical-paths.js.map +0 -1
- package/lib/rules/common/no-invalid-parameter-examples.d.ts.map +0 -1
- package/lib/rules/common/no-invalid-parameter-examples.js.map +0 -1
- package/lib/rules/common/no-invalid-schema-examples.d.ts.map +0 -1
- package/lib/rules/common/no-invalid-schema-examples.js.map +0 -1
- package/lib/rules/common/no-path-trailing-slash.d.ts.map +0 -1
- package/lib/rules/common/no-path-trailing-slash.js.map +0 -1
- package/lib/rules/common/no-required-schema-properties-undefined.d.ts.map +0 -1
- package/lib/rules/common/no-required-schema-properties-undefined.js.map +0 -1
- package/lib/rules/common/no-schema-type-mismatch.d.ts.map +0 -1
- package/lib/rules/common/no-schema-type-mismatch.js.map +0 -1
- package/lib/rules/common/operation-2xx-response.d.ts.map +0 -1
- package/lib/rules/common/operation-2xx-response.js.map +0 -1
- package/lib/rules/common/operation-4xx-response.d.ts.map +0 -1
- package/lib/rules/common/operation-4xx-response.js.map +0 -1
- package/lib/rules/common/operation-description.d.ts.map +0 -1
- package/lib/rules/common/operation-description.js.map +0 -1
- package/lib/rules/common/operation-operationId-unique.d.ts.map +0 -1
- package/lib/rules/common/operation-operationId-unique.js.map +0 -1
- package/lib/rules/common/operation-operationId-url-safe.d.ts.map +0 -1
- package/lib/rules/common/operation-operationId-url-safe.js.map +0 -1
- package/lib/rules/common/operation-operationId.d.ts.map +0 -1
- package/lib/rules/common/operation-operationId.js.map +0 -1
- package/lib/rules/common/operation-parameters-unique.d.ts.map +0 -1
- package/lib/rules/common/operation-parameters-unique.js.map +0 -1
- package/lib/rules/common/operation-singular-tag.d.ts.map +0 -1
- package/lib/rules/common/operation-singular-tag.js.map +0 -1
- package/lib/rules/common/operation-summary.d.ts.map +0 -1
- package/lib/rules/common/operation-summary.js.map +0 -1
- package/lib/rules/common/operation-tag-defined.d.ts.map +0 -1
- package/lib/rules/common/operation-tag-defined.js.map +0 -1
- package/lib/rules/common/parameter-description.d.ts.map +0 -1
- package/lib/rules/common/parameter-description.js.map +0 -1
- package/lib/rules/common/path-declaration-must-exist.d.ts.map +0 -1
- package/lib/rules/common/path-declaration-must-exist.js.map +0 -1
- package/lib/rules/common/path-excludes-patterns.d.ts.map +0 -1
- package/lib/rules/common/path-excludes-patterns.js.map +0 -1
- package/lib/rules/common/path-http-verbs-order.d.ts.map +0 -1
- package/lib/rules/common/path-http-verbs-order.js.map +0 -1
- package/lib/rules/common/path-not-include-query.d.ts.map +0 -1
- package/lib/rules/common/path-not-include-query.js.map +0 -1
- package/lib/rules/common/path-params-defined.d.ts.map +0 -1
- package/lib/rules/common/path-params-defined.js.map +0 -1
- package/lib/rules/common/path-segment-plural.d.ts.map +0 -1
- package/lib/rules/common/path-segment-plural.js.map +0 -1
- package/lib/rules/common/paths-kebab-case.d.ts.map +0 -1
- package/lib/rules/common/paths-kebab-case.js.map +0 -1
- package/lib/rules/common/required-string-property-missing-min-length.d.ts.map +0 -1
- package/lib/rules/common/required-string-property-missing-min-length.js.map +0 -1
- package/lib/rules/common/response-contains-header.d.ts.map +0 -1
- package/lib/rules/common/response-contains-header.js.map +0 -1
- package/lib/rules/common/scalar-property-missing-example.d.ts.map +0 -1
- package/lib/rules/common/scalar-property-missing-example.js.map +0 -1
- package/lib/rules/common/security-defined.d.ts.map +0 -1
- package/lib/rules/common/security-defined.js.map +0 -1
- package/lib/rules/common/spec-strict-refs.d.ts.map +0 -1
- package/lib/rules/common/spec-strict-refs.js.map +0 -1
- package/lib/rules/common/struct.d.ts.map +0 -1
- package/lib/rules/common/struct.js.map +0 -1
- package/lib/rules/common/tag-description.d.ts.map +0 -1
- package/lib/rules/common/tag-description.js.map +0 -1
- package/lib/rules/common/tags-alphabetical.d.ts.map +0 -1
- package/lib/rules/common/tags-alphabetical.js.map +0 -1
- package/lib/rules/no-unresolved-refs.d.ts.map +0 -1
- package/lib/rules/no-unresolved-refs.js.map +0 -1
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts.map +0 -1
- package/lib/rules/oas2/boolean-parameter-prefixes.js.map +0 -1
- package/lib/rules/oas2/index.d.ts.map +0 -1
- package/lib/rules/oas2/index.js.map +0 -1
- package/lib/rules/oas2/request-mime-type.d.ts.map +0 -1
- package/lib/rules/oas2/request-mime-type.js.map +0 -1
- package/lib/rules/oas2/response-contains-property.d.ts.map +0 -1
- package/lib/rules/oas2/response-contains-property.js.map +0 -1
- package/lib/rules/oas2/response-mime-type.d.ts.map +0 -1
- package/lib/rules/oas2/response-mime-type.js.map +0 -1
- package/lib/rules/oas3/array-parameter-serialization.d.ts.map +0 -1
- package/lib/rules/oas3/array-parameter-serialization.js.map +0 -1
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts.map +0 -1
- package/lib/rules/oas3/boolean-parameter-prefixes.js.map +0 -1
- package/lib/rules/oas3/component-name-unique.d.ts.map +0 -1
- package/lib/rules/oas3/component-name-unique.js.map +0 -1
- package/lib/rules/oas3/index.d.ts.map +0 -1
- package/lib/rules/oas3/index.js.map +0 -1
- package/lib/rules/oas3/no-empty-servers.d.ts.map +0 -1
- package/lib/rules/oas3/no-empty-servers.js.map +0 -1
- package/lib/rules/oas3/no-example-value-and-externalValue.d.ts.map +0 -1
- package/lib/rules/oas3/no-example-value-and-externalValue.js.map +0 -1
- package/lib/rules/oas3/no-invalid-media-type-examples.d.ts.map +0 -1
- package/lib/rules/oas3/no-invalid-media-type-examples.js.map +0 -1
- package/lib/rules/oas3/no-server-example.com.d.ts.map +0 -1
- package/lib/rules/oas3/no-server-example.com.js.map +0 -1
- package/lib/rules/oas3/no-server-trailing-slash.d.ts.map +0 -1
- package/lib/rules/oas3/no-server-trailing-slash.js.map +0 -1
- package/lib/rules/oas3/no-server-variables-empty-enum.d.ts.map +0 -1
- package/lib/rules/oas3/no-server-variables-empty-enum.js.map +0 -1
- package/lib/rules/oas3/no-undefined-server-variable.d.ts.map +0 -1
- package/lib/rules/oas3/no-undefined-server-variable.js.map +0 -1
- package/lib/rules/oas3/no-unused-components.d.ts.map +0 -1
- package/lib/rules/oas3/no-unused-components.js.map +0 -1
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts.map +0 -1
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js.map +0 -1
- package/lib/rules/oas3/request-mime-type.d.ts.map +0 -1
- package/lib/rules/oas3/request-mime-type.js.map +0 -1
- package/lib/rules/oas3/response-contains-property.d.ts.map +0 -1
- package/lib/rules/oas3/response-contains-property.js.map +0 -1
- package/lib/rules/oas3/response-mime-type.d.ts.map +0 -1
- package/lib/rules/oas3/response-mime-type.js.map +0 -1
- package/lib/rules/oas3/spec-components-invalid-map-name.d.ts.map +0 -1
- package/lib/rules/oas3/spec-components-invalid-map-name.js.map +0 -1
- package/lib/rules/other/stats.d.ts.map +0 -1
- package/lib/rules/other/stats.js.map +0 -1
- package/lib/rules/overlay1/index.d.ts.map +0 -1
- package/lib/rules/overlay1/index.js.map +0 -1
- package/lib/rules/respect/no-criteria-xpath.d.ts.map +0 -1
- package/lib/rules/respect/no-criteria-xpath.js.map +0 -1
- package/lib/rules/respect/respect-supported-versions.d.ts.map +0 -1
- package/lib/rules/respect/respect-supported-versions.js.map +0 -1
- package/lib/rules/utils.d.ts.map +0 -1
- package/lib/rules/utils.js.map +0 -1
- package/lib/types/arazzo.d.ts.map +0 -1
- package/lib/types/arazzo.js.map +0 -1
- package/lib/types/asyncapi2.d.ts.map +0 -1
- package/lib/types/asyncapi2.js.map +0 -1
- package/lib/types/asyncapi3.d.ts.map +0 -1
- package/lib/types/asyncapi3.js.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/types/json-schema-adapter.d.ts.map +0 -1
- package/lib/types/json-schema-adapter.js.map +0 -1
- package/lib/types/oas2.d.ts.map +0 -1
- package/lib/types/oas2.js.map +0 -1
- package/lib/types/oas3.d.ts.map +0 -1
- package/lib/types/oas3.js.map +0 -1
- package/lib/types/oas3_1.d.ts.map +0 -1
- package/lib/types/oas3_1.js.map +0 -1
- package/lib/types/overlay.d.ts.map +0 -1
- package/lib/types/overlay.js.map +0 -1
- package/lib/types/redocly-yaml.d.ts.map +0 -1
- package/lib/types/redocly-yaml.js.map +0 -1
- package/lib/typings/arazzo.d.ts.map +0 -1
- package/lib/typings/arazzo.js.map +0 -1
- package/lib/typings/asyncapi.d.ts.map +0 -1
- package/lib/typings/asyncapi.js.map +0 -1
- package/lib/typings/asyncapi3.d.ts.map +0 -1
- package/lib/typings/asyncapi3.js.map +0 -1
- package/lib/typings/common.d.ts.map +0 -1
- package/lib/typings/common.js.map +0 -1
- package/lib/typings/openapi.d.ts.map +0 -1
- package/lib/typings/openapi.js.map +0 -1
- package/lib/typings/overlay.d.ts.map +0 -1
- package/lib/typings/overlay.js.map +0 -1
- package/lib/typings/swagger.d.ts.map +0 -1
- package/lib/typings/swagger.js.map +0 -1
- package/lib/utils/error.d.ts +0 -3
- package/lib/utils/error.d.ts.map +0 -1
- package/lib/utils/error.js +0 -3
- package/lib/utils/error.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/lib/visitors.d.ts.map +0 -1
- package/lib/visitors.js.map +0 -1
- package/lib/walk.d.ts.map +0 -1
- package/lib/walk.js.map +0 -1
package/lib/config/config.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Config = exports.StyleguideConfig = exports.IGNORE_FILE = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const js_yaml_1 = require("../js-yaml");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const oas_types_1 = require("../oas-types");
|
|
9
|
+
const env_1 = require("../env");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
const ref_utils_1 = require("../ref-utils");
|
|
12
|
+
exports.IGNORE_FILE = '.redocly.lint-ignore.yaml';
|
|
10
13
|
const IGNORE_BANNER = `# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API.\n` +
|
|
11
14
|
`# See https://redocly.com/docs/cli/ for more information.\n`;
|
|
12
15
|
function getIgnoreFilePath(configFile) {
|
|
13
16
|
if (configFile) {
|
|
14
|
-
return doesYamlFileExist(configFile)
|
|
15
|
-
? path.join(path.dirname(configFile), IGNORE_FILE)
|
|
16
|
-
: path.join(configFile, IGNORE_FILE);
|
|
17
|
+
return (0, utils_1.doesYamlFileExist)(configFile)
|
|
18
|
+
? path.join(path.dirname(configFile), exports.IGNORE_FILE)
|
|
19
|
+
: path.join(configFile, exports.IGNORE_FILE);
|
|
17
20
|
}
|
|
18
21
|
else {
|
|
19
|
-
return isBrowser ? undefined : path.join(process.cwd(), IGNORE_FILE);
|
|
22
|
+
return env_1.isBrowser ? undefined : path.join(process.cwd(), exports.IGNORE_FILE);
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
class StyleguideConfig {
|
|
23
26
|
constructor(rawConfig, configFile) {
|
|
24
27
|
this.rawConfig = rawConfig;
|
|
25
28
|
this.configFile = configFile;
|
|
@@ -41,67 +44,67 @@ export class StyleguideConfig {
|
|
|
41
44
|
];
|
|
42
45
|
replaceSpecWithStruct(ruleGroups, rawConfig);
|
|
43
46
|
this.rules = {
|
|
44
|
-
[SpecVersion.OAS2]: { ...rawConfig.rules, ...rawConfig.oas2Rules },
|
|
45
|
-
[SpecVersion.OAS3_0]: { ...rawConfig.rules, ...rawConfig.oas3_0Rules },
|
|
46
|
-
[SpecVersion.OAS3_1]: { ...rawConfig.rules, ...rawConfig.oas3_1Rules },
|
|
47
|
-
[SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
|
|
48
|
-
[SpecVersion.Async3]: { ...rawConfig.rules, ...rawConfig.async3Rules },
|
|
49
|
-
[SpecVersion.Arazzo1]: { ...rawConfig.rules, ...rawConfig.arazzo1Rules },
|
|
50
|
-
[SpecVersion.Overlay1]: { ...rawConfig.rules, ...rawConfig.overlay1Rules },
|
|
47
|
+
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.rules, ...rawConfig.oas2Rules },
|
|
48
|
+
[oas_types_1.SpecVersion.OAS3_0]: { ...rawConfig.rules, ...rawConfig.oas3_0Rules },
|
|
49
|
+
[oas_types_1.SpecVersion.OAS3_1]: { ...rawConfig.rules, ...rawConfig.oas3_1Rules },
|
|
50
|
+
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
|
|
51
|
+
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.rules, ...rawConfig.async3Rules },
|
|
52
|
+
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.rules, ...rawConfig.arazzo1Rules },
|
|
53
|
+
[oas_types_1.SpecVersion.Overlay1]: { ...rawConfig.rules, ...rawConfig.overlay1Rules },
|
|
51
54
|
};
|
|
52
55
|
this.preprocessors = {
|
|
53
|
-
[SpecVersion.OAS2]: { ...rawConfig.preprocessors, ...rawConfig.oas2Preprocessors },
|
|
54
|
-
[SpecVersion.OAS3_0]: { ...rawConfig.preprocessors, ...rawConfig.oas3_0Preprocessors },
|
|
55
|
-
[SpecVersion.OAS3_1]: { ...rawConfig.preprocessors, ...rawConfig.oas3_1Preprocessors },
|
|
56
|
-
[SpecVersion.Async2]: { ...rawConfig.preprocessors, ...rawConfig.async2Preprocessors },
|
|
57
|
-
[SpecVersion.Async3]: { ...rawConfig.preprocessors, ...rawConfig.async3Preprocessors },
|
|
58
|
-
[SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Preprocessors },
|
|
59
|
-
[SpecVersion.Overlay1]: { ...rawConfig.preprocessors, ...rawConfig.overlay1Preprocessors },
|
|
56
|
+
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.preprocessors, ...rawConfig.oas2Preprocessors },
|
|
57
|
+
[oas_types_1.SpecVersion.OAS3_0]: { ...rawConfig.preprocessors, ...rawConfig.oas3_0Preprocessors },
|
|
58
|
+
[oas_types_1.SpecVersion.OAS3_1]: { ...rawConfig.preprocessors, ...rawConfig.oas3_1Preprocessors },
|
|
59
|
+
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.preprocessors, ...rawConfig.async2Preprocessors },
|
|
60
|
+
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.preprocessors, ...rawConfig.async3Preprocessors },
|
|
61
|
+
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Preprocessors },
|
|
62
|
+
[oas_types_1.SpecVersion.Overlay1]: { ...rawConfig.preprocessors, ...rawConfig.overlay1Preprocessors },
|
|
60
63
|
};
|
|
61
64
|
this.decorators = {
|
|
62
|
-
[SpecVersion.OAS2]: { ...rawConfig.decorators, ...rawConfig.oas2Decorators },
|
|
63
|
-
[SpecVersion.OAS3_0]: { ...rawConfig.decorators, ...rawConfig.oas3_0Decorators },
|
|
64
|
-
[SpecVersion.OAS3_1]: { ...rawConfig.decorators, ...rawConfig.oas3_1Decorators },
|
|
65
|
-
[SpecVersion.Async2]: { ...rawConfig.decorators, ...rawConfig.async2Decorators },
|
|
66
|
-
[SpecVersion.Async3]: { ...rawConfig.decorators, ...rawConfig.async3Decorators },
|
|
67
|
-
[SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Decorators },
|
|
68
|
-
[SpecVersion.Overlay1]: { ...rawConfig.decorators, ...rawConfig.overlay1Decorators },
|
|
65
|
+
[oas_types_1.SpecVersion.OAS2]: { ...rawConfig.decorators, ...rawConfig.oas2Decorators },
|
|
66
|
+
[oas_types_1.SpecVersion.OAS3_0]: { ...rawConfig.decorators, ...rawConfig.oas3_0Decorators },
|
|
67
|
+
[oas_types_1.SpecVersion.OAS3_1]: { ...rawConfig.decorators, ...rawConfig.oas3_1Decorators },
|
|
68
|
+
[oas_types_1.SpecVersion.Async2]: { ...rawConfig.decorators, ...rawConfig.async2Decorators },
|
|
69
|
+
[oas_types_1.SpecVersion.Async3]: { ...rawConfig.decorators, ...rawConfig.async3Decorators },
|
|
70
|
+
[oas_types_1.SpecVersion.Arazzo1]: { ...rawConfig.arazzo1Decorators },
|
|
71
|
+
[oas_types_1.SpecVersion.Overlay1]: { ...rawConfig.decorators, ...rawConfig.overlay1Decorators },
|
|
69
72
|
};
|
|
70
73
|
this.extendPaths = rawConfig.extendPaths || [];
|
|
71
74
|
this.pluginPaths = rawConfig.pluginPaths || [];
|
|
72
75
|
this.resolveIgnore(getIgnoreFilePath(configFile));
|
|
73
76
|
}
|
|
74
77
|
resolveIgnore(ignoreFile) {
|
|
75
|
-
if (!ignoreFile || !doesYamlFileExist(ignoreFile))
|
|
78
|
+
if (!ignoreFile || !(0, utils_1.doesYamlFileExist)(ignoreFile))
|
|
76
79
|
return;
|
|
77
80
|
this.ignore =
|
|
78
|
-
parseYaml(fs.readFileSync(ignoreFile, 'utf-8')) || {};
|
|
79
|
-
replaceSpecWithStruct(Object.keys(this.ignore), this.ignore);
|
|
81
|
+
(0, js_yaml_1.parseYaml)(fs.readFileSync(ignoreFile, 'utf-8')) || {};
|
|
82
|
+
replaceSpecWithStruct(Object.keys(this.ignore), this.ignore);
|
|
80
83
|
// resolve ignore paths
|
|
81
84
|
for (const fileName of Object.keys(this.ignore)) {
|
|
82
|
-
this.ignore[isAbsoluteUrl(fileName) ? fileName : path.resolve(path.dirname(ignoreFile), fileName)] = this.ignore[fileName];
|
|
85
|
+
this.ignore[(0, ref_utils_1.isAbsoluteUrl)(fileName) ? fileName : path.resolve(path.dirname(ignoreFile), fileName)] = this.ignore[fileName];
|
|
83
86
|
for (const ruleId of Object.keys(this.ignore[fileName])) {
|
|
84
87
|
this.ignore[fileName][ruleId] = new Set(this.ignore[fileName][ruleId]);
|
|
85
88
|
}
|
|
86
|
-
if (!isAbsoluteUrl(fileName)) {
|
|
89
|
+
if (!(0, ref_utils_1.isAbsoluteUrl)(fileName)) {
|
|
87
90
|
delete this.ignore[fileName];
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
saveIgnore() {
|
|
92
95
|
const dir = this.configFile ? path.dirname(this.configFile) : process.cwd();
|
|
93
|
-
const ignoreFile = path.join(dir, IGNORE_FILE);
|
|
96
|
+
const ignoreFile = path.join(dir, exports.IGNORE_FILE);
|
|
94
97
|
const mapped = {};
|
|
95
98
|
for (const absFileName of Object.keys(this.ignore)) {
|
|
96
|
-
const mappedDefinitionName = isAbsoluteUrl(absFileName)
|
|
99
|
+
const mappedDefinitionName = (0, ref_utils_1.isAbsoluteUrl)(absFileName)
|
|
97
100
|
? absFileName
|
|
98
|
-
: slash(path.relative(dir, absFileName));
|
|
101
|
+
: (0, utils_1.slash)(path.relative(dir, absFileName));
|
|
99
102
|
const ignoredRules = (mapped[mappedDefinitionName] = this.ignore[absFileName]);
|
|
100
103
|
for (const ruleId of Object.keys(ignoredRules)) {
|
|
101
104
|
ignoredRules[ruleId] = Array.from(ignoredRules[ruleId]);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
|
-
fs.writeFileSync(ignoreFile, IGNORE_BANNER + stringifyYaml(mapped));
|
|
107
|
+
fs.writeFileSync(ignoreFile, IGNORE_BANNER + (0, js_yaml_1.stringifyYaml)(mapped));
|
|
105
108
|
}
|
|
106
109
|
addIgnore(problem) {
|
|
107
110
|
const ignore = this.ignore;
|
|
@@ -131,33 +134,33 @@ export class StyleguideConfig {
|
|
|
131
134
|
for (const plugin of this.plugins) {
|
|
132
135
|
if (plugin.typeExtension !== undefined) {
|
|
133
136
|
switch (version) {
|
|
134
|
-
case SpecVersion.OAS3_0:
|
|
135
|
-
case SpecVersion.OAS3_1:
|
|
137
|
+
case oas_types_1.SpecVersion.OAS3_0:
|
|
138
|
+
case oas_types_1.SpecVersion.OAS3_1:
|
|
136
139
|
if (!plugin.typeExtension.oas3)
|
|
137
140
|
continue;
|
|
138
141
|
extendedTypes = plugin.typeExtension.oas3(extendedTypes, version);
|
|
139
142
|
break;
|
|
140
|
-
case SpecVersion.OAS2:
|
|
143
|
+
case oas_types_1.SpecVersion.OAS2:
|
|
141
144
|
if (!plugin.typeExtension.oas2)
|
|
142
145
|
continue;
|
|
143
146
|
extendedTypes = plugin.typeExtension.oas2(extendedTypes, version);
|
|
144
147
|
break;
|
|
145
|
-
case SpecVersion.Async2:
|
|
148
|
+
case oas_types_1.SpecVersion.Async2:
|
|
146
149
|
if (!plugin.typeExtension.async2)
|
|
147
150
|
continue;
|
|
148
151
|
extendedTypes = plugin.typeExtension.async2(extendedTypes, version);
|
|
149
152
|
break;
|
|
150
|
-
case SpecVersion.Async3:
|
|
153
|
+
case oas_types_1.SpecVersion.Async3:
|
|
151
154
|
if (!plugin.typeExtension.async3)
|
|
152
155
|
continue;
|
|
153
156
|
extendedTypes = plugin.typeExtension.async3(extendedTypes, version);
|
|
154
157
|
break;
|
|
155
|
-
case SpecVersion.Arazzo1:
|
|
158
|
+
case oas_types_1.SpecVersion.Arazzo1:
|
|
156
159
|
if (!plugin.typeExtension.arazzo1)
|
|
157
160
|
continue;
|
|
158
161
|
extendedTypes = plugin.typeExtension.arazzo1(extendedTypes, version);
|
|
159
162
|
break;
|
|
160
|
-
case SpecVersion.Overlay1:
|
|
163
|
+
case oas_types_1.SpecVersion.Overlay1:
|
|
161
164
|
if (!plugin.typeExtension.overlay1)
|
|
162
165
|
continue;
|
|
163
166
|
extendedTypes = plugin.typeExtension.overlay1(extendedTypes, version);
|
|
@@ -225,42 +228,42 @@ export class StyleguideConfig {
|
|
|
225
228
|
}
|
|
226
229
|
getRulesForSpecVersion(version) {
|
|
227
230
|
switch (version) {
|
|
228
|
-
case SpecMajorVersion.OAS3:
|
|
231
|
+
case oas_types_1.SpecMajorVersion.OAS3:
|
|
229
232
|
// eslint-disable-next-line no-case-declarations
|
|
230
233
|
const oas3Rules = [];
|
|
231
234
|
this.plugins.forEach((p) => p.preprocessors?.oas3 && oas3Rules.push(p.preprocessors.oas3));
|
|
232
235
|
this.plugins.forEach((p) => p.rules?.oas3 && oas3Rules.push(p.rules.oas3));
|
|
233
236
|
this.plugins.forEach((p) => p.decorators?.oas3 && oas3Rules.push(p.decorators.oas3));
|
|
234
237
|
return oas3Rules;
|
|
235
|
-
case SpecMajorVersion.OAS2:
|
|
238
|
+
case oas_types_1.SpecMajorVersion.OAS2:
|
|
236
239
|
// eslint-disable-next-line no-case-declarations
|
|
237
240
|
const oas2Rules = [];
|
|
238
241
|
this.plugins.forEach((p) => p.preprocessors?.oas2 && oas2Rules.push(p.preprocessors.oas2));
|
|
239
242
|
this.plugins.forEach((p) => p.rules?.oas2 && oas2Rules.push(p.rules.oas2));
|
|
240
243
|
this.plugins.forEach((p) => p.decorators?.oas2 && oas2Rules.push(p.decorators.oas2));
|
|
241
244
|
return oas2Rules;
|
|
242
|
-
case SpecMajorVersion.Async2:
|
|
245
|
+
case oas_types_1.SpecMajorVersion.Async2:
|
|
243
246
|
// eslint-disable-next-line no-case-declarations
|
|
244
247
|
const asyncApi2Rules = [];
|
|
245
248
|
this.plugins.forEach((p) => p.preprocessors?.async2 && asyncApi2Rules.push(p.preprocessors.async2));
|
|
246
249
|
this.plugins.forEach((p) => p.rules?.async2 && asyncApi2Rules.push(p.rules.async2));
|
|
247
250
|
this.plugins.forEach((p) => p.decorators?.async2 && asyncApi2Rules.push(p.decorators.async2));
|
|
248
251
|
return asyncApi2Rules;
|
|
249
|
-
case SpecMajorVersion.Async3:
|
|
252
|
+
case oas_types_1.SpecMajorVersion.Async3:
|
|
250
253
|
// eslint-disable-next-line no-case-declarations
|
|
251
254
|
const asyncApi3Rules = [];
|
|
252
255
|
this.plugins.forEach((p) => p.preprocessors?.async3 && asyncApi3Rules.push(p.preprocessors.async3));
|
|
253
256
|
this.plugins.forEach((p) => p.rules?.async3 && asyncApi3Rules.push(p.rules.async3));
|
|
254
257
|
this.plugins.forEach((p) => p.decorators?.async3 && asyncApi3Rules.push(p.decorators.async3));
|
|
255
258
|
return asyncApi3Rules;
|
|
256
|
-
case SpecMajorVersion.Arazzo1:
|
|
259
|
+
case oas_types_1.SpecMajorVersion.Arazzo1:
|
|
257
260
|
// eslint-disable-next-line no-case-declarations
|
|
258
261
|
const arazzo1Rules = [];
|
|
259
262
|
this.plugins.forEach((p) => p.preprocessors?.arazzo1 && arazzo1Rules.push(p.preprocessors.arazzo1));
|
|
260
263
|
this.plugins.forEach((p) => p.rules?.arazzo1 && arazzo1Rules.push(p.rules.arazzo1));
|
|
261
264
|
this.plugins.forEach((p) => p.decorators?.arazzo1 && arazzo1Rules.push(p.decorators.arazzo1));
|
|
262
265
|
return arazzo1Rules;
|
|
263
|
-
case SpecMajorVersion.Overlay1:
|
|
266
|
+
case oas_types_1.SpecMajorVersion.Overlay1:
|
|
264
267
|
// eslint-disable-next-line no-case-declarations
|
|
265
268
|
const overlay1Rules = [];
|
|
266
269
|
this.plugins.forEach((p) => p.preprocessors?.overlay1 && overlay1Rules.push(p.preprocessors.overlay1));
|
|
@@ -271,7 +274,7 @@ export class StyleguideConfig {
|
|
|
271
274
|
}
|
|
272
275
|
skipRules(rules) {
|
|
273
276
|
for (const ruleId of rules || []) {
|
|
274
|
-
for (const version of Object.values(SpecVersion)) {
|
|
277
|
+
for (const version of Object.values(oas_types_1.SpecVersion)) {
|
|
275
278
|
if (this.rules[version][ruleId]) {
|
|
276
279
|
this.rules[version][ruleId] = 'off';
|
|
277
280
|
}
|
|
@@ -288,7 +291,7 @@ export class StyleguideConfig {
|
|
|
288
291
|
}
|
|
289
292
|
skipPreprocessors(preprocessors) {
|
|
290
293
|
for (const preprocessorId of preprocessors || []) {
|
|
291
|
-
for (const version of Object.values(SpecVersion)) {
|
|
294
|
+
for (const version of Object.values(oas_types_1.SpecVersion)) {
|
|
292
295
|
if (this.preprocessors[version][preprocessorId]) {
|
|
293
296
|
this.preprocessors[version][preprocessorId] = 'off';
|
|
294
297
|
}
|
|
@@ -297,7 +300,7 @@ export class StyleguideConfig {
|
|
|
297
300
|
}
|
|
298
301
|
skipDecorators(decorators) {
|
|
299
302
|
for (const decoratorId of decorators || []) {
|
|
300
|
-
for (const version of Object.values(SpecVersion)) {
|
|
303
|
+
for (const version of Object.values(oas_types_1.SpecVersion)) {
|
|
301
304
|
if (this.decorators[version][decoratorId]) {
|
|
302
305
|
this.decorators[version][decoratorId] = 'off';
|
|
303
306
|
}
|
|
@@ -305,25 +308,29 @@ export class StyleguideConfig {
|
|
|
305
308
|
}
|
|
306
309
|
}
|
|
307
310
|
}
|
|
311
|
+
exports.StyleguideConfig = StyleguideConfig;
|
|
308
312
|
// To support backwards compatibility with the old `spec` key we rename it to `struct`.
|
|
309
313
|
function replaceSpecWithStruct(ruleGroups, config) {
|
|
310
314
|
for (const ruleGroup of ruleGroups) {
|
|
311
|
-
if (config[ruleGroup] && isPlainObject(config[ruleGroup]) && 'spec' in config[ruleGroup]) {
|
|
312
|
-
showWarningForDeprecatedField('spec', 'struct');
|
|
315
|
+
if (config[ruleGroup] && (0, utils_1.isPlainObject)(config[ruleGroup]) && 'spec' in config[ruleGroup]) {
|
|
316
|
+
(0, utils_1.showWarningForDeprecatedField)('spec', 'struct');
|
|
313
317
|
config[ruleGroup].struct = config[ruleGroup].spec;
|
|
314
318
|
delete config[ruleGroup].spec;
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
|
-
|
|
322
|
+
class Config {
|
|
319
323
|
constructor(rawConfig, configFile) {
|
|
320
324
|
this.rawConfig = rawConfig;
|
|
321
325
|
this.configFile = configFile;
|
|
322
326
|
this.apis = rawConfig.apis || {};
|
|
323
327
|
this.styleguide = new StyleguideConfig(rawConfig.styleguide || {}, configFile);
|
|
324
|
-
this.theme = rawConfig.theme || {};
|
|
325
|
-
this.resolve = getResolveConfig(rawConfig?.resolve);
|
|
328
|
+
this.theme = rawConfig.theme || {};
|
|
329
|
+
this.resolve = (0, utils_2.getResolveConfig)(rawConfig?.resolve);
|
|
330
|
+
this.region = rawConfig.region;
|
|
331
|
+
this.organization = rawConfig.organization;
|
|
332
|
+
this.files = rawConfig.files || [];
|
|
326
333
|
this.telemetry = rawConfig.telemetry;
|
|
327
334
|
}
|
|
328
335
|
}
|
|
329
|
-
|
|
336
|
+
exports.Config = Config;
|
package/lib/config/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from './config
|
|
2
|
-
export * from './types
|
|
3
|
-
export * from './rules
|
|
4
|
-
export * from './builtIn
|
|
5
|
-
export * from './load
|
|
6
|
-
export * from './utils
|
|
7
|
-
export * from './config-resolvers
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './config';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './rules';
|
|
4
|
+
export * from './builtIn';
|
|
5
|
+
export * from './load';
|
|
6
|
+
export * from './utils';
|
|
7
|
+
export * from './config-resolvers';
|
package/lib/config/index.js
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./rules"), exports);
|
|
20
|
+
__exportStar(require("./builtIn"), exports);
|
|
21
|
+
__exportStar(require("./load"), exports);
|
|
22
|
+
__exportStar(require("./utils"), exports);
|
|
23
|
+
__exportStar(require("./config-resolvers"), exports);
|
package/lib/config/load.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { BaseResolver } from '../resolve
|
|
2
|
-
import type { Config } from './config
|
|
3
|
-
import type { Document, ResolvedRefMap } from '../resolve
|
|
4
|
-
import type {
|
|
1
|
+
import { BaseResolver } from '../resolve';
|
|
2
|
+
import type { Config } from './config';
|
|
3
|
+
import type { Document, ResolvedRefMap } from '../resolve';
|
|
4
|
+
import type { RegionalTokenWithValidity } from '../redocly/redocly-client-types';
|
|
5
|
+
import type { RawConfig, RawUniversalConfig, Region } from './types';
|
|
5
6
|
export type RawConfigProcessor = (params: {
|
|
6
7
|
document: Document;
|
|
7
8
|
resolvedRefMap: ResolvedRefMap;
|
|
@@ -13,6 +14,8 @@ export declare function loadConfig(options?: {
|
|
|
13
14
|
customExtends?: string[];
|
|
14
15
|
processRawConfig?: RawConfigProcessor;
|
|
15
16
|
externalRefResolver?: BaseResolver;
|
|
17
|
+
files?: string[];
|
|
18
|
+
region?: Region;
|
|
16
19
|
}): Promise<Config>;
|
|
17
20
|
export declare const CONFIG_FILE_NAMES: string[];
|
|
18
21
|
export declare function findConfig(dir?: string): string | undefined;
|
|
@@ -27,9 +30,9 @@ export declare function getConfig(options?: {
|
|
|
27
30
|
}>;
|
|
28
31
|
type CreateConfigOptions = {
|
|
29
32
|
extends?: string[];
|
|
33
|
+
tokens?: RegionalTokenWithValidity[];
|
|
30
34
|
configPath?: string;
|
|
31
35
|
externalRefResolver?: BaseResolver;
|
|
32
36
|
};
|
|
33
37
|
export declare function createConfig(config: string | RawUniversalConfig, options?: CreateConfigOptions): Promise<Config>;
|
|
34
38
|
export {};
|
|
35
|
-
//# sourceMappingURL=load.d.ts.map
|
package/lib/config/load.js
CHANGED
|
@@ -1,35 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG_FILE_NAMES = void 0;
|
|
4
|
+
exports.loadConfig = loadConfig;
|
|
5
|
+
exports.findConfig = findConfig;
|
|
6
|
+
exports.getConfig = getConfig;
|
|
7
|
+
exports.createConfig = createConfig;
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const redocly_1 = require("../redocly");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const js_yaml_1 = require("../js-yaml");
|
|
13
|
+
const utils_2 = require("./utils");
|
|
14
|
+
const config_resolvers_1 = require("./config-resolvers");
|
|
15
|
+
const bundle_1 = require("../bundle");
|
|
16
|
+
const resolve_1 = require("../resolve");
|
|
17
|
+
const env_1 = require("../env");
|
|
18
|
+
const domains_1 = require("../redocly/domains");
|
|
19
|
+
async function addConfigMetadata({ rawConfig, customExtends, configPath, tokens, files, region, externalRefResolver, }) {
|
|
10
20
|
if (customExtends !== undefined) {
|
|
11
21
|
rawConfig.styleguide = rawConfig.styleguide || {};
|
|
12
22
|
rawConfig.styleguide.extends = customExtends;
|
|
13
23
|
}
|
|
14
|
-
else if (isEmptyObject(rawConfig)) {
|
|
24
|
+
else if ((0, utils_1.isEmptyObject)(rawConfig)) {
|
|
15
25
|
rawConfig.styleguide = { extends: ['recommended'], recommendedFallback: true };
|
|
16
26
|
}
|
|
17
|
-
|
|
18
|
-
rawConfig
|
|
27
|
+
if (tokens?.length) {
|
|
28
|
+
if (!rawConfig.resolve)
|
|
29
|
+
rawConfig.resolve = {};
|
|
30
|
+
if (!rawConfig.resolve.http)
|
|
31
|
+
rawConfig.resolve.http = {};
|
|
32
|
+
rawConfig.resolve.http.headers = [...(rawConfig.resolve.http.headers ?? [])];
|
|
33
|
+
for (const item of tokens) {
|
|
34
|
+
const domain = domains_1.DOMAINS[item.region];
|
|
35
|
+
rawConfig.resolve.http.headers.push({
|
|
36
|
+
matches: `https://api.${domain}/registry/**`,
|
|
37
|
+
name: 'Authorization',
|
|
38
|
+
envVariable: undefined,
|
|
39
|
+
value: item.token,
|
|
40
|
+
},
|
|
41
|
+
//support redocly.com domain for future compatibility
|
|
42
|
+
...(item.region === 'us'
|
|
43
|
+
? [
|
|
44
|
+
{
|
|
45
|
+
matches: `https://api.redoc.ly/registry/**`,
|
|
46
|
+
name: 'Authorization',
|
|
47
|
+
envVariable: undefined,
|
|
48
|
+
value: item.token,
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: []));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return (0, config_resolvers_1.resolveConfig)({
|
|
55
|
+
rawConfig: {
|
|
56
|
+
...rawConfig,
|
|
57
|
+
files: files ?? rawConfig.files,
|
|
58
|
+
region: region ?? rawConfig.region,
|
|
59
|
+
},
|
|
19
60
|
configPath,
|
|
20
61
|
externalRefResolver,
|
|
21
62
|
});
|
|
22
63
|
}
|
|
23
|
-
|
|
24
|
-
const { configPath = findConfig(), customExtends, processRawConfig, externalRefResolver, } = options;
|
|
64
|
+
async function loadConfig(options = {}) {
|
|
65
|
+
const { configPath = findConfig(), customExtends, processRawConfig, files, region, externalRefResolver, } = options;
|
|
25
66
|
const { rawConfig, document, parsed, resolvedRefMap } = await getConfig({
|
|
26
67
|
configPath,
|
|
27
68
|
externalRefResolver,
|
|
28
69
|
});
|
|
70
|
+
const redoclyClient = env_1.isBrowser ? undefined : new redocly_1.RedoclyClient();
|
|
71
|
+
const tokens = redoclyClient && redoclyClient.hasTokens() ? redoclyClient.getAllTokens() : [];
|
|
29
72
|
const config = await addConfigMetadata({
|
|
30
73
|
rawConfig,
|
|
31
74
|
customExtends,
|
|
32
75
|
configPath,
|
|
76
|
+
tokens,
|
|
77
|
+
files,
|
|
78
|
+
region,
|
|
33
79
|
externalRefResolver,
|
|
34
80
|
});
|
|
35
81
|
if (document && parsed && resolvedRefMap && typeof processRawConfig === 'function') {
|
|
@@ -42,7 +88,7 @@ export async function loadConfig(options = {}) {
|
|
|
42
88
|
});
|
|
43
89
|
}
|
|
44
90
|
catch (e) {
|
|
45
|
-
if (e instanceof ConfigValidationError) {
|
|
91
|
+
if (e instanceof utils_2.ConfigValidationError) {
|
|
46
92
|
throw e;
|
|
47
93
|
}
|
|
48
94
|
throw new Error(`Error parsing config file at '${configPath}': ${e.message}`);
|
|
@@ -50,11 +96,11 @@ export async function loadConfig(options = {}) {
|
|
|
50
96
|
}
|
|
51
97
|
return config;
|
|
52
98
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (!fs?.existsSync)
|
|
99
|
+
exports.CONFIG_FILE_NAMES = ['redocly.yaml', 'redocly.yml', '.redocly.yaml', '.redocly.yml'];
|
|
100
|
+
function findConfig(dir) {
|
|
101
|
+
if (!fs?.hasOwnProperty?.('existsSync'))
|
|
56
102
|
return;
|
|
57
|
-
const existingConfigFiles = CONFIG_FILE_NAMES.map((name) => dir ? path.resolve(dir, name) : name).filter(fs.existsSync);
|
|
103
|
+
const existingConfigFiles = exports.CONFIG_FILE_NAMES.map((name) => dir ? path.resolve(dir, name) : name).filter(fs.existsSync);
|
|
58
104
|
if (existingConfigFiles.length > 1) {
|
|
59
105
|
throw new Error(`
|
|
60
106
|
Multiple configuration files are not allowed.
|
|
@@ -64,19 +110,19 @@ export function findConfig(dir) {
|
|
|
64
110
|
}
|
|
65
111
|
return existingConfigFiles[0];
|
|
66
112
|
}
|
|
67
|
-
|
|
68
|
-
const { configPath = findConfig(), externalRefResolver = new BaseResolver() } = options;
|
|
113
|
+
async function getConfig(options = {}) {
|
|
114
|
+
const { configPath = findConfig(), externalRefResolver = new resolve_1.BaseResolver() } = options;
|
|
69
115
|
if (!configPath)
|
|
70
116
|
return { rawConfig: {} };
|
|
71
117
|
try {
|
|
72
|
-
const { document, resolvedRefMap } = await resolveConfigFileAndRefs({
|
|
118
|
+
const { document, resolvedRefMap } = await (0, config_resolvers_1.resolveConfigFileAndRefs)({
|
|
73
119
|
configPath,
|
|
74
120
|
externalRefResolver,
|
|
75
121
|
});
|
|
76
|
-
const bundledRefMap = deepCloneMapWithJSON(resolvedRefMap);
|
|
77
|
-
const parsed = await bundleConfig(JSON.parse(JSON.stringify(document)), bundledRefMap);
|
|
122
|
+
const bundledRefMap = (0, utils_2.deepCloneMapWithJSON)(resolvedRefMap);
|
|
123
|
+
const parsed = await (0, bundle_1.bundleConfig)(JSON.parse(JSON.stringify(document)), bundledRefMap);
|
|
78
124
|
return {
|
|
79
|
-
rawConfig: transformConfig(parsed),
|
|
125
|
+
rawConfig: (0, utils_2.transformConfig)(parsed),
|
|
80
126
|
document,
|
|
81
127
|
parsed,
|
|
82
128
|
resolvedRefMap,
|
|
@@ -86,10 +132,9 @@ export async function getConfig(options = {}) {
|
|
|
86
132
|
throw new Error(`Error parsing config file at '${configPath}': ${e.message}`);
|
|
87
133
|
}
|
|
88
134
|
}
|
|
89
|
-
|
|
135
|
+
async function createConfig(config, options) {
|
|
90
136
|
return addConfigMetadata({
|
|
91
|
-
rawConfig: transformConfig(typeof config === 'string' ? parseYaml(config) : config),
|
|
137
|
+
rawConfig: (0, utils_2.transformConfig)(typeof config === 'string' ? (0, js_yaml_1.parseYaml)(config) : config),
|
|
92
138
|
...options,
|
|
93
139
|
});
|
|
94
140
|
}
|
|
95
|
-
//# sourceMappingURL=load.js.map
|
package/lib/config/minimal.d.ts
CHANGED
package/lib/config/minimal.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
const minimal = {
|
|
2
4
|
rules: {
|
|
3
5
|
struct: 'error',
|
|
@@ -204,5 +206,4 @@ const minimal = {
|
|
|
204
206
|
'info-contact': 'off',
|
|
205
207
|
},
|
|
206
208
|
};
|
|
207
|
-
|
|
208
|
-
//# sourceMappingURL=minimal.js.map
|
|
209
|
+
exports.default = minimal;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PluginStyleguideConfig } from './types
|
|
1
|
+
import type { PluginStyleguideConfig } from './types';
|
|
2
2
|
declare const recommendedStrict: PluginStyleguideConfig<'built-in'>;
|
|
3
3
|
export default recommendedStrict;
|
|
4
|
-
//# sourceMappingURL=recommended-strict.d.ts.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
const recommendedStrict = {
|
|
2
4
|
rules: {
|
|
3
5
|
struct: 'error',
|
|
@@ -204,5 +206,4 @@ const recommendedStrict = {
|
|
|
204
206
|
'info-contact': 'off',
|
|
205
207
|
},
|
|
206
208
|
};
|
|
207
|
-
|
|
208
|
-
//# sourceMappingURL=recommended-strict.js.map
|
|
209
|
+
exports.default = recommendedStrict;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
const recommended = {
|
|
2
4
|
rules: {
|
|
3
5
|
struct: 'error',
|
|
@@ -204,5 +206,4 @@ const recommended = {
|
|
|
204
206
|
'info-contact': 'off',
|
|
205
207
|
},
|
|
206
208
|
};
|
|
207
|
-
|
|
208
|
-
//# sourceMappingURL=recommended.js.map
|
|
209
|
+
exports.default = recommended;
|
package/lib/config/rules.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Arazzo1RuleSet, Async2RuleSet, Async3RuleSet, Oas2RuleSet, Oas3RuleSet, Overlay1RuleSet, SpecVersion } from '../oas-types
|
|
2
|
-
import type { StyleguideConfig } from './config
|
|
3
|
-
import type { ProblemSeverity } from '../walk
|
|
1
|
+
import type { Arazzo1RuleSet, Async2RuleSet, Async3RuleSet, Oas2RuleSet, Oas3RuleSet, Overlay1RuleSet, SpecVersion } from '../oas-types';
|
|
2
|
+
import type { StyleguideConfig } from './config';
|
|
3
|
+
import type { ProblemSeverity } from '../walk';
|
|
4
4
|
type InitializedRule = {
|
|
5
5
|
severity: ProblemSeverity;
|
|
6
6
|
ruleId: string;
|
|
@@ -8,4 +8,3 @@ type InitializedRule = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function initRules(rules: (Oas3RuleSet | Oas2RuleSet | Async2RuleSet | Async3RuleSet | Arazzo1RuleSet | Overlay1RuleSet)[], config: StyleguideConfig, type: 'rules' | 'preprocessors' | 'decorators', oasVersion: SpecVersion): InitializedRule[];
|
|
10
10
|
export {};
|
|
11
|
-
//# sourceMappingURL=rules.d.ts.map
|
package/lib/config/rules.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initRules = initRules;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
function initRules(rules, config, type, oasVersion) {
|
|
3
6
|
return rules
|
|
4
7
|
.flatMap((ruleset) => Object.keys(ruleset).map((ruleId) => {
|
|
5
8
|
const rule = ruleset[ruleId];
|
|
@@ -30,6 +33,5 @@ export function initRules(rules, config, type, oasVersion) {
|
|
|
30
33
|
};
|
|
31
34
|
}))
|
|
32
35
|
.flatMap((visitor) => visitor)
|
|
33
|
-
.filter(isDefined);
|
|
36
|
+
.filter(utils_1.isDefined);
|
|
34
37
|
}
|
|
35
|
-
//# sourceMappingURL=rules.js.map
|
package/lib/config/spec.d.ts
CHANGED