@redocly/openapi-core 1.34.4 → 2.0.0-next.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/README.md +42 -4
- package/lib/bundle.d.ts +16 -15
- package/lib/bundle.d.ts.map +1 -0
- package/lib/bundle.js +88 -109
- package/lib/bundle.js.map +1 -0
- package/lib/config/all.d.ts +3 -2
- package/lib/config/all.d.ts.map +1 -0
- package/lib/config/all.js +11 -3
- package/lib/config/all.js.map +1 -0
- package/lib/config/builtIn.d.ts +3 -2
- package/lib/config/builtIn.d.ts.map +1 -0
- package/lib/config/builtIn.js +44 -49
- package/lib/config/builtIn.js.map +1 -0
- package/lib/config/bundle-extends.d.ts +8 -0
- package/lib/config/bundle-extends.d.ts.map +1 -0
- package/lib/config/bundle-extends.js +27 -0
- package/lib/config/bundle-extends.js.map +1 -0
- package/lib/config/config-resolvers.d.ts +15 -27
- package/lib/config/config-resolvers.d.ts.map +1 -0
- package/lib/config/config-resolvers.js +259 -373
- package/lib/config/config-resolvers.js.map +1 -0
- package/lib/config/config.d.ts +22 -26
- package/lib/config/config.d.ts.map +1 -0
- package/lib/config/config.js +104 -112
- package/lib/config/config.js.map +1 -0
- package/lib/config/index.d.ts +8 -7
- package/lib/config/index.d.ts.map +1 -0
- package/lib/config/index.js +8 -23
- package/lib/config/index.js.map +1 -0
- package/lib/config/load.d.ts +8 -19
- package/lib/config/load.d.ts.map +1 -0
- package/lib/config/load.js +62 -107
- package/lib/config/load.js.map +1 -0
- package/lib/config/minimal.d.ts +3 -2
- package/lib/config/minimal.d.ts.map +1 -0
- package/lib/config/minimal.js +11 -3
- package/lib/config/minimal.js.map +1 -0
- package/lib/config/recommended-strict.d.ts +3 -2
- package/lib/config/recommended-strict.d.ts.map +1 -0
- package/lib/config/recommended-strict.js +11 -3
- package/lib/config/recommended-strict.js.map +1 -0
- package/lib/config/recommended.d.ts +3 -2
- package/lib/config/recommended.d.ts.map +1 -0
- package/lib/config/recommended.js +11 -3
- package/lib/config/recommended.js.map +1 -0
- package/lib/config/rules.d.ts +5 -4
- package/lib/config/rules.d.ts.map +1 -0
- package/lib/config/rules.js +4 -6
- package/lib/config/rules.js.map +1 -0
- package/lib/config/spec.d.ts +3 -2
- package/lib/config/spec.d.ts.map +1 -0
- package/lib/config/spec.js +6 -4
- package/lib/config/spec.js.map +1 -0
- package/lib/config/types.d.ts +19 -62
- package/lib/config/types.d.ts.map +1 -0
- package/lib/config/types.js +2 -2
- package/lib/config/types.js.map +1 -0
- package/lib/config/utils.d.ts +5 -9
- package/lib/config/utils.d.ts.map +1 -0
- package/lib/config/utils.js +56 -258
- package/lib/config/utils.js.map +1 -0
- package/lib/config/visitors.d.ts +36 -0
- package/lib/config/visitors.d.ts.map +1 -0
- package/lib/config/visitors.js +88 -0
- package/lib/config/visitors.js.map +1 -0
- package/lib/decorators/arazzo/index.d.ts +1 -0
- package/lib/decorators/arazzo/index.d.ts.map +1 -0
- package/lib/decorators/arazzo/index.js +2 -4
- package/lib/decorators/arazzo/index.js.map +1 -0
- package/lib/decorators/async2/index.d.ts +1 -0
- package/lib/decorators/async2/index.d.ts.map +1 -0
- package/lib/decorators/async2/index.js +2 -4
- package/lib/decorators/async2/index.js.map +1 -0
- package/lib/decorators/async3/index.d.ts +1 -0
- package/lib/decorators/async3/index.d.ts.map +1 -0
- package/lib/decorators/async3/index.js +2 -4
- package/lib/decorators/async3/index.js.map +1 -0
- package/lib/decorators/common/filters/filter-helper.d.ts +2 -1
- package/lib/decorators/common/filters/filter-helper.d.ts.map +1 -0
- package/lib/decorators/common/filters/filter-helper.js +9 -12
- package/lib/decorators/common/filters/filter-helper.js.map +1 -0
- package/lib/decorators/common/filters/filter-in.d.ts +2 -1
- package/lib/decorators/common/filters/filter-in.d.ts.map +1 -0
- package/lib/decorators/common/filters/filter-in.js +5 -8
- package/lib/decorators/common/filters/filter-in.js.map +1 -0
- package/lib/decorators/common/filters/filter-out.d.ts +2 -1
- package/lib/decorators/common/filters/filter-out.d.ts.map +1 -0
- package/lib/decorators/common/filters/filter-out.js +5 -8
- package/lib/decorators/common/filters/filter-out.js.map +1 -0
- package/lib/decorators/common/info-description-override.d.ts +2 -1
- package/lib/decorators/common/info-description-override.d.ts.map +1 -0
- package/lib/decorators/common/info-description-override.js +4 -7
- package/lib/decorators/common/info-description-override.js.map +1 -0
- package/lib/decorators/common/info-override.d.ts +2 -1
- package/lib/decorators/common/info-override.d.ts.map +1 -0
- package/lib/decorators/common/info-override.js +2 -5
- package/lib/decorators/common/info-override.js.map +1 -0
- package/lib/decorators/common/media-type-examples-override.d.ts +2 -1
- package/lib/decorators/common/media-type-examples-override.d.ts.map +1 -0
- package/lib/decorators/common/media-type-examples-override.js +7 -10
- package/lib/decorators/common/media-type-examples-override.js.map +1 -0
- package/lib/decorators/common/operation-description-override.d.ts +2 -1
- package/lib/decorators/common/operation-description-override.d.ts.map +1 -0
- package/lib/decorators/common/operation-description-override.js +4 -7
- package/lib/decorators/common/operation-description-override.js.map +1 -0
- package/lib/decorators/common/remove-x-internal.d.ts +2 -1
- package/lib/decorators/common/remove-x-internal.d.ts.map +1 -0
- package/lib/decorators/common/remove-x-internal.js +11 -14
- package/lib/decorators/common/remove-x-internal.js.map +1 -0
- package/lib/decorators/common/tag-description-override.d.ts +2 -1
- package/lib/decorators/common/tag-description-override.d.ts.map +1 -0
- package/lib/decorators/common/tag-description-override.js +4 -7
- package/lib/decorators/common/tag-description-override.js.map +1 -0
- package/lib/decorators/oas2/index.d.ts +2 -2
- package/lib/decorators/oas2/index.d.ts.map +1 -0
- package/lib/decorators/oas2/index.js +16 -20
- package/lib/decorators/oas2/index.js.map +1 -0
- package/lib/decorators/oas2/remove-unused-components.d.ts +2 -1
- package/lib/decorators/oas2/remove-unused-components.d.ts.map +1 -0
- package/lib/decorators/oas2/remove-unused-components.js +4 -7
- package/lib/decorators/oas2/remove-unused-components.js.map +1 -0
- package/lib/decorators/oas3/index.d.ts +2 -2
- package/lib/decorators/oas3/index.d.ts.map +1 -0
- package/lib/decorators/oas3/index.js +18 -22
- package/lib/decorators/oas3/index.js.map +1 -0
- package/lib/decorators/oas3/remove-unused-components.d.ts +2 -1
- package/lib/decorators/oas3/remove-unused-components.d.ts.map +1 -0
- package/lib/decorators/oas3/remove-unused-components.js +5 -8
- package/lib/decorators/oas3/remove-unused-components.js.map +1 -0
- package/lib/decorators/overlay1/index.d.ts +1 -0
- package/lib/decorators/overlay1/index.d.ts.map +1 -0
- package/lib/decorators/overlay1/index.js +2 -4
- package/lib/decorators/overlay1/index.js.map +1 -0
- package/lib/env.d.ts +1 -0
- package/lib/env.d.ts.map +1 -0
- package/lib/env.js +3 -5
- package/lib/env.js.map +1 -0
- package/lib/format/codeframes.d.ts +2 -1
- package/lib/format/codeframes.d.ts.map +1 -0
- package/lib/format/codeframes.js +15 -19
- package/lib/format/codeframes.js.map +1 -0
- package/lib/format/format.d.ts +2 -1
- package/lib/format/format.d.ts.map +1 -0
- package/lib/format/format.js +57 -62
- package/lib/format/format.js.map +1 -0
- package/lib/index.d.ts +31 -26
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +25 -98
- package/lib/index.js.map +1 -0
- package/lib/js-yaml/index.d.ts +1 -0
- package/lib/js-yaml/index.d.ts.map +1 -0
- package/lib/js-yaml/index.js +7 -11
- package/lib/js-yaml/index.js.map +1 -0
- package/lib/lint.d.ts +12 -13
- package/lib/lint.d.ts.map +1 -0
- package/lib/lint.js +46 -50
- package/lib/lint.js.map +1 -0
- package/lib/logger.d.ts +2 -1
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +15 -17
- package/lib/logger.js.map +1 -0
- package/lib/oas-types.d.ts +395 -3
- package/lib/oas-types.d.ts.map +1 -0
- package/lib/oas-types.js +28 -32
- package/lib/oas-types.js.map +1 -0
- package/lib/ref-utils.d.ts +5 -2
- package/lib/ref-utils.d.ts.map +1 -0
- package/lib/ref-utils.js +30 -33
- package/lib/ref-utils.js.map +1 -0
- package/lib/resolve.d.ts +7 -9
- package/lib/resolve.d.ts.map +1 -0
- package/lib/resolve.js +40 -47
- package/lib/resolve.js.map +1 -0
- package/lib/rules/ajv.d.ts +4 -3
- package/lib/rules/ajv.d.ts.map +1 -0
- package/lib/rules/ajv.js +7 -10
- package/lib/rules/ajv.js.map +1 -0
- package/lib/rules/arazzo/criteria-unique.d.ts +2 -1
- package/lib/rules/arazzo/criteria-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/criteria-unique.js +2 -5
- package/lib/rules/arazzo/criteria-unique.js.map +1 -0
- package/lib/rules/arazzo/index.d.ts +2 -1
- package/lib/rules/arazzo/index.d.ts.map +1 -0
- package/lib/rules/arazzo/index.js +39 -35
- package/lib/rules/arazzo/index.js.map +1 -0
- package/lib/rules/arazzo/parameters-unique.d.ts +2 -1
- package/lib/rules/arazzo/parameters-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/parameters-unique.js +2 -5
- package/lib/rules/arazzo/parameters-unique.js.map +1 -0
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +2 -1
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/requestBody-replacements-unique.js +2 -5
- package/lib/rules/arazzo/requestBody-replacements-unique.js.map +1 -0
- package/lib/rules/arazzo/sourceDescription-type.d.ts +2 -1
- package/lib/rules/arazzo/sourceDescription-type.d.ts.map +1 -0
- package/lib/rules/arazzo/sourceDescription-type.js +2 -5
- package/lib/rules/arazzo/sourceDescription-type.js.map +1 -0
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +2 -1
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/sourceDescriptions-name-unique.js +2 -5
- package/lib/rules/arazzo/sourceDescriptions-name-unique.js.map +1 -0
- package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts +2 -1
- package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts.map +1 -0
- package/lib/rules/arazzo/sourceDescriptions-not-empty.js +2 -5
- package/lib/rules/arazzo/sourceDescriptions-not-empty.js.map +1 -0
- package/lib/rules/arazzo/step-onFailure-unique.d.ts +2 -1
- package/lib/rules/arazzo/step-onFailure-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/step-onFailure-unique.js +2 -5
- package/lib/rules/arazzo/step-onFailure-unique.js.map +1 -0
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts +2 -1
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/step-onSuccess-unique.js +2 -5
- package/lib/rules/arazzo/step-onSuccess-unique.js.map +1 -0
- package/lib/rules/arazzo/stepId-unique.d.ts +2 -1
- package/lib/rules/arazzo/stepId-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/stepId-unique.js +2 -5
- package/lib/rules/arazzo/stepId-unique.js.map +1 -0
- package/lib/rules/arazzo/workflow-dependsOn.d.ts +2 -1
- package/lib/rules/arazzo/workflow-dependsOn.d.ts.map +1 -0
- package/lib/rules/arazzo/workflow-dependsOn.js +2 -5
- package/lib/rules/arazzo/workflow-dependsOn.js.map +1 -0
- package/lib/rules/arazzo/workflowId-unique.d.ts +2 -1
- package/lib/rules/arazzo/workflowId-unique.d.ts.map +1 -0
- package/lib/rules/arazzo/workflowId-unique.js +2 -5
- package/lib/rules/arazzo/workflowId-unique.js.map +1 -0
- package/lib/rules/async2/channels-kebab-case.d.ts +2 -1
- package/lib/rules/async2/channels-kebab-case.d.ts.map +1 -0
- package/lib/rules/async2/channels-kebab-case.js +2 -5
- package/lib/rules/async2/channels-kebab-case.js.map +1 -0
- package/lib/rules/async2/index.d.ts +2 -1
- package/lib/rules/async2/index.d.ts.map +1 -0
- package/lib/rules/async2/index.js +23 -26
- package/lib/rules/async2/index.js.map +1 -0
- package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -1
- package/lib/rules/async2/no-channel-trailing-slash.d.ts.map +1 -0
- package/lib/rules/async2/no-channel-trailing-slash.js +2 -5
- package/lib/rules/async2/no-channel-trailing-slash.js.map +1 -0
- package/lib/rules/async3/channels-kebab-case.d.ts +2 -1
- package/lib/rules/async3/channels-kebab-case.d.ts.map +1 -0
- package/lib/rules/async3/channels-kebab-case.js +2 -5
- package/lib/rules/async3/channels-kebab-case.js.map +1 -0
- package/lib/rules/async3/index.d.ts +2 -1
- package/lib/rules/async3/index.d.ts.map +1 -0
- package/lib/rules/async3/index.js +23 -26
- package/lib/rules/async3/index.js.map +1 -0
- package/lib/rules/async3/no-channel-trailing-slash.d.ts +2 -1
- package/lib/rules/async3/no-channel-trailing-slash.d.ts.map +1 -0
- package/lib/rules/async3/no-channel-trailing-slash.js +3 -6
- package/lib/rules/async3/no-channel-trailing-slash.js.map +1 -0
- package/lib/rules/common/assertions/asserts.d.ts +3 -3
- package/lib/rules/common/assertions/asserts.d.ts.map +1 -0
- package/lib/rules/common/assertions/asserts.js +35 -51
- package/lib/rules/common/assertions/asserts.js.map +1 -0
- package/lib/rules/common/assertions/index.d.ts +4 -3
- package/lib/rules/common/assertions/index.d.ts.map +1 -0
- package/lib/rules/common/assertions/index.js +7 -10
- package/lib/rules/common/assertions/index.js.map +1 -0
- package/lib/rules/common/assertions/utils.d.ts +5 -4
- package/lib/rules/common/assertions/utils.d.ts.map +1 -0
- package/lib/rules/common/assertions/utils.js +21 -29
- package/lib/rules/common/assertions/utils.js.map +1 -0
- package/lib/rules/common/info-contact.d.ts +2 -1
- package/lib/rules/common/info-contact.d.ts.map +1 -0
- package/lib/rules/common/info-contact.js +4 -7
- package/lib/rules/common/info-contact.js.map +1 -0
- package/lib/rules/common/info-license-strict.d.ts +2 -1
- package/lib/rules/common/info-license-strict.d.ts.map +1 -0
- package/lib/rules/common/info-license-strict.js +7 -10
- package/lib/rules/common/info-license-strict.js.map +1 -0
- package/lib/rules/common/info-license-url.d.ts +2 -1
- package/lib/rules/common/info-license-url.d.ts.map +1 -0
- package/lib/rules/common/info-license-url.js +4 -7
- package/lib/rules/common/info-license-url.js.map +1 -0
- package/lib/rules/common/info-license.d.ts +2 -1
- package/lib/rules/common/info-license.d.ts.map +1 -0
- package/lib/rules/common/info-license.js +4 -7
- package/lib/rules/common/info-license.js.map +1 -0
- package/lib/rules/common/no-ambiguous-paths.d.ts +2 -1
- package/lib/rules/common/no-ambiguous-paths.d.ts.map +1 -0
- package/lib/rules/common/no-ambiguous-paths.js +2 -5
- package/lib/rules/common/no-ambiguous-paths.js.map +1 -0
- package/lib/rules/common/no-duplicated-tag-names.d.ts +3 -0
- package/lib/rules/common/no-duplicated-tag-names.d.ts.map +1 -0
- package/lib/rules/common/no-duplicated-tag-names.js +21 -0
- package/lib/rules/common/no-duplicated-tag-names.js.map +1 -0
- package/lib/rules/common/no-enum-type-mismatch.d.ts +2 -1
- package/lib/rules/common/no-enum-type-mismatch.d.ts.map +1 -0
- package/lib/rules/common/no-enum-type-mismatch.js +6 -9
- package/lib/rules/common/no-enum-type-mismatch.js.map +1 -0
- package/lib/rules/common/no-http-verbs-in-paths.d.ts +2 -1
- package/lib/rules/common/no-http-verbs-in-paths.d.ts.map +1 -0
- package/lib/rules/common/no-http-verbs-in-paths.js +5 -8
- package/lib/rules/common/no-http-verbs-in-paths.js.map +1 -0
- package/lib/rules/common/no-identical-paths.d.ts +2 -1
- package/lib/rules/common/no-identical-paths.d.ts.map +1 -0
- package/lib/rules/common/no-identical-paths.js +2 -5
- package/lib/rules/common/no-identical-paths.js.map +1 -0
- package/lib/rules/common/no-invalid-parameter-examples.d.ts +1 -0
- package/lib/rules/common/no-invalid-parameter-examples.d.ts.map +1 -0
- package/lib/rules/common/no-invalid-parameter-examples.js +5 -9
- package/lib/rules/common/no-invalid-parameter-examples.js.map +1 -0
- package/lib/rules/common/no-invalid-schema-examples.d.ts +2 -1
- package/lib/rules/common/no-invalid-schema-examples.d.ts.map +1 -0
- package/lib/rules/common/no-invalid-schema-examples.js +5 -9
- package/lib/rules/common/no-invalid-schema-examples.js.map +1 -0
- package/lib/rules/common/no-path-trailing-slash.d.ts +2 -1
- package/lib/rules/common/no-path-trailing-slash.d.ts.map +1 -0
- package/lib/rules/common/no-path-trailing-slash.js +2 -5
- package/lib/rules/common/no-path-trailing-slash.js.map +1 -0
- package/lib/rules/common/no-required-schema-properties-undefined.d.ts +2 -1
- package/lib/rules/common/no-required-schema-properties-undefined.d.ts.map +1 -0
- package/lib/rules/common/no-required-schema-properties-undefined.js +6 -8
- package/lib/rules/common/no-required-schema-properties-undefined.js.map +1 -0
- package/lib/rules/common/no-schema-type-mismatch.d.ts +2 -1
- package/lib/rules/common/no-schema-type-mismatch.d.ts.map +1 -0
- package/lib/rules/common/no-schema-type-mismatch.js +2 -5
- package/lib/rules/common/no-schema-type-mismatch.js.map +1 -0
- package/lib/rules/common/operation-2xx-response.d.ts +2 -1
- package/lib/rules/common/operation-2xx-response.d.ts.map +1 -0
- package/lib/rules/common/operation-2xx-response.js +5 -8
- package/lib/rules/common/operation-2xx-response.js.map +1 -0
- package/lib/rules/common/operation-4xx-response.d.ts +2 -1
- package/lib/rules/common/operation-4xx-response.d.ts.map +1 -0
- package/lib/rules/common/operation-4xx-response.js +5 -8
- package/lib/rules/common/operation-4xx-response.js.map +1 -0
- package/lib/rules/common/operation-description.d.ts +2 -1
- package/lib/rules/common/operation-description.d.ts.map +1 -0
- package/lib/rules/common/operation-description.js +4 -7
- package/lib/rules/common/operation-description.js.map +1 -0
- package/lib/rules/common/operation-operationId-unique.d.ts +2 -1
- package/lib/rules/common/operation-operationId-unique.d.ts.map +1 -0
- package/lib/rules/common/operation-operationId-unique.js +2 -5
- package/lib/rules/common/operation-operationId-unique.js.map +1 -0
- package/lib/rules/common/operation-operationId-url-safe.d.ts +2 -1
- package/lib/rules/common/operation-operationId-url-safe.d.ts.map +1 -0
- package/lib/rules/common/operation-operationId-url-safe.js +2 -5
- package/lib/rules/common/operation-operationId-url-safe.js.map +1 -0
- package/lib/rules/common/operation-operationId.d.ts +2 -1
- package/lib/rules/common/operation-operationId.d.ts.map +1 -0
- package/lib/rules/common/operation-operationId.js +4 -7
- package/lib/rules/common/operation-operationId.js.map +1 -0
- package/lib/rules/common/operation-parameters-unique.d.ts +2 -1
- package/lib/rules/common/operation-parameters-unique.d.ts.map +1 -0
- package/lib/rules/common/operation-parameters-unique.js +2 -5
- package/lib/rules/common/operation-parameters-unique.js.map +1 -0
- package/lib/rules/common/operation-singular-tag.d.ts +2 -1
- package/lib/rules/common/operation-singular-tag.d.ts.map +1 -0
- package/lib/rules/common/operation-singular-tag.js +2 -5
- package/lib/rules/common/operation-singular-tag.js.map +1 -0
- package/lib/rules/common/operation-summary.d.ts +2 -1
- package/lib/rules/common/operation-summary.d.ts.map +1 -0
- package/lib/rules/common/operation-summary.js +4 -7
- package/lib/rules/common/operation-summary.js.map +1 -0
- package/lib/rules/common/operation-tag-defined.d.ts +2 -1
- package/lib/rules/common/operation-tag-defined.d.ts.map +1 -0
- package/lib/rules/common/operation-tag-defined.js +2 -5
- package/lib/rules/common/operation-tag-defined.js.map +1 -0
- package/lib/rules/common/parameter-description.d.ts +2 -1
- package/lib/rules/common/parameter-description.d.ts.map +1 -0
- package/lib/rules/common/parameter-description.js +2 -5
- package/lib/rules/common/parameter-description.js.map +1 -0
- package/lib/rules/common/path-declaration-must-exist.d.ts +2 -1
- package/lib/rules/common/path-declaration-must-exist.d.ts.map +1 -0
- package/lib/rules/common/path-declaration-must-exist.js +2 -5
- package/lib/rules/common/path-declaration-must-exist.js.map +1 -0
- package/lib/rules/common/path-excludes-patterns.d.ts +2 -1
- package/lib/rules/common/path-excludes-patterns.d.ts.map +1 -0
- package/lib/rules/common/path-excludes-patterns.js +2 -5
- package/lib/rules/common/path-excludes-patterns.js.map +1 -0
- package/lib/rules/common/path-http-verbs-order.d.ts +2 -1
- package/lib/rules/common/path-http-verbs-order.d.ts.map +1 -0
- package/lib/rules/common/path-http-verbs-order.js +2 -5
- package/lib/rules/common/path-http-verbs-order.js.map +1 -0
- package/lib/rules/common/path-not-include-query.d.ts +2 -1
- package/lib/rules/common/path-not-include-query.d.ts.map +1 -0
- package/lib/rules/common/path-not-include-query.js +2 -5
- package/lib/rules/common/path-not-include-query.js.map +1 -0
- package/lib/rules/common/path-params-defined.d.ts +2 -1
- package/lib/rules/common/path-params-defined.d.ts.map +1 -0
- package/lib/rules/common/path-params-defined.js +2 -5
- package/lib/rules/common/path-params-defined.js.map +1 -0
- package/lib/rules/common/path-segment-plural.d.ts +2 -1
- package/lib/rules/common/path-segment-plural.d.ts.map +1 -0
- package/lib/rules/common/path-segment-plural.js +6 -9
- package/lib/rules/common/path-segment-plural.js.map +1 -0
- package/lib/rules/common/paths-kebab-case.d.ts +2 -1
- package/lib/rules/common/paths-kebab-case.d.ts.map +1 -0
- package/lib/rules/common/paths-kebab-case.js +2 -5
- package/lib/rules/common/paths-kebab-case.js.map +1 -0
- package/lib/rules/common/required-string-property-missing-min-length.d.ts +2 -1
- package/lib/rules/common/required-string-property-missing-min-length.d.ts.map +1 -0
- package/lib/rules/common/required-string-property-missing-min-length.js +2 -5
- package/lib/rules/common/required-string-property-missing-min-length.js.map +1 -0
- package/lib/rules/common/response-contains-header.d.ts +2 -1
- package/lib/rules/common/response-contains-header.d.ts.map +1 -0
- package/lib/rules/common/response-contains-header.js +5 -8
- package/lib/rules/common/response-contains-header.js.map +1 -0
- package/lib/rules/common/scalar-property-missing-example.d.ts +2 -1
- package/lib/rules/common/scalar-property-missing-example.d.ts.map +1 -0
- package/lib/rules/common/scalar-property-missing-example.js +6 -8
- package/lib/rules/common/scalar-property-missing-example.js.map +1 -0
- package/lib/rules/common/security-defined.d.ts +2 -1
- package/lib/rules/common/security-defined.d.ts.map +1 -0
- package/lib/rules/common/security-defined.js +2 -5
- package/lib/rules/common/security-defined.js.map +1 -0
- package/lib/rules/common/spec-strict-refs.d.ts +2 -1
- package/lib/rules/common/spec-strict-refs.d.ts.map +1 -0
- package/lib/rules/common/spec-strict-refs.js +4 -7
- package/lib/rules/common/spec-strict-refs.js.map +1 -0
- package/lib/rules/common/struct.d.ts +2 -1
- package/lib/rules/common/struct.d.ts.map +1 -0
- package/lib/rules/common/struct.js +19 -28
- package/lib/rules/common/struct.js.map +1 -0
- package/lib/rules/common/tag-description.d.ts +2 -1
- package/lib/rules/common/tag-description.d.ts.map +1 -0
- package/lib/rules/common/tag-description.js +4 -7
- package/lib/rules/common/tag-description.js.map +1 -0
- package/lib/rules/common/tags-alphabetical.d.ts +2 -1
- package/lib/rules/common/tags-alphabetical.d.ts.map +1 -0
- package/lib/rules/common/tags-alphabetical.js +3 -8
- package/lib/rules/common/tags-alphabetical.js.map +1 -0
- package/lib/rules/no-unresolved-refs.d.ts +4 -3
- package/lib/rules/no-unresolved-refs.d.ts.map +1 -0
- package/lib/rules/no-unresolved-refs.js +5 -9
- package/lib/rules/no-unresolved-refs.js.map +1 -0
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +2 -1
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts.map +1 -0
- package/lib/rules/oas2/boolean-parameter-prefixes.js +2 -5
- package/lib/rules/oas2/boolean-parameter-prefixes.js.map +1 -0
- package/lib/rules/oas2/index.d.ts +2 -1
- package/lib/rules/oas2/index.d.ts.map +1 -0
- package/lib/rules/oas2/index.js +96 -99
- package/lib/rules/oas2/index.js.map +1 -0
- package/lib/rules/oas2/request-mime-type.d.ts +2 -1
- package/lib/rules/oas2/request-mime-type.d.ts.map +1 -0
- package/lib/rules/oas2/request-mime-type.js +5 -8
- package/lib/rules/oas2/request-mime-type.js.map +1 -0
- package/lib/rules/oas2/response-contains-property.d.ts +2 -1
- package/lib/rules/oas2/response-contains-property.d.ts.map +1 -0
- package/lib/rules/oas2/response-contains-property.js +5 -8
- package/lib/rules/oas2/response-contains-property.js.map +1 -0
- package/lib/rules/oas2/response-mime-type.d.ts +2 -1
- package/lib/rules/oas2/response-mime-type.d.ts.map +1 -0
- package/lib/rules/oas2/response-mime-type.js +5 -8
- package/lib/rules/oas2/response-mime-type.js.map +1 -0
- package/lib/rules/oas3/array-parameter-serialization.d.ts +2 -1
- package/lib/rules/oas3/array-parameter-serialization.d.ts.map +1 -0
- package/lib/rules/oas3/array-parameter-serialization.js +4 -7
- package/lib/rules/oas3/array-parameter-serialization.js.map +1 -0
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +2 -1
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts.map +1 -0
- package/lib/rules/oas3/boolean-parameter-prefixes.js +2 -5
- package/lib/rules/oas3/boolean-parameter-prefixes.js.map +1 -0
- package/lib/rules/oas3/component-name-unique.d.ts +2 -1
- package/lib/rules/oas3/component-name-unique.d.ts.map +1 -0
- package/lib/rules/oas3/component-name-unique.js +2 -5
- package/lib/rules/oas3/component-name-unique.js.map +1 -0
- package/lib/rules/oas3/index.d.ts +2 -1
- package/lib/rules/oas3/index.d.ts.map +1 -0
- package/lib/rules/oas3/index.js +122 -123
- package/lib/rules/oas3/index.js.map +1 -0
- package/lib/rules/oas3/no-empty-servers.d.ts +2 -1
- package/lib/rules/oas3/no-empty-servers.d.ts.map +1 -0
- package/lib/rules/oas3/no-empty-servers.js +2 -5
- package/lib/rules/oas3/no-empty-servers.js.map +1 -0
- package/lib/rules/oas3/no-example-value-and-externalValue.d.ts +2 -1
- package/lib/rules/oas3/no-example-value-and-externalValue.d.ts.map +1 -0
- package/lib/rules/oas3/no-example-value-and-externalValue.js +2 -5
- package/lib/rules/oas3/no-example-value-and-externalValue.js.map +1 -0
- package/lib/rules/oas3/no-invalid-media-type-examples.d.ts +2 -1
- package/lib/rules/oas3/no-invalid-media-type-examples.d.ts.map +1 -0
- package/lib/rules/oas3/no-invalid-media-type-examples.js +6 -10
- package/lib/rules/oas3/no-invalid-media-type-examples.js.map +1 -0
- package/lib/rules/oas3/no-server-example.com.d.ts +2 -1
- package/lib/rules/oas3/no-server-example.com.d.ts.map +1 -0
- package/lib/rules/oas3/no-server-example.com.js +2 -5
- package/lib/rules/oas3/no-server-example.com.js.map +1 -0
- package/lib/rules/oas3/no-server-trailing-slash.d.ts +2 -1
- package/lib/rules/oas3/no-server-trailing-slash.d.ts.map +1 -0
- package/lib/rules/oas3/no-server-trailing-slash.js +2 -5
- package/lib/rules/oas3/no-server-trailing-slash.js.map +1 -0
- package/lib/rules/oas3/no-server-variables-empty-enum.d.ts +2 -1
- package/lib/rules/oas3/no-server-variables-empty-enum.d.ts.map +1 -0
- package/lib/rules/oas3/no-server-variables-empty-enum.js +2 -5
- package/lib/rules/oas3/no-server-variables-empty-enum.js.map +1 -0
- package/lib/rules/oas3/no-undefined-server-variable.d.ts +2 -1
- package/lib/rules/oas3/no-undefined-server-variable.d.ts.map +1 -0
- package/lib/rules/oas3/no-undefined-server-variable.js +3 -6
- package/lib/rules/oas3/no-undefined-server-variable.js.map +1 -0
- package/lib/rules/oas3/no-unused-components.d.ts +2 -1
- package/lib/rules/oas3/no-unused-components.d.ts.map +1 -0
- package/lib/rules/oas3/no-unused-components.js +2 -5
- package/lib/rules/oas3/no-unused-components.js.map +1 -0
- package/lib/rules/oas3/nullable-type-sibling.d.ts +3 -0
- package/lib/rules/oas3/nullable-type-sibling.d.ts.map +1 -0
- package/lib/rules/oas3/nullable-type-sibling.js +15 -0
- package/lib/rules/oas3/nullable-type-sibling.js.map +1 -0
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts +2 -1
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts.map +1 -0
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +6 -9
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js.map +1 -0
- package/lib/rules/oas3/request-mime-type.d.ts +2 -1
- package/lib/rules/oas3/request-mime-type.d.ts.map +1 -0
- package/lib/rules/oas3/request-mime-type.js +6 -9
- package/lib/rules/oas3/request-mime-type.js.map +1 -0
- package/lib/rules/oas3/response-contains-property.d.ts +2 -1
- package/lib/rules/oas3/response-contains-property.d.ts.map +1 -0
- package/lib/rules/oas3/response-contains-property.js +5 -8
- package/lib/rules/oas3/response-contains-property.js.map +1 -0
- package/lib/rules/oas3/response-mime-type.d.ts +2 -1
- package/lib/rules/oas3/response-mime-type.d.ts.map +1 -0
- package/lib/rules/oas3/response-mime-type.js +6 -9
- package/lib/rules/oas3/response-mime-type.js.map +1 -0
- package/lib/rules/oas3/spec-components-invalid-map-name.d.ts +2 -1
- package/lib/rules/oas3/spec-components-invalid-map-name.d.ts.map +1 -0
- package/lib/rules/oas3/spec-components-invalid-map-name.js +2 -5
- package/lib/rules/oas3/spec-components-invalid-map-name.js.map +1 -0
- package/lib/rules/other/stats.d.ts +4 -3
- package/lib/rules/other/stats.d.ts.map +1 -0
- package/lib/rules/other/stats.js +2 -5
- package/lib/rules/other/stats.js.map +1 -0
- package/lib/rules/overlay1/index.d.ts +2 -1
- package/lib/rules/overlay1/index.d.ts.map +1 -0
- package/lib/rules/overlay1/index.js +9 -11
- package/lib/rules/overlay1/index.js.map +1 -0
- package/lib/rules/respect/no-criteria-xpath.d.ts +2 -1
- package/lib/rules/respect/no-criteria-xpath.d.ts.map +1 -0
- package/lib/rules/respect/no-criteria-xpath.js +2 -5
- package/lib/rules/respect/no-criteria-xpath.js.map +1 -0
- package/lib/rules/respect/no-x-security-scheme-name-in-workflow.d.ts +3 -0
- package/lib/rules/respect/no-x-security-scheme-name-in-workflow.d.ts.map +1 -0
- package/lib/rules/respect/no-x-security-scheme-name-in-workflow.js +21 -0
- package/lib/rules/respect/no-x-security-scheme-name-in-workflow.js.map +1 -0
- package/lib/rules/respect/no-x-security-scheme-name-without-openapi.d.ts +3 -0
- package/lib/rules/respect/no-x-security-scheme-name-without-openapi.d.ts.map +1 -0
- package/lib/rules/respect/no-x-security-scheme-name-without-openapi.js +25 -0
- package/lib/rules/respect/no-x-security-scheme-name-without-openapi.js.map +1 -0
- package/lib/rules/respect/respect-supported-versions.d.ts +2 -1
- package/lib/rules/respect/respect-supported-versions.d.ts.map +1 -0
- package/lib/rules/respect/respect-supported-versions.js +7 -10
- package/lib/rules/respect/respect-supported-versions.js.map +1 -0
- package/lib/rules/respect/x-security-scheme-required-values.d.ts +3 -0
- package/lib/rules/respect/x-security-scheme-required-values.d.ts.map +1 -0
- package/lib/rules/respect/x-security-scheme-required-values.js +60 -0
- package/lib/rules/respect/x-security-scheme-required-values.js.map +1 -0
- package/lib/rules/utils.d.ts +6 -4
- package/lib/rules/utils.d.ts.map +1 -0
- package/lib/rules/utils.js +23 -43
- package/lib/rules/utils.js.map +1 -0
- package/lib/types/arazzo.d.ts +2 -1
- package/lib/types/arazzo.d.ts.map +1 -0
- package/lib/types/arazzo.js +40 -23
- package/lib/types/arazzo.js.map +1 -0
- package/lib/types/asyncapi2.d.ts +2 -1
- package/lib/types/asyncapi2.d.ts.map +1 -0
- package/lib/types/asyncapi2.js +54 -56
- package/lib/types/asyncapi2.js.map +1 -0
- package/lib/types/asyncapi3.d.ts +2 -1
- package/lib/types/asyncapi3.d.ts.map +1 -0
- package/lib/types/asyncapi3.js +41 -43
- package/lib/types/asyncapi3.js.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +7 -13
- package/lib/types/index.js.map +1 -0
- package/lib/types/json-schema-adapter.d.ts +2 -1
- package/lib/types/json-schema-adapter.d.ts.map +1 -0
- package/lib/types/json-schema-adapter.js +15 -17
- package/lib/types/json-schema-adapter.js.map +1 -0
- package/lib/types/oas2.d.ts +85 -3
- package/lib/types/oas2.d.ts.map +1 -0
- package/lib/types/oas2.js +17 -19
- package/lib/types/oas2.js.map +1 -0
- package/lib/types/oas3.d.ts +159 -3
- package/lib/types/oas3.d.ts.map +1 -0
- package/lib/types/oas3.js +44 -46
- package/lib/types/oas3.js.map +1 -0
- package/lib/types/oas3_1.d.ts +162 -3
- package/lib/types/oas3_1.d.ts.map +1 -0
- package/lib/types/oas3_1.js +19 -21
- package/lib/types/oas3_1.js.map +1 -0
- package/lib/types/overlay.d.ts +2 -1
- package/lib/types/overlay.d.ts.map +1 -0
- package/lib/types/overlay.js +4 -6
- package/lib/types/overlay.js.map +1 -0
- package/lib/types/redocly-yaml.d.ts +10 -14
- package/lib/types/redocly-yaml.d.ts.map +1 -0
- package/lib/types/redocly-yaml.js +79 -813
- package/lib/types/redocly-yaml.js.map +1 -0
- package/lib/typings/arazzo.d.ts +41 -0
- package/lib/typings/arazzo.d.ts.map +1 -0
- package/lib/typings/arazzo.js +3 -5
- package/lib/typings/arazzo.js.map +1 -0
- package/lib/typings/asyncapi.d.ts +1 -0
- package/lib/typings/asyncapi.d.ts.map +1 -0
- package/lib/typings/asyncapi.js +2 -2
- package/lib/typings/asyncapi.js.map +1 -0
- package/lib/typings/asyncapi3.d.ts +1 -0
- package/lib/typings/asyncapi3.d.ts.map +1 -0
- package/lib/typings/asyncapi3.js +2 -2
- package/lib/typings/asyncapi3.js.map +1 -0
- package/lib/typings/common.d.ts +1 -0
- package/lib/typings/common.d.ts.map +1 -0
- package/lib/typings/common.js +2 -2
- package/lib/typings/common.js.map +1 -0
- package/lib/typings/openapi.d.ts +45 -15
- package/lib/typings/openapi.d.ts.map +1 -0
- package/lib/typings/openapi.js +2 -2
- package/lib/typings/openapi.js.map +1 -0
- package/lib/typings/overlay.d.ts +1 -0
- package/lib/typings/overlay.d.ts.map +1 -0
- package/lib/typings/overlay.js +2 -4
- package/lib/typings/overlay.js.map +1 -0
- package/lib/typings/swagger.d.ts +2 -1
- package/lib/typings/swagger.d.ts.map +1 -0
- package/lib/typings/swagger.js +2 -2
- package/lib/typings/swagger.js.map +1 -0
- package/lib/utils/error.d.ts +3 -0
- package/lib/utils/error.d.ts.map +1 -0
- package/lib/utils/error.js +3 -0
- package/lib/utils/error.js.map +1 -0
- package/lib/utils.d.ts +6 -11
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +50 -123
- package/lib/utils.js.map +1 -0
- package/lib/visitors.d.ts +16 -15
- package/lib/visitors.d.ts.map +1 -0
- package/lib/visitors.js +4 -6
- package/lib/visitors.js.map +1 -0
- package/lib/walk.d.ts +9 -8
- package/lib/walk.d.ts.map +1 -0
- package/lib/walk.js +31 -28
- package/lib/walk.js.map +1 -0
- package/package.json +31 -10
- package/CHANGELOG.md +0 -563
- package/__tests__/utils.ts +0 -92
- package/lib/benchmark/benches/lint-with-many-rules.bench.d.ts +0 -4
- package/lib/benchmark/benches/lint-with-many-rules.bench.js +0 -38
- package/lib/benchmark/benches/lint-with-nested-rule.bench.d.ts +0 -4
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js +0 -44
- package/lib/benchmark/benches/lint-with-no-rules.bench.d.ts +0 -4
- package/lib/benchmark/benches/lint-with-no-rules.bench.js +0 -25
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.d.ts +0 -4
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +0 -37
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.d.ts +0 -4
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +0 -36
- package/lib/benchmark/benches/recommended-oas3.bench.d.ts +0 -3
- package/lib/benchmark/benches/recommended-oas3.bench.js +0 -21
- package/lib/benchmark/benches/resolve-with-no-external.bench.d.ts +0 -3
- package/lib/benchmark/benches/resolve-with-no-external.bench.js +0 -22
- package/lib/benchmark/utils.d.ts +0 -6
- package/lib/benchmark/utils.js +0 -34
- package/lib/decorators/common/registry-dependencies.d.ts +0 -2
- package/lib/decorators/common/registry-dependencies.js +0 -24
- package/lib/output.d.ts +0 -3
- package/lib/output.js +0 -9
- package/lib/redocly/domains.d.ts +0 -14
- package/lib/redocly/domains.js +0 -41
- package/lib/redocly/index.d.ts +0 -30
- package/lib/redocly/index.js +0 -131
- package/lib/redocly/redocly-client-types.d.ts +0 -8
- package/lib/redocly/redocly-client-types.js +0 -2
- package/lib/redocly/registry-api-types.d.ts +0 -29
- package/lib/redocly/registry-api-types.js +0 -2
- package/lib/redocly/registry-api.d.ts +0 -17
- package/lib/redocly/registry-api.js +0 -100
- package/src/__tests__/__snapshots__/bundle.test.ts.snap +0 -461
- package/src/__tests__/bundle.test.ts +0 -478
- package/src/__tests__/codeframes.test.ts +0 -530
- package/src/__tests__/fixtures/.redocly.lint-ignore.yaml +0 -5
- package/src/__tests__/fixtures/extension.js +0 -24
- package/src/__tests__/fixtures/lint/openapi.yaml +0 -10
- package/src/__tests__/fixtures/redocly.yaml +0 -2
- package/src/__tests__/fixtures/refs/definitions.yaml +0 -3
- package/src/__tests__/fixtures/refs/examples.yaml +0 -8
- package/src/__tests__/fixtures/refs/external-request-body.yaml +0 -13
- package/src/__tests__/fixtures/refs/externalref.yaml +0 -35
- package/src/__tests__/fixtures/refs/hosted.yaml +0 -35
- package/src/__tests__/fixtures/refs/openapi-with-external-refs-conflicting-names.yaml +0 -21
- package/src/__tests__/fixtures/refs/openapi-with-external-refs.yaml +0 -33
- package/src/__tests__/fixtures/refs/openapi-with-special-names-in-props.yaml +0 -19
- package/src/__tests__/fixtures/refs/openapi-with-url-refs.yaml +0 -18
- package/src/__tests__/fixtures/refs/param-b.yaml +0 -1
- package/src/__tests__/fixtures/refs/param-c.yaml +0 -1
- package/src/__tests__/fixtures/refs/rename.yaml +0 -1
- package/src/__tests__/fixtures/refs/requestBody.yaml +0 -9
- package/src/__tests__/fixtures/refs/schema-a.yaml +0 -1
- package/src/__tests__/fixtures/refs/simple.yaml +0 -1
- package/src/__tests__/fixtures/refs/vendor.schema.yaml +0 -20
- package/src/__tests__/fixtures/resolve/External.yaml +0 -10
- package/src/__tests__/fixtures/resolve/External2.yaml +0 -4
- package/src/__tests__/fixtures/resolve/description.md +0 -3
- package/src/__tests__/fixtures/resolve/externalInfo.yaml +0 -4
- package/src/__tests__/fixtures/resolve/externalLicense.yaml +0 -1
- package/src/__tests__/fixtures/resolve/openapi-with-back.yaml +0 -13
- package/src/__tests__/fixtures/resolve/openapi-with-md-description.yaml +0 -5
- package/src/__tests__/fixtures/resolve/openapi.yaml +0 -28
- package/src/__tests__/fixtures/resolve/schemas/type-a.yaml +0 -10
- package/src/__tests__/fixtures/resolve/schemas/type-b.yaml +0 -6
- package/src/__tests__/fixtures/resolve/transitive/a.yaml +0 -1
- package/src/__tests__/fixtures/resolve/transitive/components.yaml +0 -5
- package/src/__tests__/fixtures/resolve/transitive/schemas.yaml +0 -3
- package/src/__tests__/format.test.ts +0 -147
- package/src/__tests__/js-yaml.test.ts +0 -73
- package/src/__tests__/lint.test.ts +0 -1772
- package/src/__tests__/logger-browser.test.ts +0 -53
- package/src/__tests__/logger.test.ts +0 -47
- package/src/__tests__/login.test.ts +0 -17
- package/src/__tests__/normalizeVisitors.test.ts +0 -169
- package/src/__tests__/output-browser.test.ts +0 -18
- package/src/__tests__/output.test.ts +0 -15
- package/src/__tests__/ref-utils.test.ts +0 -142
- package/src/__tests__/resolve-http.test.ts +0 -77
- package/src/__tests__/resolve.test.ts +0 -431
- package/src/__tests__/utils-browser.test.ts +0 -11
- package/src/__tests__/utils.test.ts +0 -144
- package/src/__tests__/walk.test.ts +0 -1596
- package/src/benchmark/benches/lint-with-many-rules.bench.ts +0 -41
- package/src/benchmark/benches/lint-with-nested-rule.bench.ts +0 -45
- package/src/benchmark/benches/lint-with-no-rules.bench.ts +0 -27
- package/src/benchmark/benches/lint-with-top-level-rule-report.bench.ts +0 -40
- package/src/benchmark/benches/lint-with-top-level-rule.bench.ts +0 -38
- package/src/benchmark/benches/rebilly.yaml +0 -32272
- package/src/benchmark/benches/recommended-oas3.bench.ts +0 -22
- package/src/benchmark/benches/resolve-with-no-external.bench.ts +0 -23
- package/src/benchmark/benchmark.js +0 -311
- package/src/benchmark/colors.js +0 -29
- package/src/benchmark/fork.js +0 -87
- package/src/benchmark/utils.ts +0 -37
- package/src/bundle.ts +0 -531
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +0 -485
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +0 -232
- package/src/config/__tests__/config-resolvers.test.ts +0 -668
- package/src/config/__tests__/config.test.ts +0 -356
- package/src/config/__tests__/fixtures/ingore-file.ts +0 -8
- package/src/config/__tests__/fixtures/load-external.yaml +0 -2
- package/src/config/__tests__/fixtures/load-redocly.yaml +0 -2
- package/src/config/__tests__/fixtures/plugin-config.yaml +0 -2
- package/src/config/__tests__/fixtures/plugin.js +0 -56
- package/src/config/__tests__/fixtures/resolve-config/api/nested-config.yaml +0 -11
- package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +0 -69
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-circular.yaml +0 -7
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-commonjs-export-function.yaml +0 -2
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-custom-function.yaml +0 -17
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-esm.yaml +0 -2
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-file.yaml +0 -18
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-plugin-init.yaml +0 -2
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-realm-plugin.yaml +0 -2
- package/src/config/__tests__/fixtures/resolve-config/local-config-with-wrong-custom-function.yaml +0 -15
- package/src/config/__tests__/fixtures/resolve-config/local-config.yaml +0 -9
- package/src/config/__tests__/fixtures/resolve-config/plugin-esm.mjs +0 -10
- package/src/config/__tests__/fixtures/resolve-config/plugin-with-export-function.cjs +0 -10
- package/src/config/__tests__/fixtures/resolve-config/plugin-with-init-logic.js +0 -9
- package/src/config/__tests__/fixtures/resolve-config/plugin.js +0 -80
- package/src/config/__tests__/fixtures/resolve-config/realm-plugin.js +0 -12
- package/src/config/__tests__/fixtures/resolve-refs-in-config/config-with-refs.yaml +0 -8
- package/src/config/__tests__/fixtures/resolve-refs-in-config/rules.yaml +0 -2
- package/src/config/__tests__/fixtures/resolve-refs-in-config/seo.yaml +0 -1
- package/src/config/__tests__/fixtures/resolve-remote-configs/nested-remote-config.yaml +0 -3
- package/src/config/__tests__/fixtures/resolve-remote-configs/remote-config.yaml +0 -4
- package/src/config/__tests__/load.test.ts +0 -320
- package/src/config/__tests__/resolve-plugins.test.ts +0 -30
- package/src/config/__tests__/utils.test.ts +0 -225
- package/src/config/all.ts +0 -234
- package/src/config/builtIn.ts +0 -59
- package/src/config/config-resolvers.ts +0 -657
- package/src/config/config.ts +0 -423
- package/src/config/index.ts +0 -7
- package/src/config/load.ts +0 -213
- package/src/config/minimal.ts +0 -210
- package/src/config/recommended-strict.ts +0 -210
- package/src/config/recommended.ts +0 -210
- package/src/config/rules.ts +0 -72
- package/src/config/spec.ts +0 -33
- package/src/config/types.ts +0 -306
- package/src/config/utils.ts +0 -439
- package/src/decorators/__tests__/filter-in.test.ts +0 -313
- package/src/decorators/__tests__/filter-out.test.ts +0 -344
- package/src/decorators/__tests__/media-type-examples-override.test.ts +0 -665
- package/src/decorators/__tests__/remove-x-internal.test.ts +0 -416
- package/src/decorators/__tests__/resources/request.yaml +0 -3
- package/src/decorators/__tests__/resources/response.yaml +0 -3
- package/src/decorators/arazzo/index.ts +0 -1
- package/src/decorators/async2/index.ts +0 -1
- package/src/decorators/async3/index.ts +0 -1
- package/src/decorators/common/filters/filter-helper.ts +0 -73
- package/src/decorators/common/filters/filter-in.ts +0 -19
- package/src/decorators/common/filters/filter-out.ts +0 -19
- package/src/decorators/common/info-description-override.ts +0 -25
- package/src/decorators/common/info-override.ts +0 -15
- package/src/decorators/common/media-type-examples-override.ts +0 -80
- package/src/decorators/common/operation-description-override.ts +0 -31
- package/src/decorators/common/registry-dependencies.ts +0 -25
- package/src/decorators/common/remove-x-internal.ts +0 -77
- package/src/decorators/common/tag-description-override.ts +0 -26
- package/src/decorators/oas2/__tests__/remove-unused-components.test.ts +0 -228
- package/src/decorators/oas2/index.ts +0 -21
- package/src/decorators/oas2/remove-unused-components.ts +0 -109
- package/src/decorators/oas3/__tests__/remove-unused-components.test.ts +0 -313
- package/src/decorators/oas3/index.ts +0 -23
- package/src/decorators/oas3/remove-unused-components.ts +0 -138
- package/src/decorators/overlay1/index.ts +0 -1
- package/src/env.ts +0 -5
- package/src/format/codeframes.ts +0 -217
- package/src/format/format.ts +0 -479
- package/src/index.ts +0 -91
- package/src/js-yaml/index.ts +0 -16
- package/src/lint.ts +0 -190
- package/src/logger.ts +0 -36
- package/src/oas-types.ts +0 -178
- package/src/output.ts +0 -7
- package/src/redocly/__tests__/domains.test.ts +0 -52
- package/src/redocly/__tests__/redocly-client.test.ts +0 -156
- package/src/redocly/domains.ts +0 -48
- package/src/redocly/index.ts +0 -177
- package/src/redocly/redocly-client-types.ts +0 -10
- package/src/redocly/registry-api-types.ts +0 -32
- package/src/redocly/registry-api.ts +0 -147
- package/src/ref-utils.ts +0 -91
- package/src/resolve.ts +0 -461
- package/src/rules/__tests__/fixtures/code-sample.php +0 -9
- package/src/rules/__tests__/fixtures/invalid-yaml.yaml +0 -1
- package/src/rules/__tests__/fixtures/ref.yaml +0 -1
- package/src/rules/__tests__/no-unresolved-refs.test.ts +0 -271
- package/src/rules/__tests__/utils.test.ts +0 -160
- package/src/rules/ajv.ts +0 -105
- package/src/rules/arazzo/__tests__/criteria-unique.test.ts +0 -160
- package/src/rules/arazzo/__tests__/no-criteria-xpath.test.ts +0 -126
- package/src/rules/arazzo/__tests__/parameters-unique.test.ts +0 -113
- package/src/rules/arazzo/__tests__/requestBody-replacements-unique.test.ts +0 -108
- package/src/rules/arazzo/__tests__/respect-supported-versions.test.ts +0 -116
- package/src/rules/arazzo/__tests__/source-description-type.test.ts +0 -78
- package/src/rules/arazzo/__tests__/sourceDescription-name-unique.test.ts +0 -78
- package/src/rules/arazzo/__tests__/sourceDescriptions-not-empty.test.ts +0 -104
- package/src/rules/arazzo/__tests__/step-onFailure-unique.test.ts +0 -110
- package/src/rules/arazzo/__tests__/step-onSuccess-unique.test.ts +0 -110
- package/src/rules/arazzo/__tests__/stepId-unique.test.ts +0 -94
- package/src/rules/arazzo/__tests__/workflow-dependsOn.test.ts +0 -209
- package/src/rules/arazzo/__tests__/workflowId-unique.test.ts +0 -88
- package/src/rules/arazzo/criteria-unique.ts +0 -70
- package/src/rules/arazzo/index.ts +0 -38
- package/src/rules/arazzo/parameters-unique.ts +0 -33
- package/src/rules/arazzo/requestBody-replacements-unique.ts +0 -33
- package/src/rules/arazzo/sourceDescription-type.ts +0 -21
- package/src/rules/arazzo/sourceDescriptions-name-unique.ts +0 -23
- package/src/rules/arazzo/sourceDescriptions-not-empty.ts +0 -17
- package/src/rules/arazzo/step-onFailure-unique.ts +0 -33
- package/src/rules/arazzo/step-onSuccess-unique.ts +0 -33
- package/src/rules/arazzo/stepId-unique.ts +0 -24
- package/src/rules/arazzo/workflow-dependsOn.ts +0 -56
- package/src/rules/arazzo/workflowId-unique.ts +0 -21
- package/src/rules/async2/__tests__/channels-kebab-case.test.ts +0 -145
- package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +0 -97
- package/src/rules/async2/channels-kebab-case.ts +0 -18
- package/src/rules/async2/index.ts +0 -29
- package/src/rules/async2/no-channel-trailing-slash.ts +0 -15
- package/src/rules/async3/__tests__/channels-kebab-case.test.ts +0 -145
- package/src/rules/async3/__tests__/no-channel-trailing-slash.test.ts +0 -96
- package/src/rules/async3/channels-kebab-case.ts +0 -19
- package/src/rules/async3/index.ts +0 -29
- package/src/rules/async3/no-channel-trailing-slash.ts +0 -16
- package/src/rules/common/__tests__/info-license-strict.test.ts +0 -141
- package/src/rules/common/__tests__/info-license.test.ts +0 -62
- package/src/rules/common/__tests__/license-url.test.ts +0 -63
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +0 -96
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +0 -210
- package/src/rules/common/__tests__/no-identical-paths.test.ts +0 -58
- package/src/rules/common/__tests__/no-invalid-parameter-examples.test.ts +0 -53
- package/src/rules/common/__tests__/no-invalid-schema-examples.test.ts +0 -86
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +0 -126
- package/src/rules/common/__tests__/no-required-schema-properties-undefined.test.ts +0 -550
- package/src/rules/common/__tests__/no-schema-type-mismatch.test.ts +0 -126
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +0 -194
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +0 -233
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +0 -76
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +0 -45
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +0 -167
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +0 -72
- package/src/rules/common/__tests__/operation-tag-defined.test.ts +0 -68
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +0 -95
- package/src/rules/common/__tests__/path-not-include-query.test.ts +0 -64
- package/src/rules/common/__tests__/path-params-defined.test.ts +0 -202
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +0 -110
- package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +0 -264
- package/src/rules/common/__tests__/security-defined.test.ts +0 -284
- package/src/rules/common/__tests__/spec-strict-refs.test.ts +0 -69
- package/src/rules/common/__tests__/struct.test.ts +0 -657
- package/src/rules/common/__tests__/tag-description.test.ts +0 -65
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +0 -124
- package/src/rules/common/assertions/__tests__/asserts.test.ts +0 -877
- package/src/rules/common/assertions/__tests__/index.test.ts +0 -100
- package/src/rules/common/assertions/__tests__/utils.test.ts +0 -236
- package/src/rules/common/assertions/asserts.ts +0 -365
- package/src/rules/common/assertions/index.ts +0 -68
- package/src/rules/common/assertions/utils.ts +0 -333
- package/src/rules/common/info-contact.ts +0 -16
- package/src/rules/common/info-license-strict.ts +0 -24
- package/src/rules/common/info-license-url.ts +0 -11
- package/src/rules/common/info-license.ts +0 -16
- package/src/rules/common/no-ambiguous-paths.ts +0 -50
- package/src/rules/common/no-enum-type-mismatch.ts +0 -53
- package/src/rules/common/no-http-verbs-in-paths.ts +0 -37
- package/src/rules/common/no-identical-paths.ts +0 -24
- package/src/rules/common/no-invalid-parameter-examples.ts +0 -37
- package/src/rules/common/no-invalid-schema-examples.ts +0 -40
- package/src/rules/common/no-path-trailing-slash.ts +0 -15
- package/src/rules/common/no-required-schema-properties-undefined.ts +0 -54
- package/src/rules/common/no-schema-type-mismatch.ts +0 -24
- package/src/rules/common/operation-2xx-response.ts +0 -25
- package/src/rules/common/operation-4xx-response.ts +0 -25
- package/src/rules/common/operation-description.ts +0 -14
- package/src/rules/common/operation-operationId-unique.ts +0 -21
- package/src/rules/common/operation-operationId-url-safe.ts +0 -20
- package/src/rules/common/operation-operationId.ts +0 -18
- package/src/rules/common/operation-parameters-unique.ts +0 -48
- package/src/rules/common/operation-singular-tag.ts +0 -17
- package/src/rules/common/operation-summary.ts +0 -14
- package/src/rules/common/operation-tag-defined.ts +0 -31
- package/src/rules/common/parameter-description.ts +0 -22
- package/src/rules/common/path-declaration-must-exist.ts +0 -15
- package/src/rules/common/path-excludes-patterns.ts +0 -23
- package/src/rules/common/path-http-verbs-order.ts +0 -30
- package/src/rules/common/path-not-include-query.ts +0 -17
- package/src/rules/common/path-params-defined.ts +0 -65
- package/src/rules/common/path-segment-plural.ts +0 -33
- package/src/rules/common/paths-kebab-case.ts +0 -19
- package/src/rules/common/required-string-property-missing-min-length.ts +0 -44
- package/src/rules/common/response-contains-header.ts +0 -36
- package/src/rules/common/scalar-property-missing-example.ts +0 -59
- package/src/rules/common/security-defined.ts +0 -89
- package/src/rules/common/spec-strict-refs.ts +0 -31
- package/src/rules/common/struct.ts +0 -189
- package/src/rules/common/tag-description.ts +0 -11
- package/src/rules/common/tags-alphabetical.ts +0 -27
- package/src/rules/no-unresolved-refs.ts +0 -52
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +0 -112
- package/src/rules/oas2/__tests__/response-contains-header.test.ts +0 -180
- package/src/rules/oas2/__tests__/response-contains-property.test.ts +0 -161
- package/src/rules/oas2/__tests__/spec/fixtures/description.md +0 -1
- package/src/rules/oas2/__tests__/spec/info.test.ts +0 -355
- package/src/rules/oas2/__tests__/spec/operation.test.ts +0 -123
- package/src/rules/oas2/__tests__/spec/paths.test.ts +0 -245
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +0 -37
- package/src/rules/oas2/__tests__/spec/utils.ts +0 -32
- package/src/rules/oas2/boolean-parameter-prefixes.ts +0 -26
- package/src/rules/oas2/index.ts +0 -102
- package/src/rules/oas2/request-mime-type.ts +0 -17
- package/src/rules/oas2/response-contains-property.ts +0 -37
- package/src/rules/oas2/response-mime-type.ts +0 -17
- package/src/rules/oas3/__tests__/array-parameter-serialization.test.ts +0 -275
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +0 -113
- package/src/rules/oas3/__tests__/component-name-unique.test.ts +0 -966
- package/src/rules/oas3/__tests__/fixtures/common.yaml +0 -11
- package/src/rules/oas3/__tests__/fixtures/external-value.yaml +0 -2
- package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +0 -205
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +0 -65
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +0 -732
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +0 -95
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +0 -79
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +0 -131
- package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +0 -145
- package/src/rules/oas3/__tests__/response-contains-header.test.ts +0 -401
- package/src/rules/oas3/__tests__/response-contains-property.test.ts +0 -417
- package/src/rules/oas3/__tests__/spec/callbacks.test.ts +0 -41
- package/src/rules/oas3/__tests__/spec/fixtures/description.md +0 -1
- package/src/rules/oas3/__tests__/spec/info.test.ts +0 -391
- package/src/rules/oas3/__tests__/spec/operation.test.ts +0 -253
- package/src/rules/oas3/__tests__/spec/paths.test.ts +0 -284
- package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +0 -77
- package/src/rules/oas3/__tests__/spec/servers.test.ts +0 -505
- package/src/rules/oas3/__tests__/spec/spec.test.ts +0 -307
- package/src/rules/oas3/__tests__/spec/utils.ts +0 -32
- package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +0 -282
- package/src/rules/oas3/__tests__/utils/lint-document-for-test.ts +0 -23
- package/src/rules/oas3/array-parameter-serialization.ts +0 -47
- package/src/rules/oas3/boolean-parameter-prefixes.ts +0 -28
- package/src/rules/oas3/component-name-unique.ts +0 -162
- package/src/rules/oas3/index.ts +0 -126
- package/src/rules/oas3/no-empty-servers.ts +0 -22
- package/src/rules/oas3/no-example-value-and-externalValue.ts +0 -14
- package/src/rules/oas3/no-invalid-media-type-examples.ts +0 -54
- package/src/rules/oas3/no-server-example.com.ts +0 -16
- package/src/rules/oas3/no-server-trailing-slash.ts +0 -15
- package/src/rules/oas3/no-server-variables-empty-enum.ts +0 -66
- package/src/rules/oas3/no-undefined-server-variable.ts +0 -30
- package/src/rules/oas3/no-unused-components.ts +0 -75
- package/src/rules/oas3/operation-4xx-problem-details-rfc7807.ts +0 -36
- package/src/rules/oas3/request-mime-type.ts +0 -31
- package/src/rules/oas3/response-contains-property.ts +0 -39
- package/src/rules/oas3/response-mime-type.ts +0 -31
- package/src/rules/oas3/spec-components-invalid-map-name.ts +0 -69
- package/src/rules/other/stats.ts +0 -75
- package/src/rules/overlay1/__tests__/info-contact.test.ts +0 -112
- package/src/rules/overlay1/index.ts +0 -14
- package/src/rules/respect/no-criteria-xpath.ts +0 -20
- package/src/rules/respect/respect-supported-versions.ts +0 -24
- package/src/rules/utils.ts +0 -230
- package/src/types/arazzo.ts +0 -305
- package/src/types/asyncapi2.ts +0 -1121
- package/src/types/asyncapi3.ts +0 -383
- package/src/types/index.ts +0 -144
- package/src/types/json-schema-adapter.ts +0 -217
- package/src/types/oas2.ts +0 -481
- package/src/types/oas3.ts +0 -594
- package/src/types/oas3_1.ts +0 -290
- package/src/types/overlay.ts +0 -40
- package/src/types/redocly-yaml.ts +0 -1226
- package/src/typings/arazzo.ts +0 -172
- package/src/typings/asyncapi.ts +0 -26
- package/src/typings/asyncapi3.ts +0 -61
- package/src/typings/common.ts +0 -18
- package/src/typings/openapi.ts +0 -347
- package/src/typings/overlay.ts +0 -19
- package/src/typings/swagger.ts +0 -236
- package/src/utils.ts +0 -357
- package/src/visitors.ts +0 -598
- package/src/walk.ts +0 -467
- package/tsconfig.json +0 -8
- package/tsconfig.tsbuildinfo +0 -1
package/src/visitors.ts
DELETED
|
@@ -1,598 +0,0 @@
|
|
|
1
|
-
import { SpecExtension } from './types';
|
|
2
|
-
|
|
3
|
-
import type { NormalizedNodeType } from './types';
|
|
4
|
-
import type { Stack } from './utils';
|
|
5
|
-
import type { UserContext, ResolveResult, ProblemSeverity } from './walk';
|
|
6
|
-
import type { Location } from './ref-utils';
|
|
7
|
-
import type {
|
|
8
|
-
Oas3Definition,
|
|
9
|
-
Oas3_1Definition,
|
|
10
|
-
Oas3ExternalDocs,
|
|
11
|
-
Oas3Info,
|
|
12
|
-
Oas3Contact,
|
|
13
|
-
Oas3Components,
|
|
14
|
-
Oas3_1Components,
|
|
15
|
-
Oas3License,
|
|
16
|
-
Oas3Schema,
|
|
17
|
-
Oas3_1Schema,
|
|
18
|
-
Oas3Header,
|
|
19
|
-
Oas3Parameter,
|
|
20
|
-
Oas3Operation,
|
|
21
|
-
Oas3PathItem,
|
|
22
|
-
Oas3ServerVariable,
|
|
23
|
-
Oas3Server,
|
|
24
|
-
Oas3MediaType,
|
|
25
|
-
Oas3Response,
|
|
26
|
-
Oas3Example,
|
|
27
|
-
Oas3RequestBody,
|
|
28
|
-
Oas3Tag,
|
|
29
|
-
OasRef,
|
|
30
|
-
Oas3SecurityScheme,
|
|
31
|
-
Oas3SecurityRequirement,
|
|
32
|
-
Oas3Encoding,
|
|
33
|
-
Oas3Link,
|
|
34
|
-
Oas3Xml,
|
|
35
|
-
Oas3Discriminator,
|
|
36
|
-
Oas3Callback,
|
|
37
|
-
} from './typings/openapi';
|
|
38
|
-
import type {
|
|
39
|
-
Oas2Definition,
|
|
40
|
-
Oas2Tag,
|
|
41
|
-
Oas2ExternalDocs,
|
|
42
|
-
Oas2SecurityRequirement,
|
|
43
|
-
Oas2Info,
|
|
44
|
-
Oas2Contact,
|
|
45
|
-
Oas2License,
|
|
46
|
-
Oas2PathItem,
|
|
47
|
-
Oas2Operation,
|
|
48
|
-
Oas2Header,
|
|
49
|
-
Oas2Response,
|
|
50
|
-
Oas2Schema,
|
|
51
|
-
Oas2Xml,
|
|
52
|
-
Oas2Parameter,
|
|
53
|
-
Oas2SecurityScheme,
|
|
54
|
-
} from './typings/swagger';
|
|
55
|
-
import type { Async2Definition } from './typings/asyncapi';
|
|
56
|
-
import type { Async3Definition } from './typings/asyncapi3';
|
|
57
|
-
import type {
|
|
58
|
-
ArazzoDefinition,
|
|
59
|
-
ArazzoSourceDescription,
|
|
60
|
-
CriteriaObject,
|
|
61
|
-
ExtendedOperation,
|
|
62
|
-
InfoObject,
|
|
63
|
-
OnFailureObject,
|
|
64
|
-
OnSuccessObject,
|
|
65
|
-
OpenAPISourceDescription,
|
|
66
|
-
Parameter,
|
|
67
|
-
Replacement,
|
|
68
|
-
RequestBody,
|
|
69
|
-
SourceDescription,
|
|
70
|
-
Step,
|
|
71
|
-
Workflow,
|
|
72
|
-
} from './typings/arazzo';
|
|
73
|
-
import type { Overlay1Definition } from './typings/overlay';
|
|
74
|
-
|
|
75
|
-
export type SkipFunctionContext = Pick<
|
|
76
|
-
UserContext,
|
|
77
|
-
'location' | 'rawNode' | 'resolve' | 'rawLocation'
|
|
78
|
-
>;
|
|
79
|
-
|
|
80
|
-
export type VisitFunction<T> = (
|
|
81
|
-
node: T,
|
|
82
|
-
ctx: UserContext & { ignoreNextVisitorsOnNode: () => void },
|
|
83
|
-
parents?: any,
|
|
84
|
-
context?: any
|
|
85
|
-
) => void;
|
|
86
|
-
|
|
87
|
-
type VisitRefFunction = (node: OasRef, ctx: UserContext, resolved: ResolveResult<any>) => void;
|
|
88
|
-
|
|
89
|
-
type SkipFunction<T> = (node: T, key: string | number, ctx: SkipFunctionContext) => boolean;
|
|
90
|
-
|
|
91
|
-
type VisitObject<T> = {
|
|
92
|
-
enter?: VisitFunction<T>;
|
|
93
|
-
leave?: VisitFunction<T>;
|
|
94
|
-
skip?: SkipFunction<T>;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export type NestedVisitObject<T, P> = VisitObject<T> & NestedVisitor<P>;
|
|
98
|
-
|
|
99
|
-
type VisitFunctionOrObject<T> = VisitFunction<T> | VisitObject<T>;
|
|
100
|
-
|
|
101
|
-
export type VisitorNode<T> = {
|
|
102
|
-
ruleId: string;
|
|
103
|
-
severity: ProblemSeverity;
|
|
104
|
-
message?: string;
|
|
105
|
-
context: VisitorLevelContext | VisitorSkippedLevelContext;
|
|
106
|
-
depth: number;
|
|
107
|
-
visit: VisitFunction<T>;
|
|
108
|
-
skip?: SkipFunction<T>;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
type VisitorRefNode = {
|
|
112
|
-
ruleId: string;
|
|
113
|
-
severity: ProblemSeverity;
|
|
114
|
-
message?: string;
|
|
115
|
-
context: VisitorLevelContext;
|
|
116
|
-
depth: number;
|
|
117
|
-
visit: VisitRefFunction;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export type VisitorLevelContext = {
|
|
121
|
-
isSkippedLevel: false;
|
|
122
|
-
type: NormalizedNodeType;
|
|
123
|
-
parent: VisitorLevelContext | null;
|
|
124
|
-
activatedOn: Stack<{
|
|
125
|
-
node?: any;
|
|
126
|
-
withParentNode?: any;
|
|
127
|
-
skipped: boolean;
|
|
128
|
-
nextLevelTypeActivated: Stack<NormalizedNodeType>;
|
|
129
|
-
location?: Location;
|
|
130
|
-
}>;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export type VisitorSkippedLevelContext = {
|
|
134
|
-
isSkippedLevel: true;
|
|
135
|
-
parent: VisitorLevelContext;
|
|
136
|
-
seen: Set<any>;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export type NormalizeVisitor<Fn> = Fn extends VisitFunction<infer T> ? VisitorNode<T> : never;
|
|
140
|
-
|
|
141
|
-
export type BaseVisitor = {
|
|
142
|
-
any?:
|
|
143
|
-
| {
|
|
144
|
-
enter?: VisitFunction<any>;
|
|
145
|
-
leave?: VisitFunction<any>;
|
|
146
|
-
skip?: SkipFunction<any>;
|
|
147
|
-
}
|
|
148
|
-
| VisitFunction<any>;
|
|
149
|
-
|
|
150
|
-
ref?:
|
|
151
|
-
| {
|
|
152
|
-
enter?: VisitRefFunction;
|
|
153
|
-
leave?: VisitRefFunction;
|
|
154
|
-
}
|
|
155
|
-
| VisitRefFunction;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
type Oas3FlatVisitor = {
|
|
159
|
-
Root?: VisitFunctionOrObject<Oas3Definition | Oas3_1Definition>;
|
|
160
|
-
Tag?: VisitFunctionOrObject<Oas3Tag>;
|
|
161
|
-
ExternalDocs?: VisitFunctionOrObject<Oas3ExternalDocs>;
|
|
162
|
-
Server?: VisitFunctionOrObject<Oas3Server>;
|
|
163
|
-
ServerVariable?: VisitFunctionOrObject<Oas3ServerVariable>;
|
|
164
|
-
SecurityRequirement?: VisitFunctionOrObject<Oas3SecurityRequirement>;
|
|
165
|
-
Info?: VisitFunctionOrObject<Oas3Info>;
|
|
166
|
-
Contact?: VisitFunctionOrObject<Oas3Contact>;
|
|
167
|
-
License?: VisitFunctionOrObject<Oas3License>;
|
|
168
|
-
Paths?: VisitFunctionOrObject<Record<string, Oas3PathItem<Oas3Schema | Oas3_1Schema>>>;
|
|
169
|
-
PathItem?: VisitFunctionOrObject<Oas3PathItem<Oas3Schema | Oas3_1Schema>>;
|
|
170
|
-
Callback?: VisitFunctionOrObject<Oas3Callback<Oas3Schema | Oas3_1Schema>>;
|
|
171
|
-
CallbacksMap?: VisitFunctionOrObject<Record<string, Oas3Callback<Oas3Schema | Oas3_1Schema>>>;
|
|
172
|
-
Parameter?: VisitFunctionOrObject<Oas3Parameter<Oas3Schema | Oas3_1Schema>>;
|
|
173
|
-
Operation?: VisitFunctionOrObject<Oas3Operation<Oas3Schema | Oas3_1Schema>>;
|
|
174
|
-
RequestBody?: VisitFunctionOrObject<Oas3RequestBody<Oas3Schema | Oas3_1Schema>>;
|
|
175
|
-
MediaTypesMap?: VisitFunctionOrObject<Record<string, Oas3MediaType<Oas3Schema | Oas3_1Schema>>>;
|
|
176
|
-
MediaType?: VisitFunctionOrObject<Oas3MediaType<Oas3Schema | Oas3_1Schema>>;
|
|
177
|
-
Example?: VisitFunctionOrObject<Oas3Example>;
|
|
178
|
-
Encoding?: VisitFunctionOrObject<Oas3Encoding<Oas3Schema | Oas3_1Schema>>;
|
|
179
|
-
Header?: VisitFunctionOrObject<Oas3Header<Oas3Schema | Oas3_1Schema>>;
|
|
180
|
-
Responses?: VisitFunctionOrObject<Record<string, Oas3Response<Oas3Schema | Oas3_1Schema>>>;
|
|
181
|
-
Response?: VisitFunctionOrObject<Oas3Response<Oas3Schema | Oas3_1Schema>>;
|
|
182
|
-
Link?: VisitFunctionOrObject<Oas3Link>;
|
|
183
|
-
Schema?: VisitFunctionOrObject<Oas3Schema | Oas3_1Schema>;
|
|
184
|
-
Xml?: VisitFunctionOrObject<Oas3Xml>;
|
|
185
|
-
SchemaProperties?: VisitFunctionOrObject<Record<string, Oas3Schema>>;
|
|
186
|
-
DiscriminatorMapping?: VisitFunctionOrObject<Record<string, string>>;
|
|
187
|
-
Discriminator?: VisitFunctionOrObject<Oas3Discriminator>;
|
|
188
|
-
Components?: VisitFunctionOrObject<Oas3Components | Oas3_1Components>;
|
|
189
|
-
NamedSchemas?: VisitFunctionOrObject<Record<string, Oas3Schema>>;
|
|
190
|
-
NamedResponses?: VisitFunctionOrObject<Record<string, Oas3Response<Oas3Schema | Oas3_1Schema>>>;
|
|
191
|
-
NamedParameters?: VisitFunctionOrObject<Record<string, Oas3Parameter<Oas3Schema | Oas3_1Schema>>>;
|
|
192
|
-
NamedExamples?: VisitFunctionOrObject<Record<string, Oas3Example>>;
|
|
193
|
-
NamedRequestBodies?: VisitFunctionOrObject<
|
|
194
|
-
Record<string, Oas3RequestBody<Oas3Schema | Oas3_1Schema>>
|
|
195
|
-
>;
|
|
196
|
-
NamedHeaders?: VisitFunctionOrObject<Record<string, Oas3Header<Oas3Schema | Oas3_1Schema>>>;
|
|
197
|
-
NamedSecuritySchemes?: VisitFunctionOrObject<Record<string, Oas3SecurityScheme>>;
|
|
198
|
-
NamedLinks?: VisitFunctionOrObject<Record<string, Oas3Link>>;
|
|
199
|
-
NamedCallbacks?: VisitFunctionOrObject<Record<string, Oas3Callback<Oas3Schema | Oas3_1Schema>>>;
|
|
200
|
-
ImplicitFlow?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['implicit']>;
|
|
201
|
-
PasswordFlow?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['password']>;
|
|
202
|
-
ClientCredentials?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['clientCredentials']>;
|
|
203
|
-
AuthorizationCode?: VisitFunctionOrObject<Oas3SecurityScheme['flows']['authorizationCode']>;
|
|
204
|
-
OAuth2Flows?: VisitFunctionOrObject<Oas3SecurityScheme['flows']>;
|
|
205
|
-
SecurityScheme?: VisitFunctionOrObject<Oas3SecurityScheme>;
|
|
206
|
-
SpecExtension?: VisitFunctionOrObject<unknown>;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
type Oas2FlatVisitor = {
|
|
210
|
-
Root?: VisitFunctionOrObject<Oas2Definition>;
|
|
211
|
-
Tag?: VisitFunctionOrObject<Oas2Tag>;
|
|
212
|
-
ExternalDocs?: VisitFunctionOrObject<Oas2ExternalDocs>;
|
|
213
|
-
SecurityRequirement?: VisitFunctionOrObject<Oas2SecurityRequirement>;
|
|
214
|
-
Info?: VisitFunctionOrObject<Oas2Info>;
|
|
215
|
-
Contact?: VisitFunctionOrObject<Oas2Contact>;
|
|
216
|
-
License?: VisitFunctionOrObject<Oas2License>;
|
|
217
|
-
Paths?: VisitFunctionOrObject<Record<string, Oas2PathItem>>;
|
|
218
|
-
PathItem?: VisitFunctionOrObject<Oas2PathItem>;
|
|
219
|
-
Parameter?: VisitFunctionOrObject<any>;
|
|
220
|
-
Operation?: VisitFunctionOrObject<Oas2Operation>;
|
|
221
|
-
Examples?: VisitFunctionOrObject<Record<string, any>>;
|
|
222
|
-
Header?: VisitFunctionOrObject<Oas2Header>;
|
|
223
|
-
Responses?: VisitFunctionOrObject<Record<string, Oas2Response>>;
|
|
224
|
-
Response?: VisitFunctionOrObject<Oas2Response>;
|
|
225
|
-
Schema?: VisitFunctionOrObject<Oas2Schema>;
|
|
226
|
-
Xml?: VisitFunctionOrObject<Oas2Xml>;
|
|
227
|
-
SchemaProperties?: VisitFunctionOrObject<Record<string, Oas2Schema>>;
|
|
228
|
-
NamedSchemas?: VisitFunctionOrObject<Record<string, Oas2Schema>>;
|
|
229
|
-
NamedResponses?: VisitFunctionOrObject<Record<string, Oas2Response>>;
|
|
230
|
-
NamedParameters?: VisitFunctionOrObject<Record<string, Oas2Parameter>>;
|
|
231
|
-
SecurityScheme?: VisitFunctionOrObject<Oas2SecurityScheme>;
|
|
232
|
-
NamedSecuritySchemes?: VisitFunctionOrObject<Record<string, Oas2SecurityScheme>>;
|
|
233
|
-
SpecExtension?: VisitFunctionOrObject<unknown>;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
type Async2FlatVisitor = {
|
|
237
|
-
Root?: VisitFunctionOrObject<Async2Definition>;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
type Async3FlatVisitor = {
|
|
241
|
-
Root?: VisitFunctionOrObject<Async3Definition>;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
type ArazzoFlatVisitor = {
|
|
245
|
-
Root?: VisitFunctionOrObject<ArazzoDefinition>;
|
|
246
|
-
ParameterObject?: VisitFunctionOrObject<Parameter>;
|
|
247
|
-
InfoObject?: VisitFunctionOrObject<InfoObject>;
|
|
248
|
-
OpenAPISourceDescription?: VisitFunctionOrObject<OpenAPISourceDescription>;
|
|
249
|
-
ArazzoSourceDescription?: VisitFunctionOrObject<ArazzoSourceDescription>;
|
|
250
|
-
SourceDescription?: VisitFunctionOrObject<SourceDescription>;
|
|
251
|
-
ExtendedOperation?: VisitFunctionOrObject<ExtendedOperation>;
|
|
252
|
-
Replacement?: VisitFunctionOrObject<Replacement>;
|
|
253
|
-
RequestBody?: VisitFunctionOrObject<RequestBody>;
|
|
254
|
-
CriteriaObject?: VisitFunctionOrObject<CriteriaObject>;
|
|
255
|
-
OnSuccessObject?: VisitFunctionOrObject<OnSuccessObject>;
|
|
256
|
-
OnFailureObject?: VisitFunctionOrObject<OnFailureObject>;
|
|
257
|
-
Step?: VisitFunctionOrObject<Step>;
|
|
258
|
-
Steps?: VisitFunctionOrObject<Step[]>;
|
|
259
|
-
Workflow?: VisitFunctionOrObject<Workflow>;
|
|
260
|
-
Workflows?: VisitFunctionOrObject<Workflow[]>;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
type Overlay1FlatVisitor = {
|
|
264
|
-
Root?: VisitFunctionOrObject<Overlay1Definition>;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
const legacyTypesMap = {
|
|
268
|
-
Root: 'DefinitionRoot',
|
|
269
|
-
ServerVariablesMap: 'ServerVariableMap',
|
|
270
|
-
Paths: ['PathMap', 'PathsMap'],
|
|
271
|
-
CallbacksMap: 'CallbackMap',
|
|
272
|
-
MediaTypesMap: 'MediaTypeMap',
|
|
273
|
-
ExamplesMap: 'ExampleMap',
|
|
274
|
-
EncodingMap: 'EncodingsMap',
|
|
275
|
-
HeadersMap: 'HeaderMap',
|
|
276
|
-
LinksMap: 'LinkMap',
|
|
277
|
-
OAuth2Flows: 'SecuritySchemeFlows',
|
|
278
|
-
Responses: 'ResponsesMap',
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
type Oas3NestedVisitor = {
|
|
282
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
283
|
-
[T in keyof Oas3FlatVisitor]: Oas3FlatVisitor[T] extends Function
|
|
284
|
-
? Oas3FlatVisitor[T]
|
|
285
|
-
: Oas3FlatVisitor[T] & NestedVisitor<Oas3NestedVisitor>;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
type Oas2NestedVisitor = {
|
|
289
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
290
|
-
[T in keyof Oas2FlatVisitor]: Oas2FlatVisitor[T] extends Function
|
|
291
|
-
? Oas2FlatVisitor[T]
|
|
292
|
-
: Oas2FlatVisitor[T] & NestedVisitor<Oas2NestedVisitor>;
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
type Async2NestedVisitor = {
|
|
296
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
297
|
-
[T in keyof Async2FlatVisitor]: Async2FlatVisitor[T] extends Function
|
|
298
|
-
? Async2FlatVisitor[T]
|
|
299
|
-
: Async2FlatVisitor[T] & NestedVisitor<Async2NestedVisitor>;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
type Async3NestedVisitor = {
|
|
303
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
304
|
-
[T in keyof Async3FlatVisitor]: Async3FlatVisitor[T] extends Function
|
|
305
|
-
? Async3FlatVisitor[T]
|
|
306
|
-
: Async3FlatVisitor[T] & NestedVisitor<Async3NestedVisitor>;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
type ArazzoNestedVisitor = {
|
|
310
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
311
|
-
[T in keyof ArazzoFlatVisitor]: ArazzoFlatVisitor[T] extends Function
|
|
312
|
-
? ArazzoFlatVisitor[T]
|
|
313
|
-
: ArazzoFlatVisitor[T] & NestedVisitor<ArazzoNestedVisitor>;
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
type Overlay1NestedVisitor = {
|
|
317
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
318
|
-
[T in keyof Overlay1FlatVisitor]: Overlay1FlatVisitor[T] extends Function
|
|
319
|
-
? Overlay1FlatVisitor[T]
|
|
320
|
-
: Overlay1FlatVisitor[T] & NestedVisitor<Overlay1NestedVisitor>;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
export type Oas3Visitor = BaseVisitor &
|
|
324
|
-
Oas3NestedVisitor &
|
|
325
|
-
Record<string, VisitFunction<any> | NestedVisitObject<any, Oas3NestedVisitor>>;
|
|
326
|
-
|
|
327
|
-
export type Oas2Visitor = BaseVisitor &
|
|
328
|
-
Oas2NestedVisitor &
|
|
329
|
-
Record<string, VisitFunction<any> | NestedVisitObject<any, Oas2NestedVisitor>>;
|
|
330
|
-
|
|
331
|
-
export type Async2Visitor = BaseVisitor &
|
|
332
|
-
Async2NestedVisitor &
|
|
333
|
-
Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
|
|
334
|
-
|
|
335
|
-
export type Async3Visitor = BaseVisitor &
|
|
336
|
-
Async3NestedVisitor &
|
|
337
|
-
Record<string, VisitFunction<any> | NestedVisitObject<any, Async3NestedVisitor>>;
|
|
338
|
-
|
|
339
|
-
export type Arazzo1Visitor = BaseVisitor &
|
|
340
|
-
ArazzoNestedVisitor &
|
|
341
|
-
Record<string, VisitFunction<any> | NestedVisitObject<any, ArazzoNestedVisitor>>;
|
|
342
|
-
|
|
343
|
-
export type Overlay1Visitor = BaseVisitor &
|
|
344
|
-
Overlay1NestedVisitor &
|
|
345
|
-
Record<string, VisitFunction<any> | NestedVisitObject<any, Overlay1NestedVisitor>>;
|
|
346
|
-
|
|
347
|
-
export type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
|
|
348
|
-
|
|
349
|
-
export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
|
350
|
-
[V in keyof T]-?: {
|
|
351
|
-
enter: Array<NormalizeVisitor<T[V]>>;
|
|
352
|
-
leave: Array<NormalizeVisitor<T[V]>>;
|
|
353
|
-
};
|
|
354
|
-
} & {
|
|
355
|
-
ref: {
|
|
356
|
-
enter: Array<VisitorRefNode>;
|
|
357
|
-
leave: Array<VisitorRefNode>;
|
|
358
|
-
};
|
|
359
|
-
[k: string]: {
|
|
360
|
-
// any internal types
|
|
361
|
-
enter: Array<VisitorNode<any>>;
|
|
362
|
-
leave: Array<VisitorNode<any>>;
|
|
363
|
-
};
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
|
|
367
|
-
export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
|
|
368
|
-
export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
|
|
369
|
-
export type Async3Rule = (options: Record<string, any>) => Async3Visitor | Async3Visitor[];
|
|
370
|
-
export type Arazzo1Rule = (options: Record<string, any>) => Arazzo1Visitor | Arazzo1Visitor[];
|
|
371
|
-
export type Overlay1Rule = (options: Record<string, any>) => Overlay1Visitor | Overlay1Visitor[];
|
|
372
|
-
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
|
|
373
|
-
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
|
|
374
|
-
export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
|
|
375
|
-
export type Async3Preprocessor = (options: Record<string, any>) => Async3Visitor;
|
|
376
|
-
export type Arazzo1Preprocessor = (options: Record<string, any>) => Arazzo1Visitor;
|
|
377
|
-
export type Overlay1Preprocessor = (options: Record<string, any>) => Overlay1Visitor;
|
|
378
|
-
export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
|
|
379
|
-
export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
|
|
380
|
-
export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
|
|
381
|
-
export type Async3Decorator = (options: Record<string, any>) => Async3Visitor;
|
|
382
|
-
export type Arazzo1Decorator = (options: Record<string, any>) => Arazzo1Visitor;
|
|
383
|
-
export type Overlay1Decorator = (options: Record<string, any>) => Overlay1Visitor;
|
|
384
|
-
|
|
385
|
-
// alias for the latest version supported
|
|
386
|
-
// every time we update it - consider semver
|
|
387
|
-
export type OasRule = Oas3Rule;
|
|
388
|
-
export type OasPreprocessor = Oas3Preprocessor;
|
|
389
|
-
export type OasDecorator = Oas3Decorator;
|
|
390
|
-
|
|
391
|
-
export type RuleInstanceConfig = {
|
|
392
|
-
ruleId: string;
|
|
393
|
-
severity: ProblemSeverity;
|
|
394
|
-
message?: string;
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
export function normalizeVisitors<T extends BaseVisitor>(
|
|
398
|
-
visitorsConfig: (RuleInstanceConfig & { visitor: NestedVisitObject<unknown, T> })[],
|
|
399
|
-
types: Record<keyof T, NormalizedNodeType>
|
|
400
|
-
): NormalizedOasVisitors<T> {
|
|
401
|
-
const normalizedVisitors: NormalizedOasVisitors<T> = {} as any;
|
|
402
|
-
|
|
403
|
-
normalizedVisitors.any = {
|
|
404
|
-
enter: [],
|
|
405
|
-
leave: [],
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
for (const typeName of Object.keys(types) as Array<keyof T>) {
|
|
409
|
-
normalizedVisitors[typeName] = {
|
|
410
|
-
enter: [],
|
|
411
|
-
leave: [],
|
|
412
|
-
} as any;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
normalizedVisitors.ref = {
|
|
416
|
-
enter: [],
|
|
417
|
-
leave: [],
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
for (const { ruleId, severity, message, visitor } of visitorsConfig) {
|
|
421
|
-
normalizeVisitorLevel({ ruleId, severity, message }, visitor, null);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
for (const v of Object.keys(normalizedVisitors)) {
|
|
425
|
-
normalizedVisitors[v].enter.sort((a, b) => b.depth - a.depth);
|
|
426
|
-
normalizedVisitors[v].leave.sort((a, b) => a.depth - b.depth);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
return normalizedVisitors;
|
|
430
|
-
|
|
431
|
-
function addWeakNodes(
|
|
432
|
-
ruleConf: RuleInstanceConfig,
|
|
433
|
-
from: NormalizedNodeType,
|
|
434
|
-
to: NormalizedNodeType,
|
|
435
|
-
parentContext: VisitorLevelContext,
|
|
436
|
-
stack: NormalizedNodeType[] = []
|
|
437
|
-
) {
|
|
438
|
-
if (stack.includes(from)) return;
|
|
439
|
-
|
|
440
|
-
stack = [...stack, from];
|
|
441
|
-
|
|
442
|
-
const possibleChildren = new Set<NormalizedNodeType>();
|
|
443
|
-
|
|
444
|
-
for (const type of Object.values(from.properties)) {
|
|
445
|
-
if (type === to) {
|
|
446
|
-
addWeakFromStack(ruleConf, stack);
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
if (typeof type === 'object' && type !== null && type.name) {
|
|
450
|
-
possibleChildren.add(type);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (from.additionalProperties && typeof from.additionalProperties !== 'function') {
|
|
454
|
-
if (from.additionalProperties === to) {
|
|
455
|
-
addWeakFromStack(ruleConf, stack);
|
|
456
|
-
} else if (from.additionalProperties.name !== undefined) {
|
|
457
|
-
possibleChildren.add(from.additionalProperties);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
if (from.items && typeof from.items !== 'function') {
|
|
461
|
-
if (from.items === to) {
|
|
462
|
-
addWeakFromStack(ruleConf, stack);
|
|
463
|
-
} else if (from.items.name !== undefined) {
|
|
464
|
-
possibleChildren.add(from.items);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (from.extensionsPrefix) {
|
|
469
|
-
possibleChildren.add(SpecExtension);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
for (const fromType of Array.from(possibleChildren.values())) {
|
|
473
|
-
addWeakNodes(ruleConf, fromType, to, parentContext, stack);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function addWeakFromStack(ruleConf: RuleInstanceConfig, stack: NormalizedNodeType[]) {
|
|
477
|
-
for (const interType of stack.slice(1)) {
|
|
478
|
-
(normalizedVisitors as any)[interType.name] = normalizedVisitors[interType.name] || {
|
|
479
|
-
enter: [],
|
|
480
|
-
leave: [],
|
|
481
|
-
};
|
|
482
|
-
normalizedVisitors[interType.name].enter.push({
|
|
483
|
-
...ruleConf,
|
|
484
|
-
visit: () => undefined,
|
|
485
|
-
depth: 0,
|
|
486
|
-
context: {
|
|
487
|
-
isSkippedLevel: true,
|
|
488
|
-
seen: new Set(),
|
|
489
|
-
parent: parentContext,
|
|
490
|
-
},
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
function findLegacyVisitorNode<T>(
|
|
497
|
-
visitor: NestedVisitObject<unknown, T>,
|
|
498
|
-
typeName: keyof T | Array<keyof T>
|
|
499
|
-
) {
|
|
500
|
-
if (Array.isArray(typeName)) {
|
|
501
|
-
const name = typeName.find((name) => visitor[name]) || undefined;
|
|
502
|
-
return name && visitor[name];
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return visitor[typeName];
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
function normalizeVisitorLevel(
|
|
509
|
-
ruleConf: RuleInstanceConfig,
|
|
510
|
-
visitor: NestedVisitObject<unknown, T>,
|
|
511
|
-
parentContext: VisitorLevelContext | null,
|
|
512
|
-
depth = 0
|
|
513
|
-
) {
|
|
514
|
-
const visitorKeys = Object.keys(types) as Array<keyof T | 'any'>;
|
|
515
|
-
|
|
516
|
-
if (depth === 0) {
|
|
517
|
-
visitorKeys.push('any');
|
|
518
|
-
visitorKeys.push('ref');
|
|
519
|
-
} else {
|
|
520
|
-
if (visitor.any) {
|
|
521
|
-
throw new Error('any() is allowed only on top level');
|
|
522
|
-
}
|
|
523
|
-
if (visitor.ref) {
|
|
524
|
-
throw new Error('ref() is allowed only on top level');
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
for (const typeName of visitorKeys as Array<keyof T>) {
|
|
529
|
-
const typeVisitor = (visitor[typeName] ||
|
|
530
|
-
findLegacyVisitorNode(
|
|
531
|
-
visitor,
|
|
532
|
-
legacyTypesMap[typeName as keyof typeof legacyTypesMap] as keyof T
|
|
533
|
-
)) as NestedVisitObject<unknown, T>;
|
|
534
|
-
const normalizedTypeVisitor = normalizedVisitors[typeName];
|
|
535
|
-
|
|
536
|
-
if (!typeVisitor) continue;
|
|
537
|
-
|
|
538
|
-
let visitorEnter: VisitFunction<unknown> | undefined;
|
|
539
|
-
let visitorLeave: VisitFunction<unknown> | undefined;
|
|
540
|
-
let visitorSkip: SkipFunction<unknown> | undefined;
|
|
541
|
-
|
|
542
|
-
const isObjectVisitor = typeof typeVisitor === 'object';
|
|
543
|
-
|
|
544
|
-
if (typeName === 'ref' && isObjectVisitor && typeVisitor.skip) {
|
|
545
|
-
throw new Error('ref() visitor does not support skip');
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
if (typeof typeVisitor === 'function') {
|
|
549
|
-
visitorEnter = typeVisitor;
|
|
550
|
-
} else if (isObjectVisitor) {
|
|
551
|
-
visitorEnter = typeVisitor.enter;
|
|
552
|
-
visitorLeave = typeVisitor.leave;
|
|
553
|
-
visitorSkip = typeVisitor.skip;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
const context: VisitorLevelContext = {
|
|
557
|
-
activatedOn: null,
|
|
558
|
-
type: types[typeName],
|
|
559
|
-
parent: parentContext,
|
|
560
|
-
isSkippedLevel: false,
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
if (typeof typeVisitor === 'object') {
|
|
564
|
-
normalizeVisitorLevel(ruleConf, typeVisitor, context, depth + 1);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
if (parentContext) {
|
|
568
|
-
addWeakNodes(ruleConf, parentContext.type, types[typeName], parentContext);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
if (visitorEnter || isObjectVisitor) {
|
|
572
|
-
if (visitorEnter && typeof visitorEnter !== 'function') {
|
|
573
|
-
throw new Error('DEV: should be function');
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
normalizedTypeVisitor.enter.push({
|
|
577
|
-
...ruleConf,
|
|
578
|
-
visit: visitorEnter || (() => undefined),
|
|
579
|
-
skip: visitorSkip,
|
|
580
|
-
depth,
|
|
581
|
-
context,
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (visitorLeave) {
|
|
586
|
-
if (typeof visitorLeave !== 'function') {
|
|
587
|
-
throw new Error('DEV: should be function');
|
|
588
|
-
}
|
|
589
|
-
normalizedTypeVisitor.leave.push({
|
|
590
|
-
...ruleConf,
|
|
591
|
-
visit: visitorLeave,
|
|
592
|
-
depth,
|
|
593
|
-
context,
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|