@redocly/openapi-core 0.0.0-snapshot.1737554067
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 +268 -0
- package/lib/benchmark/benches/lint-with-many-rules.bench.d.ts +4 -0
- package/lib/benchmark/benches/lint-with-many-rules.bench.js +38 -0
- package/lib/benchmark/benches/lint-with-nested-rule.bench.d.ts +4 -0
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js +44 -0
- package/lib/benchmark/benches/lint-with-no-rules.bench.d.ts +4 -0
- package/lib/benchmark/benches/lint-with-no-rules.bench.js +25 -0
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.d.ts +4 -0
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +37 -0
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.d.ts +4 -0
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +36 -0
- package/lib/benchmark/benches/recommended-oas3.bench.d.ts +3 -0
- package/lib/benchmark/benches/recommended-oas3.bench.js +21 -0
- package/lib/benchmark/benches/resolve-with-no-external.bench.d.ts +3 -0
- package/lib/benchmark/benches/resolve-with-no-external.bench.js +22 -0
- package/lib/benchmark/utils.d.ts +6 -0
- package/lib/benchmark/utils.js +34 -0
- package/lib/bundle.d.ts +50 -0
- package/lib/bundle.js +385 -0
- package/lib/config/all.d.ts +3 -0
- package/lib/config/all.js +227 -0
- package/lib/config/builtIn.d.ts +3 -0
- package/lib/config/builtIn.js +53 -0
- package/lib/config/config-resolvers.d.ts +30 -0
- package/lib/config/config-resolvers.js +447 -0
- package/lib/config/config.d.ts +53 -0
- package/lib/config/config.js +320 -0
- package/lib/config/index.d.ts +7 -0
- package/lib/config/index.js +23 -0
- package/lib/config/load.d.ts +38 -0
- package/lib/config/load.js +140 -0
- package/lib/config/minimal.d.ts +3 -0
- package/lib/config/minimal.js +203 -0
- package/lib/config/recommended-strict.d.ts +3 -0
- package/lib/config/recommended-strict.js +203 -0
- package/lib/config/recommended.d.ts +3 -0
- package/lib/config/recommended.js +203 -0
- package/lib/config/rules.d.ts +10 -0
- package/lib/config/rules.js +37 -0
- package/lib/config/spec.d.ts +3 -0
- package/lib/config/spec.js +29 -0
- package/lib/config/types.d.ts +189 -0
- package/lib/config/types.js +2 -0
- package/lib/config/utils.d.ts +19 -0
- package/lib/config/utils.js +308 -0
- package/lib/decorators/arazzo/index.d.ts +1 -0
- package/lib/decorators/arazzo/index.js +4 -0
- package/lib/decorators/async2/index.d.ts +1 -0
- package/lib/decorators/async2/index.js +4 -0
- package/lib/decorators/async3/index.d.ts +1 -0
- package/lib/decorators/async3/index.js +4 -0
- package/lib/decorators/common/filters/filter-helper.d.ts +3 -0
- package/lib/decorators/common/filters/filter-helper.js +66 -0
- package/lib/decorators/common/filters/filter-in.d.ts +2 -0
- package/lib/decorators/common/filters/filter-in.js +17 -0
- package/lib/decorators/common/filters/filter-out.d.ts +2 -0
- package/lib/decorators/common/filters/filter-out.js +17 -0
- package/lib/decorators/common/info-description-override.d.ts +2 -0
- package/lib/decorators/common/info-description-override.js +24 -0
- package/lib/decorators/common/info-override.d.ts +2 -0
- package/lib/decorators/common/info-override.js +17 -0
- package/lib/decorators/common/media-type-examples-override.d.ts +2 -0
- package/lib/decorators/common/media-type-examples-override.js +59 -0
- package/lib/decorators/common/operation-description-override.d.ts +2 -0
- package/lib/decorators/common/operation-description-override.js +29 -0
- 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 +2 -0
- package/lib/decorators/common/remove-x-internal.js +69 -0
- package/lib/decorators/common/tag-description-override.d.ts +2 -0
- package/lib/decorators/common/tag-description-override.js +25 -0
- package/lib/decorators/oas2/index.d.ts +11 -0
- package/lib/decorators/oas2/index.js +21 -0
- package/lib/decorators/oas2/remove-unused-components.d.ts +2 -0
- package/lib/decorators/oas2/remove-unused-components.js +89 -0
- package/lib/decorators/oas3/index.d.ts +12 -0
- package/lib/decorators/oas3/index.js +23 -0
- package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
- package/lib/decorators/oas3/remove-unused-components.js +100 -0
- package/lib/env.d.ts +2 -0
- package/lib/env.js +7 -0
- package/lib/format/codeframes.d.ts +22 -0
- package/lib/format/codeframes.js +185 -0
- package/lib/format/format.d.ts +20 -0
- package/lib/format/format.js +365 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +98 -0
- package/lib/js-yaml/index.d.ts +3 -0
- package/lib/js-yaml/index.js +15 -0
- package/lib/lint.d.ts +32 -0
- package/lib/lint.js +118 -0
- package/lib/logger.d.ts +10 -0
- package/lib/logger.js +31 -0
- package/lib/oas-types.d.ts +36 -0
- package/lib/oas-types.js +92 -0
- 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 +96 -0
- package/lib/ref-utils.d.ts +27 -0
- package/lib/ref-utils.js +85 -0
- package/lib/resolve.d.ts +66 -0
- package/lib/resolve.js +342 -0
- package/lib/rules/ajv.d.ts +10 -0
- package/lib/rules/ajv.js +82 -0
- package/lib/rules/arazzo/criteria-unique.d.ts +2 -0
- package/lib/rules/arazzo/criteria-unique.js +71 -0
- package/lib/rules/arazzo/index.d.ts +3 -0
- package/lib/rules/arazzo/index.js +36 -0
- package/lib/rules/arazzo/parameters-unique.d.ts +2 -0
- package/lib/rules/arazzo/parameters-unique.js +32 -0
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +2 -0
- package/lib/rules/arazzo/requestBody-replacements-unique.js +28 -0
- package/lib/rules/arazzo/sourceDescription-type.d.ts +2 -0
- package/lib/rules/arazzo/sourceDescription-type.js +22 -0
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +2 -0
- package/lib/rules/arazzo/sourceDescriptions-name-unique.js +24 -0
- package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts +2 -0
- package/lib/rules/arazzo/sourceDescriptions-not-empty.js +18 -0
- package/lib/rules/arazzo/step-onFailure-unique.d.ts +2 -0
- package/lib/rules/arazzo/step-onFailure-unique.js +32 -0
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts +2 -0
- package/lib/rules/arazzo/step-onSuccess-unique.js +32 -0
- package/lib/rules/arazzo/stepId-unique.d.ts +2 -0
- package/lib/rules/arazzo/stepId-unique.js +26 -0
- package/lib/rules/arazzo/workflow-dependsOn.d.ts +2 -0
- package/lib/rules/arazzo/workflow-dependsOn.js +56 -0
- package/lib/rules/arazzo/workflowId-unique.d.ts +2 -0
- package/lib/rules/arazzo/workflowId-unique.js +22 -0
- package/lib/rules/async2/channels-kebab-case.d.ts +2 -0
- package/lib/rules/async2/channels-kebab-case.js +19 -0
- package/lib/rules/async2/index.d.ts +3 -0
- package/lib/rules/async2/index.js +27 -0
- package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -0
- package/lib/rules/async2/no-channel-trailing-slash.js +16 -0
- package/lib/rules/async3/channels-kebab-case.d.ts +2 -0
- package/lib/rules/async3/channels-kebab-case.js +19 -0
- package/lib/rules/async3/index.d.ts +3 -0
- package/lib/rules/async3/index.js +27 -0
- package/lib/rules/async3/no-channel-trailing-slash.d.ts +2 -0
- package/lib/rules/async3/no-channel-trailing-slash.js +16 -0
- package/lib/rules/common/assertions/asserts.d.ts +30 -0
- package/lib/rules/common/assertions/asserts.js +281 -0
- package/lib/rules/common/assertions/index.d.ts +27 -0
- package/lib/rules/common/assertions/index.js +24 -0
- package/lib/rules/common/assertions/utils.d.ts +28 -0
- package/lib/rules/common/assertions/utils.js +226 -0
- package/lib/rules/common/info-contact.d.ts +2 -0
- package/lib/rules/common/info-contact.js +17 -0
- package/lib/rules/common/info-license-strict.d.ts +2 -0
- package/lib/rules/common/info-license-strict.js +26 -0
- package/lib/rules/common/info-license-url.d.ts +2 -0
- package/lib/rules/common/info-license-url.js +12 -0
- package/lib/rules/common/info-license.d.ts +2 -0
- package/lib/rules/common/info-license.js +17 -0
- package/lib/rules/common/no-ambiguous-paths.d.ts +2 -0
- package/lib/rules/common/no-ambiguous-paths.js +45 -0
- package/lib/rules/common/no-enum-type-mismatch.d.ts +2 -0
- package/lib/rules/common/no-enum-type-mismatch.js +41 -0
- package/lib/rules/common/no-http-verbs-in-paths.d.ts +2 -0
- package/lib/rules/common/no-http-verbs-in-paths.js +33 -0
- package/lib/rules/common/no-identical-paths.d.ts +2 -0
- package/lib/rules/common/no-identical-paths.js +24 -0
- package/lib/rules/common/no-invalid-parameter-examples.d.ts +1 -0
- package/lib/rules/common/no-invalid-parameter-examples.js +24 -0
- package/lib/rules/common/no-invalid-schema-examples.d.ts +1 -0
- package/lib/rules/common/no-invalid-schema-examples.js +22 -0
- package/lib/rules/common/no-path-trailing-slash.d.ts +2 -0
- package/lib/rules/common/no-path-trailing-slash.js +16 -0
- package/lib/rules/common/no-required-schema-properties-undefined.d.ts +2 -0
- package/lib/rules/common/no-required-schema-properties-undefined.js +36 -0
- package/lib/rules/common/operation-2xx-response.d.ts +2 -0
- package/lib/rules/common/operation-2xx-response.js +23 -0
- package/lib/rules/common/operation-4xx-response.d.ts +2 -0
- package/lib/rules/common/operation-4xx-response.js +23 -0
- package/lib/rules/common/operation-description.d.ts +2 -0
- package/lib/rules/common/operation-description.js +12 -0
- package/lib/rules/common/operation-operationId-unique.d.ts +2 -0
- package/lib/rules/common/operation-operationId-unique.js +20 -0
- package/lib/rules/common/operation-operationId-url-safe.d.ts +2 -0
- package/lib/rules/common/operation-operationId-url-safe.js +18 -0
- package/lib/rules/common/operation-operationId.d.ts +2 -0
- package/lib/rules/common/operation-operationId.js +16 -0
- package/lib/rules/common/operation-parameters-unique.d.ts +2 -0
- package/lib/rules/common/operation-parameters-unique.js +40 -0
- package/lib/rules/common/operation-singular-tag.d.ts +2 -0
- package/lib/rules/common/operation-singular-tag.js +16 -0
- package/lib/rules/common/operation-summary.d.ts +2 -0
- package/lib/rules/common/operation-summary.js +12 -0
- package/lib/rules/common/operation-tag-defined.d.ts +2 -0
- package/lib/rules/common/operation-tag-defined.js +24 -0
- package/lib/rules/common/parameter-description.d.ts +2 -0
- package/lib/rules/common/parameter-description.js +22 -0
- package/lib/rules/common/path-declaration-must-exist.d.ts +2 -0
- package/lib/rules/common/path-declaration-must-exist.js +16 -0
- package/lib/rules/common/path-excludes-patterns.d.ts +2 -0
- package/lib/rules/common/path-excludes-patterns.js +22 -0
- package/lib/rules/common/path-http-verbs-order.d.ts +2 -0
- package/lib/rules/common/path-http-verbs-order.js +26 -0
- package/lib/rules/common/path-not-include-query.d.ts +2 -0
- package/lib/rules/common/path-not-include-query.js +18 -0
- package/lib/rules/common/path-params-defined.d.ts +2 -0
- package/lib/rules/common/path-params-defined.js +58 -0
- package/lib/rules/common/path-segment-plural.d.ts +2 -0
- package/lib/rules/common/path-segment-plural.js +33 -0
- package/lib/rules/common/paths-kebab-case.d.ts +2 -0
- package/lib/rules/common/paths-kebab-case.js +20 -0
- package/lib/rules/common/required-string-property-missing-min-length.d.ts +2 -0
- package/lib/rules/common/required-string-property-missing-min-length.js +37 -0
- package/lib/rules/common/response-contains-header.d.ts +2 -0
- package/lib/rules/common/response-contains-header.js +29 -0
- package/lib/rules/common/scalar-property-missing-example.d.ts +2 -0
- package/lib/rules/common/scalar-property-missing-example.js +42 -0
- package/lib/rules/common/security-defined.d.ts +2 -0
- package/lib/rules/common/security-defined.js +65 -0
- package/lib/rules/common/spec-strict-refs.d.ts +2 -0
- package/lib/rules/common/spec-strict-refs.js +30 -0
- package/lib/rules/common/struct.d.ts +2 -0
- package/lib/rules/common/struct.js +158 -0
- package/lib/rules/common/tag-description.d.ts +2 -0
- package/lib/rules/common/tag-description.js +12 -0
- package/lib/rules/common/tags-alphabetical.d.ts +2 -0
- package/lib/rules/common/tags-alphabetical.js +23 -0
- package/lib/rules/no-unresolved-refs.d.ts +5 -0
- package/lib/rules/no-unresolved-refs.js +46 -0
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +5 -0
- package/lib/rules/oas2/boolean-parameter-prefixes.js +22 -0
- package/lib/rules/oas2/index.d.ts +3 -0
- package/lib/rules/oas2/index.js +98 -0
- package/lib/rules/oas2/request-mime-type.d.ts +2 -0
- package/lib/rules/oas2/request-mime-type.js +17 -0
- package/lib/rules/oas2/response-contains-property.d.ts +2 -0
- package/lib/rules/oas2/response-contains-property.js +37 -0
- package/lib/rules/oas2/response-mime-type.d.ts +2 -0
- package/lib/rules/oas2/response-mime-type.js +17 -0
- package/lib/rules/oas3/array-parameter-serialization.d.ts +5 -0
- package/lib/rules/oas3/array-parameter-serialization.js +29 -0
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +5 -0
- package/lib/rules/oas3/boolean-parameter-prefixes.js +24 -0
- package/lib/rules/oas3/component-name-unique.d.ts +2 -0
- package/lib/rules/oas3/component-name-unique.js +133 -0
- package/lib/rules/oas3/index.d.ts +3 -0
- package/lib/rules/oas3/index.js +122 -0
- package/lib/rules/oas3/no-empty-servers.d.ts +2 -0
- package/lib/rules/oas3/no-empty-servers.js +23 -0
- package/lib/rules/oas3/no-example-value-and-externalValue.d.ts +2 -0
- package/lib/rules/oas3/no-example-value-and-externalValue.js +16 -0
- package/lib/rules/oas3/no-invalid-media-type-examples.d.ts +2 -0
- package/lib/rules/oas3/no-invalid-media-type-examples.js +39 -0
- package/lib/rules/oas3/no-server-example.com.d.ts +2 -0
- package/lib/rules/oas3/no-server-example.com.js +18 -0
- package/lib/rules/oas3/no-server-trailing-slash.d.ts +2 -0
- package/lib/rules/oas3/no-server-trailing-slash.js +18 -0
- package/lib/rules/oas3/no-server-variables-empty-enum.d.ts +2 -0
- package/lib/rules/oas3/no-server-variables-empty-enum.js +66 -0
- package/lib/rules/oas3/no-undefined-server-variable.d.ts +2 -0
- package/lib/rules/oas3/no-undefined-server-variable.js +31 -0
- package/lib/rules/oas3/no-unused-components.d.ts +2 -0
- package/lib/rules/oas3/no-unused-components.js +73 -0
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts +5 -0
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +36 -0
- package/lib/rules/oas3/request-mime-type.d.ts +2 -0
- package/lib/rules/oas3/request-mime-type.js +31 -0
- package/lib/rules/oas3/response-contains-property.d.ts +2 -0
- package/lib/rules/oas3/response-contains-property.js +39 -0
- package/lib/rules/oas3/response-mime-type.d.ts +2 -0
- package/lib/rules/oas3/response-mime-type.js +31 -0
- package/lib/rules/oas3/spec-components-invalid-map-name.d.ts +2 -0
- package/lib/rules/oas3/spec-components-invalid-map-name.js +62 -0
- package/lib/rules/other/stats.d.ts +41 -0
- package/lib/rules/other/stats.js +75 -0
- package/lib/rules/spot/no-criteria-xpath.d.ts +2 -0
- package/lib/rules/spot/no-criteria-xpath.js +21 -0
- package/lib/rules/spot/spot-supported-versions.d.ts +2 -0
- package/lib/rules/spot/spot-supported-versions.js +21 -0
- package/lib/rules/utils.d.ts +22 -0
- package/lib/rules/utils.js +183 -0
- package/lib/types/arazzo.d.ts +2 -0
- package/lib/types/arazzo.js +311 -0
- package/lib/types/asyncapi2.d.ts +17 -0
- package/lib/types/asyncapi2.js +1008 -0
- package/lib/types/asyncapi3.d.ts +2 -0
- package/lib/types/asyncapi3.js +347 -0
- package/lib/types/index.d.ts +57 -0
- package/lib/types/index.js +94 -0
- package/lib/types/json-schema-adapter.d.ts +3 -0
- package/lib/types/json-schema-adapter.js +159 -0
- package/lib/types/oas2.d.ts +3 -0
- package/lib/types/oas2.js +456 -0
- package/lib/types/oas3.d.ts +7 -0
- package/lib/types/oas3.js +554 -0
- package/lib/types/oas3_1.d.ts +6 -0
- package/lib/types/oas3_1.js +285 -0
- package/lib/types/redocly-yaml.d.ts +26 -0
- package/lib/types/redocly-yaml.js +1126 -0
- package/lib/typings/arazzo.d.ts +131 -0
- package/lib/typings/arazzo.js +5 -0
- package/lib/typings/asyncapi.d.ts +21 -0
- package/lib/typings/asyncapi.js +2 -0
- package/lib/typings/asyncapi3.d.ts +53 -0
- package/lib/typings/asyncapi3.js +2 -0
- package/lib/typings/common.d.ts +8 -0
- package/lib/typings/common.js +2 -0
- package/lib/typings/openapi.d.ts +355 -0
- package/lib/typings/openapi.js +2 -0
- package/lib/typings/swagger.d.ts +217 -0
- package/lib/typings/swagger.js +2 -0
- package/lib/utils.d.ts +70 -0
- package/lib/utils.js +301 -0
- package/lib/visitors.d.ts +229 -0
- package/lib/visitors.js +176 -0
- package/lib/walk.d.ts +78 -0
- package/lib/walk.js +290 -0
- package/package.json +59 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoExampleValueAndExternalValue = void 0;
|
|
4
|
+
const NoExampleValueAndExternalValue = () => {
|
|
5
|
+
return {
|
|
6
|
+
Example(example, { report, location }) {
|
|
7
|
+
if (example.value && example.externalValue) {
|
|
8
|
+
report({
|
|
9
|
+
message: 'Example object can have either `value` or `externalValue` fields.',
|
|
10
|
+
location: location.child(['value']).key(),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.NoExampleValueAndExternalValue = NoExampleValueAndExternalValue;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidContentExamples = void 0;
|
|
4
|
+
const ref_utils_1 = require("../../ref-utils");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const ValidContentExamples = (opts) => {
|
|
7
|
+
const allowAdditionalProperties = (0, utils_1.getAdditionalPropertiesOption)(opts) ?? false;
|
|
8
|
+
return {
|
|
9
|
+
MediaType: {
|
|
10
|
+
leave(mediaType, ctx) {
|
|
11
|
+
const { location, resolve } = ctx;
|
|
12
|
+
if (!mediaType.schema)
|
|
13
|
+
return;
|
|
14
|
+
if (mediaType.example !== undefined) {
|
|
15
|
+
resolveAndValidateExample(mediaType.example, location.child('example'));
|
|
16
|
+
}
|
|
17
|
+
else if (mediaType.examples) {
|
|
18
|
+
for (const exampleName of Object.keys(mediaType.examples)) {
|
|
19
|
+
resolveAndValidateExample(mediaType.examples[exampleName], location.child(['examples', exampleName, 'value']), true);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function resolveAndValidateExample(example, location, isMultiple) {
|
|
23
|
+
if ((0, ref_utils_1.isRef)(example)) {
|
|
24
|
+
const resolved = resolve(example);
|
|
25
|
+
if (!resolved.location)
|
|
26
|
+
return;
|
|
27
|
+
location = isMultiple ? resolved.location.child('value') : resolved.location;
|
|
28
|
+
example = resolved.node;
|
|
29
|
+
}
|
|
30
|
+
if (isMultiple && typeof example.value === 'undefined') {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
(0, utils_1.validateExample)(isMultiple ? example.value : example, mediaType.schema, location, ctx, allowAdditionalProperties);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.ValidContentExamples = ValidContentExamples;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoServerExample = void 0;
|
|
4
|
+
const NoServerExample = () => {
|
|
5
|
+
return {
|
|
6
|
+
Server(server, { report, location }) {
|
|
7
|
+
// eslint-disable-next-line no-useless-escape
|
|
8
|
+
const pattern = /^(.*[\/.])?(example\.com|localhost)([\/:?].*|$)/;
|
|
9
|
+
if (server.url && pattern.test(server.url)) {
|
|
10
|
+
report({
|
|
11
|
+
message: 'Server `url` should not point to example.com or localhost.',
|
|
12
|
+
location: location.child(['url']),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.NoServerExample = NoServerExample;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoServerTrailingSlash = void 0;
|
|
4
|
+
const NoServerTrailingSlash = () => {
|
|
5
|
+
return {
|
|
6
|
+
Server(server, { report, location }) {
|
|
7
|
+
if (!server.url)
|
|
8
|
+
return;
|
|
9
|
+
if (server.url.endsWith('/') && server.url !== '/') {
|
|
10
|
+
report({
|
|
11
|
+
message: 'Server `url` should not have a trailing slash.',
|
|
12
|
+
location: location.child(['url']),
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.NoServerTrailingSlash = NoServerTrailingSlash;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoServerVariablesEmptyEnum = void 0;
|
|
4
|
+
var enumError;
|
|
5
|
+
(function (enumError) {
|
|
6
|
+
enumError["empty"] = "empty";
|
|
7
|
+
enumError["invalidDefaultValue"] = "invalidDefaultValue";
|
|
8
|
+
})(enumError || (enumError = {}));
|
|
9
|
+
const NoServerVariablesEmptyEnum = () => {
|
|
10
|
+
return {
|
|
11
|
+
Root(root, { report, location }) {
|
|
12
|
+
if (!root.servers || root.servers.length === 0)
|
|
13
|
+
return;
|
|
14
|
+
const invalidVariables = [];
|
|
15
|
+
if (Array.isArray(root.servers)) {
|
|
16
|
+
for (const server of root.servers) {
|
|
17
|
+
const enumErrors = checkEnumVariables(server);
|
|
18
|
+
if (!enumErrors)
|
|
19
|
+
continue;
|
|
20
|
+
invalidVariables.push(...enumErrors);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const enumErrors = checkEnumVariables(root.servers);
|
|
25
|
+
if (!enumErrors)
|
|
26
|
+
return;
|
|
27
|
+
invalidVariables.push(...enumErrors);
|
|
28
|
+
}
|
|
29
|
+
for (const invalidVariable of invalidVariables) {
|
|
30
|
+
if (invalidVariable === enumError.empty) {
|
|
31
|
+
report({
|
|
32
|
+
message: 'Server variable with `enum` must be a non-empty array.',
|
|
33
|
+
location: location.child(['servers']).key(),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (invalidVariable === enumError.invalidDefaultValue) {
|
|
37
|
+
report({
|
|
38
|
+
message: 'Server variable define `enum` and `default`. `enum` must include default value',
|
|
39
|
+
location: location.child(['servers']).key(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.NoServerVariablesEmptyEnum = NoServerVariablesEmptyEnum;
|
|
47
|
+
function checkEnumVariables(server) {
|
|
48
|
+
if (server.variables && Object.keys(server.variables).length === 0)
|
|
49
|
+
return;
|
|
50
|
+
const errors = [];
|
|
51
|
+
for (const variable in server.variables) {
|
|
52
|
+
const serverVariable = server.variables[variable];
|
|
53
|
+
if (!serverVariable.enum)
|
|
54
|
+
continue;
|
|
55
|
+
if (Array.isArray(serverVariable.enum) && serverVariable.enum?.length === 0)
|
|
56
|
+
errors.push(enumError.empty);
|
|
57
|
+
if (!serverVariable.default)
|
|
58
|
+
continue;
|
|
59
|
+
const defaultValue = server.variables[variable].default;
|
|
60
|
+
if (serverVariable.enum && !serverVariable.enum.includes(defaultValue))
|
|
61
|
+
errors.push(enumError.invalidDefaultValue);
|
|
62
|
+
}
|
|
63
|
+
if (errors.length)
|
|
64
|
+
return errors;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoUndefinedServerVariable = void 0;
|
|
4
|
+
const NoUndefinedServerVariable = () => {
|
|
5
|
+
return {
|
|
6
|
+
Server(server, { report, location }) {
|
|
7
|
+
if (!server.url)
|
|
8
|
+
return;
|
|
9
|
+
const urlVariables = server.url.match(/{[^}]+}/g)?.map((e) => e.slice(1, e.length - 1)) || [];
|
|
10
|
+
const definedVariables = (server?.variables && Object.keys(server.variables)) || [];
|
|
11
|
+
for (const serverVar of urlVariables) {
|
|
12
|
+
if (!definedVariables.includes(serverVar)) {
|
|
13
|
+
report({
|
|
14
|
+
message: `The \`${serverVar}\` variable is not defined in the \`variables\` objects.`,
|
|
15
|
+
location: location.child(['url']),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
for (const definedServerVar of definedVariables) {
|
|
20
|
+
if (!urlVariables.includes(definedServerVar)) {
|
|
21
|
+
report({
|
|
22
|
+
message: `The \`${definedServerVar}\` variable is not used in the server's \`url\` field.`,
|
|
23
|
+
location: location.child(['variables', definedServerVar]).key(),
|
|
24
|
+
from: location.child('url'),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.NoUndefinedServerVariable = NoUndefinedServerVariable;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoUnusedComponents = void 0;
|
|
4
|
+
const NoUnusedComponents = () => {
|
|
5
|
+
const components = new Map();
|
|
6
|
+
function registerComponent(location, name) {
|
|
7
|
+
components.set(location.absolutePointer, {
|
|
8
|
+
used: components.get(location.absolutePointer)?.used || false,
|
|
9
|
+
location,
|
|
10
|
+
name,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
ref(ref, { type, resolve, key, location }) {
|
|
15
|
+
if (['Schema', 'Header', 'Parameter', 'Response', 'Example', 'RequestBody'].includes(type.name)) {
|
|
16
|
+
const resolvedRef = resolve(ref);
|
|
17
|
+
if (!resolvedRef.location)
|
|
18
|
+
return;
|
|
19
|
+
components.set(resolvedRef.location.absolutePointer, {
|
|
20
|
+
used: true,
|
|
21
|
+
name: key.toString(),
|
|
22
|
+
location,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
Root: {
|
|
27
|
+
leave(_, { report }) {
|
|
28
|
+
components.forEach((usageInfo) => {
|
|
29
|
+
if (!usageInfo.used) {
|
|
30
|
+
report({
|
|
31
|
+
message: `Component: "${usageInfo.name}" is never used.`,
|
|
32
|
+
location: usageInfo.location.key(),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
NamedSchemas: {
|
|
39
|
+
Schema(schema, { location, key }) {
|
|
40
|
+
if (!schema.allOf) {
|
|
41
|
+
// FIXME: find a better way to detect possible discriminator
|
|
42
|
+
registerComponent(location, key.toString());
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
NamedParameters: {
|
|
47
|
+
Parameter(_parameter, { location, key }) {
|
|
48
|
+
registerComponent(location, key.toString());
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
NamedResponses: {
|
|
52
|
+
Response(_response, { location, key }) {
|
|
53
|
+
registerComponent(location, key.toString());
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
NamedExamples: {
|
|
57
|
+
Example(_example, { location, key }) {
|
|
58
|
+
registerComponent(location, key.toString());
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
NamedRequestBodies: {
|
|
62
|
+
RequestBody(_requestBody, { location, key }) {
|
|
63
|
+
registerComponent(location, key.toString());
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
NamedHeaders: {
|
|
67
|
+
Header(_header, { location, key }) {
|
|
68
|
+
registerComponent(location, key.toString());
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
exports.NoUnusedComponents = NoUnusedComponents;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Operation4xxProblemDetailsRfc7807 = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
/**
|
|
6
|
+
* Validation according to rfc7807 - https://datatracker.ietf.org/doc/html/rfc7807
|
|
7
|
+
*/
|
|
8
|
+
const Operation4xxProblemDetailsRfc7807 = () => {
|
|
9
|
+
return {
|
|
10
|
+
Response: {
|
|
11
|
+
skip(_, key) {
|
|
12
|
+
return !/4[Xx0-9]{2}/.test(`${key}`);
|
|
13
|
+
},
|
|
14
|
+
enter(response, { report, location }) {
|
|
15
|
+
if (!response.content || !response.content['application/problem+json'])
|
|
16
|
+
report({
|
|
17
|
+
message: 'Response `4xx` must have content-type `application/problem+json`.',
|
|
18
|
+
location: location.key(),
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
MediaType: {
|
|
22
|
+
skip(_, key) {
|
|
23
|
+
return key !== 'application/problem+json';
|
|
24
|
+
},
|
|
25
|
+
enter(media, ctx) {
|
|
26
|
+
(0, utils_1.validateDefinedAndNonEmpty)('schema', media, ctx);
|
|
27
|
+
},
|
|
28
|
+
SchemaProperties(schema, ctx) {
|
|
29
|
+
(0, utils_1.validateDefinedAndNonEmpty)('type', schema, ctx);
|
|
30
|
+
(0, utils_1.validateDefinedAndNonEmpty)('title', schema, ctx);
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.Operation4xxProblemDetailsRfc7807 = Operation4xxProblemDetailsRfc7807;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequestMimeType = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const RequestMimeType = ({ allowedValues }) => {
|
|
6
|
+
return {
|
|
7
|
+
Paths: {
|
|
8
|
+
RequestBody: {
|
|
9
|
+
leave(requestBody, ctx) {
|
|
10
|
+
(0, utils_1.validateMimeTypeOAS3)({ type: 'consumes', value: requestBody }, ctx, allowedValues);
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
Callback: {
|
|
14
|
+
RequestBody() { },
|
|
15
|
+
Response: {
|
|
16
|
+
leave(response, ctx) {
|
|
17
|
+
(0, utils_1.validateMimeTypeOAS3)({ type: 'consumes', value: response }, ctx, allowedValues);
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
WebhooksMap: {
|
|
23
|
+
Response: {
|
|
24
|
+
leave(response, ctx) {
|
|
25
|
+
(0, utils_1.validateMimeTypeOAS3)({ type: 'consumes', value: response }, ctx, allowedValues);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.RequestMimeType = RequestMimeType;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponseContainsProperty = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const ResponseContainsProperty = (options) => {
|
|
6
|
+
const names = options.names || {};
|
|
7
|
+
let key;
|
|
8
|
+
return {
|
|
9
|
+
Operation: {
|
|
10
|
+
Response: {
|
|
11
|
+
skip: (_response, key) => {
|
|
12
|
+
return `${key}` === '204';
|
|
13
|
+
},
|
|
14
|
+
enter: (_response, ctx) => {
|
|
15
|
+
key = ctx.key;
|
|
16
|
+
},
|
|
17
|
+
MediaType: {
|
|
18
|
+
Schema(schema, { report, location }) {
|
|
19
|
+
if (schema.type !== 'object')
|
|
20
|
+
return;
|
|
21
|
+
const expectedProperties = names[key] ||
|
|
22
|
+
names[(0, utils_1.getMatchingStatusCodeRange)(key)] ||
|
|
23
|
+
names[(0, utils_1.getMatchingStatusCodeRange)(key).toLowerCase()] ||
|
|
24
|
+
[];
|
|
25
|
+
for (const expectedProperty of expectedProperties) {
|
|
26
|
+
if (!schema.properties?.[expectedProperty]) {
|
|
27
|
+
report({
|
|
28
|
+
message: `Response object must contain a top-level "${expectedProperty}" property.`,
|
|
29
|
+
location: location.child('properties').key(),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.ResponseContainsProperty = ResponseContainsProperty;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponseMimeType = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const ResponseMimeType = ({ allowedValues }) => {
|
|
6
|
+
return {
|
|
7
|
+
Paths: {
|
|
8
|
+
Response: {
|
|
9
|
+
leave(response, ctx) {
|
|
10
|
+
(0, utils_1.validateMimeTypeOAS3)({ type: 'produces', value: response }, ctx, allowedValues);
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
Callback: {
|
|
14
|
+
Response() { },
|
|
15
|
+
RequestBody: {
|
|
16
|
+
leave(requestBody, ctx) {
|
|
17
|
+
(0, utils_1.validateMimeTypeOAS3)({ type: 'produces', value: requestBody }, ctx, allowedValues);
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
WebhooksMap: {
|
|
23
|
+
RequestBody: {
|
|
24
|
+
leave(requestBody, ctx) {
|
|
25
|
+
(0, utils_1.validateMimeTypeOAS3)({ type: 'produces', value: requestBody }, ctx, allowedValues);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.ResponseMimeType = ResponseMimeType;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpecComponentsInvalidMapName = void 0;
|
|
4
|
+
const SpecComponentsInvalidMapName = () => {
|
|
5
|
+
const KEYS_REGEX = '^[a-zA-Z0-9\\.\\-_]+$';
|
|
6
|
+
function validateKey(key, report, location, component) {
|
|
7
|
+
if (!new RegExp(KEYS_REGEX).test(key)) {
|
|
8
|
+
report({
|
|
9
|
+
message: `The map key in ${component} "${key}" does not match the regular expression "${KEYS_REGEX}"`,
|
|
10
|
+
location: location.key(),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
NamedSchemas: {
|
|
16
|
+
Schema(_node, { key, report, location }) {
|
|
17
|
+
validateKey(key, report, location, 'schemas');
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
NamedParameters: {
|
|
21
|
+
Parameter(_node, { key, report, location }) {
|
|
22
|
+
validateKey(key, report, location, 'parameters');
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
NamedResponses: {
|
|
26
|
+
Response(_node, { key, report, location }) {
|
|
27
|
+
validateKey(key, report, location, 'responses');
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
NamedExamples: {
|
|
31
|
+
Example(_node, { key, report, location }) {
|
|
32
|
+
validateKey(key, report, location, 'examples');
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
NamedRequestBodies: {
|
|
36
|
+
RequestBody(_node, { key, report, location }) {
|
|
37
|
+
validateKey(key, report, location, 'requestBodies');
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
NamedHeaders: {
|
|
41
|
+
Header(_node, { key, report, location }) {
|
|
42
|
+
validateKey(key, report, location, 'headers');
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
NamedSecuritySchemes: {
|
|
46
|
+
SecurityScheme(_node, { key, report, location }) {
|
|
47
|
+
validateKey(key, report, location, 'securitySchemes');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
NamedLinks: {
|
|
51
|
+
Link(_node, { key, report, location }) {
|
|
52
|
+
validateKey(key, report, location, 'links');
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
NamedCallbacks: {
|
|
56
|
+
Callback(_node, { key, report, location }) {
|
|
57
|
+
validateKey(key, report, location, 'callbacks');
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.SpecComponentsInvalidMapName = SpecComponentsInvalidMapName;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Oas3Parameter, OasRef, Oas3Tag } from '../../typings/openapi';
|
|
2
|
+
import type { Oas2Parameter } from '../../typings/swagger';
|
|
3
|
+
import type { StatsAccumulator } from '../../typings/common';
|
|
4
|
+
export declare const Stats: (statsAccumulator: StatsAccumulator) => {
|
|
5
|
+
ExternalDocs: {
|
|
6
|
+
leave(): void;
|
|
7
|
+
};
|
|
8
|
+
ref: {
|
|
9
|
+
enter(ref: OasRef): void;
|
|
10
|
+
};
|
|
11
|
+
Tag: {
|
|
12
|
+
leave(tag: Oas3Tag): void;
|
|
13
|
+
};
|
|
14
|
+
Link: {
|
|
15
|
+
leave(link: any): void;
|
|
16
|
+
};
|
|
17
|
+
Root: {
|
|
18
|
+
leave(): void;
|
|
19
|
+
};
|
|
20
|
+
WebhooksMap: {
|
|
21
|
+
Operation: {
|
|
22
|
+
leave(operation: any): void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
Paths: {
|
|
26
|
+
PathItem: {
|
|
27
|
+
leave(): void;
|
|
28
|
+
Operation: {
|
|
29
|
+
leave(operation: any): void;
|
|
30
|
+
};
|
|
31
|
+
Parameter: {
|
|
32
|
+
leave(parameter: Oas2Parameter | Oas3Parameter): void;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
NamedSchemas: {
|
|
37
|
+
Schema: {
|
|
38
|
+
leave(): void;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stats = void 0;
|
|
4
|
+
const Stats = (statsAccumulator) => {
|
|
5
|
+
return {
|
|
6
|
+
ExternalDocs: {
|
|
7
|
+
leave() {
|
|
8
|
+
statsAccumulator.externalDocs.total++;
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
ref: {
|
|
12
|
+
enter(ref) {
|
|
13
|
+
statsAccumulator.refs.items.add(ref['$ref']);
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
Tag: {
|
|
17
|
+
leave(tag) {
|
|
18
|
+
statsAccumulator.tags.items.add(tag.name);
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
Link: {
|
|
22
|
+
leave(link) {
|
|
23
|
+
statsAccumulator.links.items.add(link.operationId);
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
Root: {
|
|
27
|
+
leave() {
|
|
28
|
+
statsAccumulator.parameters.total = statsAccumulator.parameters.items.size;
|
|
29
|
+
statsAccumulator.refs.total = statsAccumulator.refs.items.size;
|
|
30
|
+
statsAccumulator.links.total = statsAccumulator.links.items.size;
|
|
31
|
+
statsAccumulator.tags.total = statsAccumulator.tags.items.size;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
WebhooksMap: {
|
|
35
|
+
Operation: {
|
|
36
|
+
leave(operation) {
|
|
37
|
+
statsAccumulator.webhooks.total++;
|
|
38
|
+
operation.tags &&
|
|
39
|
+
operation.tags.forEach((tag) => {
|
|
40
|
+
statsAccumulator.tags.items.add(tag);
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
Paths: {
|
|
46
|
+
PathItem: {
|
|
47
|
+
leave() {
|
|
48
|
+
statsAccumulator.pathItems.total++;
|
|
49
|
+
},
|
|
50
|
+
Operation: {
|
|
51
|
+
leave(operation) {
|
|
52
|
+
statsAccumulator.operations.total++;
|
|
53
|
+
operation.tags &&
|
|
54
|
+
operation.tags.forEach((tag) => {
|
|
55
|
+
statsAccumulator.tags.items.add(tag);
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
Parameter: {
|
|
60
|
+
leave(parameter) {
|
|
61
|
+
statsAccumulator.parameters.items.add(parameter.name);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
NamedSchemas: {
|
|
67
|
+
Schema: {
|
|
68
|
+
leave() {
|
|
69
|
+
statsAccumulator.schemas.total++;
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.Stats = Stats;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoCriteriaXpath = void 0;
|
|
4
|
+
const NoCriteriaXpath = () => {
|
|
5
|
+
return {
|
|
6
|
+
CriterionObject: {
|
|
7
|
+
enter(criteria, { report, location }) {
|
|
8
|
+
if (!criteria.type) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (criteria?.type?.type === 'xpath' || criteria?.type === 'xpath') {
|
|
12
|
+
report({
|
|
13
|
+
message: 'The `xpath` type criteria is not supported by Spot.',
|
|
14
|
+
location: location.child(['type']),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.NoCriteriaXpath = NoCriteriaXpath;
|