@redocly/openapi-core 1.25.14 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/__tests__/utils.ts +0 -3
- package/lib/bundle.js +3 -3
- package/lib/config/all.js +130 -48
- package/lib/config/builtIn.d.ts +1 -1
- package/lib/config/builtIn.js +5 -3
- package/lib/config/config-resolvers.js +9 -9
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +38 -20
- package/lib/config/minimal.js +125 -49
- package/lib/config/recommended-strict.js +124 -48
- package/lib/config/recommended.js +123 -47
- package/lib/config/rules.d.ts +2 -2
- package/lib/config/spec.d.ts +3 -0
- package/lib/config/spec.js +31 -0
- package/lib/config/types.d.ts +23 -23
- package/lib/config/utils.d.ts +1 -1
- package/lib/config/utils.js +33 -23
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/lint.js +3 -3
- package/lib/oas-types.d.ts +11 -11
- package/lib/oas-types.js +6 -6
- package/lib/rules/arazzo/criteria-unique.d.ts +2 -2
- package/lib/rules/arazzo/index.d.ts +2 -2
- package/lib/rules/arazzo/index.js +6 -4
- package/lib/rules/arazzo/parameters-unique.d.ts +2 -2
- package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +2 -2
- package/lib/rules/arazzo/sourceDescription-type.d.ts +2 -0
- package/lib/rules/arazzo/{source-description-type.js → sourceDescription-type.js} +5 -3
- package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +2 -2
- 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 -2
- package/lib/rules/arazzo/step-onSuccess-unique.d.ts +2 -2
- package/lib/rules/arazzo/stepId-unique.d.ts +2 -2
- package/lib/rules/arazzo/workflow-dependsOn.d.ts +2 -2
- package/lib/rules/arazzo/workflowId-unique.d.ts +2 -2
- package/lib/rules/async2/index.js +5 -2
- package/lib/rules/async3/index.js +5 -2
- package/lib/rules/common/assertions/index.d.ts +2 -2
- package/lib/rules/common/struct.d.ts +2 -0
- package/lib/rules/common/{spec.js → struct.js} +3 -3
- package/lib/rules/oas2/index.js +5 -2
- package/lib/rules/oas3/index.js +5 -2
- package/lib/rules/spot/no-actions-type-end.d.ts +2 -2
- package/lib/rules/spot/no-criteria-xpath.d.ts +2 -2
- package/lib/rules/spot/parameters-not-in-body.d.ts +2 -2
- package/lib/rules/spot/version-enum.d.ts +2 -2
- package/lib/types/arazzo.d.ts +1 -1
- package/lib/types/arazzo.js +3 -27
- package/lib/types/redocly-yaml.d.ts +6 -8
- package/lib/types/redocly-yaml.js +47 -12
- package/lib/typings/arazzo.d.ts +1 -15
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +3 -2
- package/lib/visitors.d.ts +5 -7
- package/package.json +2 -2
- package/src/__tests__/lint.test.ts +3 -3
- package/src/bundle.ts +3 -3
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +228 -70
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +16 -3
- package/src/config/__tests__/config-resolvers.test.ts +14 -2
- package/src/config/__tests__/config.test.ts +11 -6
- package/src/config/all.ts +130 -48
- package/src/config/builtIn.ts +10 -8
- package/src/config/config-resolvers.ts +9 -9
- package/src/config/config.ts +46 -22
- package/src/config/minimal.ts +125 -49
- package/src/config/recommended-strict.ts +124 -48
- package/src/config/recommended.ts +123 -47
- package/src/config/rules.ts +2 -2
- package/src/config/spec.ts +32 -0
- package/src/config/types.ts +27 -33
- package/src/config/utils.ts +38 -26
- package/src/index.ts +1 -1
- package/src/lint.ts +6 -6
- package/src/oas-types.ts +19 -20
- package/src/rules/arazzo/__tests__/criteria-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/no-actions-type-end.test.ts +1 -2
- package/src/rules/arazzo/__tests__/no-criteria-xpath.test.ts +1 -2
- package/src/rules/arazzo/__tests__/parameters-not-in-body.test.ts +1 -2
- package/src/rules/arazzo/__tests__/parameters-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/requestBody-replacements-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/source-description-type.test.ts +2 -4
- package/src/rules/arazzo/__tests__/sourceDescription-name-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/sourceDescriptions-not-empty.test.ts +104 -0
- package/src/rules/arazzo/__tests__/step-onFailure-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/step-onSuccess-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/stepId-unique.test.ts +1 -2
- package/src/rules/arazzo/__tests__/version-enum.test.ts +1 -2
- package/src/rules/arazzo/__tests__/workflow-dependsOn.test.ts +3 -6
- package/src/rules/arazzo/__tests__/workflowId-unique.test.ts +2 -4
- package/src/rules/arazzo/criteria-unique.ts +2 -2
- package/src/rules/arazzo/index.ts +23 -21
- package/src/rules/arazzo/parameters-unique.ts +2 -2
- package/src/rules/arazzo/requestBody-replacements-unique.ts +2 -2
- package/src/rules/arazzo/{source-description-type.ts → sourceDescription-type.ts} +6 -5
- package/src/rules/arazzo/sourceDescriptions-name-unique.ts +2 -2
- package/src/rules/arazzo/sourceDescriptions-not-empty.ts +17 -0
- package/src/rules/arazzo/step-onFailure-unique.ts +2 -2
- package/src/rules/arazzo/step-onSuccess-unique.ts +2 -2
- package/src/rules/arazzo/stepId-unique.ts +2 -2
- package/src/rules/arazzo/workflow-dependsOn.ts +2 -2
- package/src/rules/arazzo/workflowId-unique.ts +2 -2
- package/src/rules/async2/index.ts +5 -2
- package/src/rules/async3/index.ts +5 -2
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +1 -1
- package/src/rules/common/__tests__/{spec.test.ts → struct.test.ts} +35 -35
- package/src/rules/common/assertions/index.ts +2 -2
- package/src/rules/common/{spec.ts → struct.ts} +2 -2
- package/src/rules/oas2/index.ts +5 -2
- package/src/rules/oas3/__tests__/spec/spec.test.ts +10 -10
- package/src/rules/oas3/index.ts +5 -2
- package/src/rules/spot/no-actions-type-end.ts +2 -2
- package/src/rules/spot/no-criteria-xpath.ts +2 -2
- package/src/rules/spot/parameters-not-in-body.ts +2 -2
- package/src/rules/spot/version-enum.ts +2 -2
- package/src/types/arazzo.ts +2 -25
- package/src/types/redocly-yaml.ts +48 -16
- package/src/typings/arazzo.ts +1 -20
- package/src/utils.ts +4 -2
- package/src/visitors.ts +4 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/arazzo/source-description-type.d.ts +0 -2
- package/lib/rules/common/spec.d.ts +0 -2
package/lib/oas-types.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import type { BuiltInAsync2RuleId, BuiltInAsync3RuleId,
|
|
2
|
-
import type { Oas3Rule, Oas3Preprocessor, Oas2Rule, Oas2Preprocessor, Async2Preprocessor, Async2Rule, Async3Preprocessor, Async3Rule,
|
|
1
|
+
import type { BuiltInAsync2RuleId, BuiltInAsync3RuleId, BuiltInArazzo1RuleId, BuiltInOAS2RuleId, BuiltInOAS3RuleId } from './types/redocly-yaml';
|
|
2
|
+
import type { Oas3Rule, Oas3Preprocessor, Oas2Rule, Oas2Preprocessor, Async2Preprocessor, Async2Rule, Async3Preprocessor, Async3Rule, Arazzo1Preprocessor, Arazzo1Rule } from './visitors';
|
|
3
3
|
export declare enum SpecVersion {
|
|
4
4
|
OAS2 = "oas2",
|
|
5
5
|
OAS3_0 = "oas3_0",
|
|
6
6
|
OAS3_1 = "oas3_1",
|
|
7
7
|
Async2 = "async2",
|
|
8
8
|
Async3 = "async3",
|
|
9
|
-
|
|
9
|
+
Arazzo1 = "arazzo1"
|
|
10
10
|
}
|
|
11
11
|
export declare enum SpecMajorVersion {
|
|
12
12
|
OAS2 = "oas2",
|
|
13
13
|
OAS3 = "oas3",
|
|
14
14
|
Async2 = "async2",
|
|
15
15
|
Async3 = "async3",
|
|
16
|
-
|
|
16
|
+
Arazzo1 = "arazzo1"
|
|
17
17
|
}
|
|
18
18
|
export type RuleMap<Key extends string, RuleConfig, T> = Record<T extends 'built-in' ? Key : string, RuleConfig>;
|
|
19
|
-
export type Oas3RuleSet<T = undefined> = RuleMap<
|
|
20
|
-
export type Oas2RuleSet<T = undefined> = RuleMap<
|
|
21
|
-
export type Async2RuleSet<T = undefined> = RuleMap<BuiltInAsync2RuleId | 'assertions', Async2Rule, T>;
|
|
22
|
-
export type Async3RuleSet<T = undefined> = RuleMap<BuiltInAsync3RuleId | 'assertions', Async3Rule, T>;
|
|
23
|
-
export type
|
|
19
|
+
export type Oas3RuleSet<T = undefined> = RuleMap<BuiltInOAS3RuleId | 'struct' | 'assertions', Oas3Rule, T>;
|
|
20
|
+
export type Oas2RuleSet<T = undefined> = RuleMap<BuiltInOAS2RuleId | 'struct' | 'assertions', Oas2Rule, T>;
|
|
21
|
+
export type Async2RuleSet<T = undefined> = RuleMap<BuiltInAsync2RuleId | 'struct' | 'assertions', Async2Rule, T>;
|
|
22
|
+
export type Async3RuleSet<T = undefined> = RuleMap<BuiltInAsync3RuleId | 'struct' | 'assertions', Async3Rule, T>;
|
|
23
|
+
export type Arazzo1RuleSet<T = undefined> = RuleMap<BuiltInArazzo1RuleId | 'struct' | 'assertions', Arazzo1Rule, T>;
|
|
24
24
|
export type Oas3PreprocessorsSet = Record<string, Oas3Preprocessor>;
|
|
25
25
|
export type Oas2PreprocessorsSet = Record<string, Oas2Preprocessor>;
|
|
26
26
|
export type Async2PreprocessorsSet = Record<string, Async2Preprocessor>;
|
|
27
27
|
export type Async3PreprocessorsSet = Record<string, Async3Preprocessor>;
|
|
28
|
-
export type
|
|
28
|
+
export type Arazzo1PreprocessorsSet = Record<string, Arazzo1Preprocessor>;
|
|
29
29
|
export type Oas3DecoratorsSet = Record<string, Oas3Preprocessor>;
|
|
30
30
|
export type Oas2DecoratorsSet = Record<string, Oas2Preprocessor>;
|
|
31
31
|
export type Async2DecoratorsSet = Record<string, Async2Preprocessor>;
|
|
32
32
|
export type Async3DecoratorsSet = Record<string, Async3Preprocessor>;
|
|
33
|
-
export type
|
|
33
|
+
export type Arazzo1DecoratorsSet = Record<string, Arazzo1Preprocessor>;
|
|
34
34
|
export declare function detectSpec(root: unknown): SpecVersion;
|
|
35
35
|
export declare function getMajorSpecVersion(version: SpecVersion): SpecMajorVersion;
|
|
36
36
|
export declare function getTypes(spec: SpecVersion): Record<string, import("./types").NodeType> | Record<"Root" | "Tag" | "TagList" | "ExternalDocs" | "SecurityRequirement" | "SecurityRequirementList" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Parameter" | "ParameterList" | "ParameterItems" | "Operation" | "Example" | "ExamplesMap" | "Examples" | "Header" | "Responses" | "Response" | "Schema" | "Xml" | "SchemaProperties" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedSecuritySchemes" | "SecurityScheme" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "XServer" | "XServerList", import("./types").NodeType> | Record<"Root" | "Tag" | "TagList" | "ExternalDocs" | "SecurityRequirement" | "SecurityRequirementList" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Parameter" | "ParameterList" | "Operation" | "Example" | "ExamplesMap" | "Header" | "Responses" | "Response" | "Schema" | "Xml" | "SchemaProperties" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedSecuritySchemes" | "SecurityScheme" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "Server" | "ServerList" | "ServerVariable" | "ServerVariablesMap" | "Callback" | "CallbacksMap" | "RequestBody" | "MediaTypesMap" | "MediaType" | "Encoding" | "EncodingMap" | "HeadersMap" | "Link" | "LinksMap" | "DiscriminatorMapping" | "Discriminator" | "Components" | "NamedExamples" | "NamedRequestBodies" | "NamedHeaders" | "NamedLinks" | "NamedCallbacks" | "ImplicitFlow" | "PasswordFlow" | "ClientCredentials" | "AuthorizationCode" | "OAuth2Flows" | "XUsePkce" | "WebhooksMap", import("./types").NodeType> | Record<"Root" | "Info" | "License" | "Operation" | "Schema" | "SchemaProperties" | "SecurityScheme" | "Components" | "PatternProperties" | "NamedPathItems" | "DependentRequired", import("./types").NodeType>;
|
package/lib/oas-types.js
CHANGED
|
@@ -19,7 +19,7 @@ var SpecVersion;
|
|
|
19
19
|
SpecVersion["OAS3_1"] = "oas3_1";
|
|
20
20
|
SpecVersion["Async2"] = "async2";
|
|
21
21
|
SpecVersion["Async3"] = "async3";
|
|
22
|
-
SpecVersion["
|
|
22
|
+
SpecVersion["Arazzo1"] = "arazzo1";
|
|
23
23
|
})(SpecVersion || (exports.SpecVersion = SpecVersion = {}));
|
|
24
24
|
var SpecMajorVersion;
|
|
25
25
|
(function (SpecMajorVersion) {
|
|
@@ -27,7 +27,7 @@ var SpecMajorVersion;
|
|
|
27
27
|
SpecMajorVersion["OAS3"] = "oas3";
|
|
28
28
|
SpecMajorVersion["Async2"] = "async2";
|
|
29
29
|
SpecMajorVersion["Async3"] = "async3";
|
|
30
|
-
SpecMajorVersion["
|
|
30
|
+
SpecMajorVersion["Arazzo1"] = "arazzo1";
|
|
31
31
|
})(SpecMajorVersion || (exports.SpecMajorVersion = SpecMajorVersion = {}));
|
|
32
32
|
const typesMap = {
|
|
33
33
|
[SpecVersion.OAS2]: oas2_1.Oas2Types,
|
|
@@ -35,7 +35,7 @@ const typesMap = {
|
|
|
35
35
|
[SpecVersion.OAS3_1]: oas3_1_1.Oas3_1Types,
|
|
36
36
|
[SpecVersion.Async2]: asyncapi2_1.AsyncApi2Types,
|
|
37
37
|
[SpecVersion.Async3]: asyncapi3_1.AsyncApi3Types,
|
|
38
|
-
[SpecVersion.
|
|
38
|
+
[SpecVersion.Arazzo1]: arazzo_1.Arazzo1Types,
|
|
39
39
|
};
|
|
40
40
|
function detectSpec(root) {
|
|
41
41
|
if (!(0, utils_1.isPlainObject)(root)) {
|
|
@@ -66,7 +66,7 @@ function detectSpec(root) {
|
|
|
66
66
|
throw new Error(`Unsupported AsyncAPI version: ${root.asyncapi}`);
|
|
67
67
|
}
|
|
68
68
|
if (typeof root.arazzo === 'string' && arazzo_2.VERSION_PATTERN.test(root.arazzo)) {
|
|
69
|
-
return SpecVersion.
|
|
69
|
+
return SpecVersion.Arazzo1;
|
|
70
70
|
}
|
|
71
71
|
throw new Error(`Unsupported specification`);
|
|
72
72
|
}
|
|
@@ -80,8 +80,8 @@ function getMajorSpecVersion(version) {
|
|
|
80
80
|
else if (version === SpecVersion.Async3) {
|
|
81
81
|
return SpecMajorVersion.Async3;
|
|
82
82
|
}
|
|
83
|
-
else if (version === SpecVersion.
|
|
84
|
-
return SpecMajorVersion.
|
|
83
|
+
else if (version === SpecVersion.Arazzo1) {
|
|
84
|
+
return SpecMajorVersion.Arazzo1;
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
87
|
return SpecMajorVersion.OAS3;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const CriteriaUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const CriteriaUnique: Arazzo1Rule;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const rules:
|
|
1
|
+
import type { Arazzo1RuleSet } from '../../oas-types';
|
|
2
|
+
export declare const rules: Arazzo1RuleSet<'built-in'>;
|
|
3
3
|
export declare const preprocessors: {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preprocessors = exports.rules = void 0;
|
|
4
|
-
const
|
|
4
|
+
const struct_1 = require("../common/struct");
|
|
5
5
|
const assertions_1 = require("../common/assertions");
|
|
6
6
|
const parameters_not_in_body_1 = require("../spot/parameters-not-in-body");
|
|
7
|
-
const
|
|
7
|
+
const sourceDescription_type_1 = require("../arazzo/sourceDescription-type");
|
|
8
|
+
const sourceDescriptions_not_empty_1 = require("./sourceDescriptions-not-empty");
|
|
8
9
|
const version_enum_1 = require("../spot/version-enum");
|
|
9
10
|
const workflowId_unique_1 = require("./workflowId-unique");
|
|
10
11
|
const stepId_unique_1 = require("./stepId-unique");
|
|
@@ -18,14 +19,15 @@ const no_criteria_xpath_1 = require("../spot/no-criteria-xpath");
|
|
|
18
19
|
const no_actions_type_end_1 = require("../spot/no-actions-type-end");
|
|
19
20
|
const criteria_unique_1 = require("./criteria-unique");
|
|
20
21
|
exports.rules = {
|
|
21
|
-
|
|
22
|
+
struct: struct_1.Struct,
|
|
22
23
|
assertions: assertions_1.Assertions,
|
|
23
24
|
'parameters-not-in-body': parameters_not_in_body_1.ParametersNotInBody,
|
|
24
|
-
'sourceDescription-type':
|
|
25
|
+
'sourceDescription-type': sourceDescription_type_1.SourceDescriptionType,
|
|
25
26
|
'version-enum': version_enum_1.VersionEnum,
|
|
26
27
|
'workflowId-unique': workflowId_unique_1.WorkflowIdUnique,
|
|
27
28
|
'stepId-unique': stepId_unique_1.StepIdUnique,
|
|
28
29
|
'sourceDescription-name-unique': sourceDescriptions_name_unique_1.SourceDescriptionsNameUnique,
|
|
30
|
+
'sourceDescriptions-not-empty': sourceDescriptions_not_empty_1.SourceDescriptionsNotEmpty,
|
|
29
31
|
'workflow-dependsOn': workflow_dependsOn_1.WorkflowDependsOn,
|
|
30
32
|
'parameters-unique': parameters_unique_1.ParametersUnique,
|
|
31
33
|
'step-onSuccess-unique': step_onSuccess_unique_1.StepOnSuccessUnique,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const ParametersUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const ParametersUnique: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const RequestBodyReplacementsUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const RequestBodyReplacementsUnique: Arazzo1Rule;
|
|
@@ -4,12 +4,14 @@ exports.SourceDescriptionType = void 0;
|
|
|
4
4
|
const SourceDescriptionType = () => {
|
|
5
5
|
return {
|
|
6
6
|
SourceDescriptions: {
|
|
7
|
-
enter(
|
|
8
|
-
|
|
7
|
+
enter(sourceDescriptions, { report, location }) {
|
|
8
|
+
if (!sourceDescriptions.length)
|
|
9
|
+
return;
|
|
10
|
+
for (const sourceDescription of sourceDescriptions) {
|
|
9
11
|
if (!['openapi', 'arazzo'].includes(sourceDescription?.type)) {
|
|
10
12
|
report({
|
|
11
13
|
message: 'The `type` property of the `sourceDescription` object must be either `openapi` or `arazzo`.',
|
|
12
|
-
location: location.child([
|
|
14
|
+
location: location.child([sourceDescriptions.indexOf(sourceDescription)]),
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const SourceDescriptionsNameUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const SourceDescriptionsNameUnique: Arazzo1Rule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceDescriptionsNotEmpty = void 0;
|
|
4
|
+
const SourceDescriptionsNotEmpty = () => {
|
|
5
|
+
return {
|
|
6
|
+
SourceDescriptions: {
|
|
7
|
+
enter(sourceDescriptions, { report, location }) {
|
|
8
|
+
if (!sourceDescriptions?.length) {
|
|
9
|
+
report({
|
|
10
|
+
message: 'The `sourceDescriptions` list must have at least one entry.',
|
|
11
|
+
location,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.SourceDescriptionsNotEmpty = SourceDescriptionsNotEmpty;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const StepOnFailureUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const StepOnFailureUnique: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const StepOnSuccessUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const StepOnSuccessUnique: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const StepIdUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const StepIdUnique: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const WorkflowDependsOn:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const WorkflowDependsOn: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const WorkflowIdUnique:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const WorkflowIdUnique: Arazzo1Rule;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preprocessors = exports.rules = void 0;
|
|
4
4
|
const assertions_1 = require("../common/assertions");
|
|
5
|
-
const
|
|
5
|
+
const struct_1 = require("../common/struct");
|
|
6
6
|
const info_contact_1 = require("../common/info-contact");
|
|
7
7
|
const info_license_strict_1 = require("../common/info-license-strict");
|
|
8
8
|
const operation_operationId_1 = require("../common/operation-operationId");
|
|
@@ -11,7 +11,10 @@ const tags_alphabetical_1 = require("../common/tags-alphabetical");
|
|
|
11
11
|
const channels_kebab_case_1 = require("./channels-kebab-case");
|
|
12
12
|
const no_channel_trailing_slash_1 = require("./no-channel-trailing-slash");
|
|
13
13
|
exports.rules = {
|
|
14
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
//@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
|
|
16
|
+
spec: struct_1.Struct,
|
|
17
|
+
struct: struct_1.Struct,
|
|
15
18
|
assertions: assertions_1.Assertions,
|
|
16
19
|
'info-contact': info_contact_1.InfoContact,
|
|
17
20
|
'info-license-strict': info_license_strict_1.InfoLicenseStrict,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preprocessors = exports.rules = void 0;
|
|
4
4
|
const assertions_1 = require("../common/assertions");
|
|
5
|
-
const
|
|
5
|
+
const struct_1 = require("../common/struct");
|
|
6
6
|
const info_contact_1 = require("../common/info-contact");
|
|
7
7
|
const info_license_strict_1 = require("../common/info-license-strict");
|
|
8
8
|
const operation_operationId_1 = require("../common/operation-operationId");
|
|
@@ -11,7 +11,10 @@ const tags_alphabetical_1 = require("../common/tags-alphabetical");
|
|
|
11
11
|
const channels_kebab_case_1 = require("./channels-kebab-case");
|
|
12
12
|
const no_channel_trailing_slash_1 = require("./no-channel-trailing-slash");
|
|
13
13
|
exports.rules = {
|
|
14
|
-
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
//@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
|
|
16
|
+
spec: struct_1.Struct,
|
|
17
|
+
struct: struct_1.Struct,
|
|
15
18
|
assertions: assertions_1.Assertions,
|
|
16
19
|
'info-contact': info_contact_1.InfoContact,
|
|
17
20
|
'info-license-strict': info_license_strict_1.InfoLicenseStrict,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { asserts, AssertionFn } from './asserts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Arazzo1Visitor, Async2Visitor, Async3Visitor, Oas2Visitor, Oas3Visitor } from '../../../visitors';
|
|
3
3
|
import type { RuleSeverity } from '../../../config';
|
|
4
4
|
export type AssertionLocators = {
|
|
5
5
|
filterInParentKeys?: (string | number)[];
|
|
@@ -24,4 +24,4 @@ export type RawAssertion = AssertionDefinition & {
|
|
|
24
24
|
export type Assertion = RawAssertion & {
|
|
25
25
|
assertionId: string;
|
|
26
26
|
};
|
|
27
|
-
export declare const Assertions: (opts: Record<string, Assertion>) => (Oas3Visitor | Oas2Visitor | Async2Visitor | Async3Visitor |
|
|
27
|
+
export declare const Assertions: (opts: Record<string, Assertion>) => (Oas3Visitor | Oas2Visitor | Async2Visitor | Async3Visitor | Arazzo1Visitor)[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Struct = void 0;
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
6
|
const ref_utils_1 = require("../../ref-utils");
|
|
7
7
|
const utils_2 = require("../../utils");
|
|
8
|
-
const
|
|
8
|
+
const Struct = () => {
|
|
9
9
|
return {
|
|
10
10
|
any(node, { report, type, location, rawLocation, key, resolve, ignoreNextVisitorsOnNode }) {
|
|
11
11
|
const nodeType = (0, utils_1.oasTypeOf)(node);
|
|
@@ -155,4 +155,4 @@ const Spec = () => {
|
|
|
155
155
|
},
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
|
-
exports.
|
|
158
|
+
exports.Struct = Struct;
|
package/lib/rules/oas2/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preprocessors = exports.rules = void 0;
|
|
4
|
-
const
|
|
4
|
+
const struct_1 = require("../common/struct");
|
|
5
5
|
const no_invalid_schema_examples_1 = require("../common/no-invalid-schema-examples");
|
|
6
6
|
const no_invalid_parameter_examples_1 = require("../common/no-invalid-parameter-examples");
|
|
7
7
|
const info_contact_1 = require("../common/info-contact");
|
|
@@ -46,7 +46,10 @@ const required_string_property_missing_min_length_1 = require("../common/require
|
|
|
46
46
|
const spec_strict_refs_1 = require("../common/spec-strict-refs");
|
|
47
47
|
const no_required_schema_properties_undefined_1 = require("../common/no-required-schema-properties-undefined");
|
|
48
48
|
exports.rules = {
|
|
49
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
50
|
+
//@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
|
|
51
|
+
spec: struct_1.Struct,
|
|
52
|
+
struct: struct_1.Struct,
|
|
50
53
|
'no-invalid-schema-examples': no_invalid_schema_examples_1.NoInvalidSchemaExamples,
|
|
51
54
|
'no-invalid-parameter-examples': no_invalid_parameter_examples_1.NoInvalidParameterExamples,
|
|
52
55
|
'info-contact': info_contact_1.InfoContact,
|
package/lib/rules/oas3/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preprocessors = exports.rules = void 0;
|
|
4
|
-
const
|
|
4
|
+
const struct_1 = require("../common/struct");
|
|
5
5
|
const operation_2xx_response_1 = require("../common/operation-2xx-response");
|
|
6
6
|
const operation_4xx_response_1 = require("../common/operation-4xx-response");
|
|
7
7
|
const assertions_1 = require("../common/assertions");
|
|
@@ -58,7 +58,10 @@ const component_name_unique_1 = require("./component-name-unique");
|
|
|
58
58
|
const array_parameter_serialization_1 = require("./array-parameter-serialization");
|
|
59
59
|
const no_required_schema_properties_undefined_1 = require("../common/no-required-schema-properties-undefined");
|
|
60
60
|
exports.rules = {
|
|
61
|
-
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
62
|
+
//@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
|
|
63
|
+
spec: struct_1.Struct,
|
|
64
|
+
struct: struct_1.Struct,
|
|
62
65
|
'info-contact': info_contact_1.InfoContact,
|
|
63
66
|
'info-license': info_license_1.InfoLicense,
|
|
64
67
|
'info-license-url': info_license_url_1.InfoLicenseUrl,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const NoActionsTypeEnd:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const NoActionsTypeEnd: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const NoCriteriaXpath:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const NoCriteriaXpath: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const ParametersNotInBody:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const ParametersNotInBody: Arazzo1Rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const VersionEnum:
|
|
1
|
+
import type { Arazzo1Rule } from '../../visitors';
|
|
2
|
+
export declare const VersionEnum: Arazzo1Rule;
|
package/lib/types/arazzo.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type NodeType } from '.';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const Arazzo1Types: Record<string, NodeType>;
|
package/lib/types/arazzo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Arazzo1Types = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const oas3_1_1 = require("./oas3_1");
|
|
6
6
|
const oas3_1 = require("./oas3");
|
|
@@ -53,11 +53,8 @@ const SourceDescriptions = {
|
|
|
53
53
|
if (value?.type === 'openapi') {
|
|
54
54
|
return 'OpenAPISourceDescription';
|
|
55
55
|
}
|
|
56
|
-
else if (value?.type === 'arazzo') {
|
|
57
|
-
return 'ArazzoSourceDescription';
|
|
58
|
-
}
|
|
59
56
|
else {
|
|
60
|
-
return '
|
|
57
|
+
return 'ArazzoSourceDescription';
|
|
61
58
|
}
|
|
62
59
|
},
|
|
63
60
|
};
|
|
@@ -71,15 +68,6 @@ const OpenAPISourceDescription = {
|
|
|
71
68
|
required: ['name', 'type', 'url'],
|
|
72
69
|
extensionsPrefix: 'x-',
|
|
73
70
|
};
|
|
74
|
-
const NoneSourceDescription = {
|
|
75
|
-
properties: {
|
|
76
|
-
name: { type: 'string' },
|
|
77
|
-
type: { type: 'string', enum: ['none'] },
|
|
78
|
-
'x-serverUrl': { type: 'string' },
|
|
79
|
-
},
|
|
80
|
-
required: ['name', 'type', 'x-serverUrl'],
|
|
81
|
-
extensionsPrefix: 'x-',
|
|
82
|
-
};
|
|
83
71
|
const ArazzoSourceDescription = {
|
|
84
72
|
properties: {
|
|
85
73
|
name: { type: 'string' },
|
|
@@ -147,7 +135,6 @@ const Step = {
|
|
|
147
135
|
onSuccess: 'OnSuccessActionList',
|
|
148
136
|
onFailure: 'OnFailureActionList',
|
|
149
137
|
outputs: 'Outputs',
|
|
150
|
-
'x-expect': 'ExpectSchema',
|
|
151
138
|
'x-operation': 'ExtendedOperation',
|
|
152
139
|
requestBody: 'RequestBody',
|
|
153
140
|
},
|
|
@@ -206,15 +193,6 @@ const ExtendedOperation = {
|
|
|
206
193
|
},
|
|
207
194
|
required: ['url', 'method'],
|
|
208
195
|
};
|
|
209
|
-
const ExpectSchema = {
|
|
210
|
-
properties: {
|
|
211
|
-
statusCode: { type: 'number' },
|
|
212
|
-
mimeType: { type: 'string' },
|
|
213
|
-
body: {},
|
|
214
|
-
schema: 'Schema',
|
|
215
|
-
},
|
|
216
|
-
requiredOneOf: ['statusCode', 'mimeType', 'body', 'schema'],
|
|
217
|
-
};
|
|
218
196
|
const CriterionObject = {
|
|
219
197
|
properties: {
|
|
220
198
|
condition: { type: 'string' },
|
|
@@ -292,12 +270,11 @@ const OnFailureActionList = {
|
|
|
292
270
|
}
|
|
293
271
|
},
|
|
294
272
|
};
|
|
295
|
-
exports.
|
|
273
|
+
exports.Arazzo1Types = {
|
|
296
274
|
Root,
|
|
297
275
|
Info,
|
|
298
276
|
SourceDescriptions,
|
|
299
277
|
OpenAPISourceDescription,
|
|
300
|
-
NoneSourceDescription,
|
|
301
278
|
ArazzoSourceDescription,
|
|
302
279
|
Parameters,
|
|
303
280
|
Parameter,
|
|
@@ -309,7 +286,6 @@ exports.ArazzoTypes = {
|
|
|
309
286
|
RequestBody,
|
|
310
287
|
Replacement,
|
|
311
288
|
ExtendedOperation,
|
|
312
|
-
ExpectSchema,
|
|
313
289
|
Outputs,
|
|
314
290
|
CriterionObject,
|
|
315
291
|
XPathCriterion,
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import type { JSONSchema } from 'json-schema-to-ts';
|
|
2
2
|
import type { NodeType } from '.';
|
|
3
3
|
import type { Config } from '../config';
|
|
4
|
-
declare const
|
|
5
|
-
export type BuiltInCommonOASRuleId = typeof builtInCommonOASRules[number];
|
|
6
|
-
declare const builtInOAS2Rules: readonly ["boolean-parameter-prefixes", "request-mime-type", "response-contains-property", "response-mime-type"];
|
|
4
|
+
declare const builtInOAS2Rules: readonly ["info-contact", "operation-operationId", "tag-description", "tags-alphabetical", "info-license-url", "info-license-strict", "info-license", "no-ambiguous-paths", "no-enum-type-mismatch", "no-http-verbs-in-paths", "no-identical-paths", "no-invalid-parameter-examples", "no-invalid-schema-examples", "no-path-trailing-slash", "operation-2xx-response", "operation-4xx-response", "operation-description", "operation-operationId-unique", "operation-operationId-url-safe", "operation-parameters-unique", "operation-singular-tag", "operation-summary", "operation-tag-defined", "parameter-description", "path-declaration-must-exist", "path-excludes-patterns", "path-http-verbs-order", "path-not-include-query", "path-params-defined", "path-parameters-defined", "path-segment-plural", "paths-kebab-case", "required-string-property-missing-min-length", "response-contains-header", "scalar-property-missing-example", "security-defined", "spec-strict-refs", "no-unresolved-refs", "no-required-schema-properties-undefined", "boolean-parameter-prefixes", "request-mime-type", "response-contains-property", "response-mime-type"];
|
|
7
5
|
export type BuiltInOAS2RuleId = typeof builtInOAS2Rules[number];
|
|
8
|
-
declare const builtInOAS3Rules: readonly ["boolean-parameter-prefixes", "component-name-unique", "no-empty-servers", "no-example-value-and-externalValue", "no-invalid-media-type-examples", "no-server-example.com", "no-server-trailing-slash", "no-server-variables-empty-enum", "no-undefined-server-variable", "no-unused-components", "operation-4xx-problem-details-rfc7807", "request-mime-type", "response-contains-property", "response-mime-type", "spec-components-invalid-map-name", "array-parameter-serialization"];
|
|
6
|
+
declare const builtInOAS3Rules: readonly ["info-contact", "operation-operationId", "tag-description", "tags-alphabetical", "info-license-url", "info-license-strict", "info-license", "no-ambiguous-paths", "no-enum-type-mismatch", "no-http-verbs-in-paths", "no-identical-paths", "no-invalid-parameter-examples", "no-invalid-schema-examples", "no-path-trailing-slash", "operation-2xx-response", "operation-4xx-response", "operation-description", "operation-operationId-unique", "operation-operationId-url-safe", "operation-parameters-unique", "operation-singular-tag", "operation-summary", "operation-tag-defined", "parameter-description", "path-declaration-must-exist", "path-excludes-patterns", "path-http-verbs-order", "path-not-include-query", "path-params-defined", "path-parameters-defined", "path-segment-plural", "paths-kebab-case", "required-string-property-missing-min-length", "response-contains-header", "scalar-property-missing-example", "security-defined", "spec-strict-refs", "no-unresolved-refs", "no-required-schema-properties-undefined", "boolean-parameter-prefixes", "component-name-unique", "no-empty-servers", "no-example-value-and-externalValue", "no-invalid-media-type-examples", "no-server-example.com", "no-server-trailing-slash", "no-server-variables-empty-enum", "no-undefined-server-variable", "no-unused-components", "operation-4xx-problem-details-rfc7807", "request-mime-type", "response-contains-property", "response-mime-type", "spec-components-invalid-map-name", "array-parameter-serialization"];
|
|
9
7
|
export type BuiltInOAS3RuleId = typeof builtInOAS3Rules[number];
|
|
10
|
-
declare const builtInAsync2Rules: readonly ["
|
|
11
|
-
declare const builtInAsync3Rules: readonly ["
|
|
8
|
+
declare const builtInAsync2Rules: readonly ["info-contact", "info-license-strict", "operation-operationId", "tag-description", "tags-alphabetical", "channels-kebab-case", "no-channel-trailing-slash"];
|
|
9
|
+
declare const builtInAsync3Rules: readonly ["info-contact", "info-license-strict", "operation-operationId", "tag-description", "tags-alphabetical", "channels-kebab-case", "no-channel-trailing-slash"];
|
|
12
10
|
export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
|
|
13
11
|
export type BuiltInAsync3RuleId = typeof builtInAsync3Rules[number];
|
|
14
|
-
declare const
|
|
15
|
-
export type
|
|
12
|
+
declare const builtInArazzo1Rules: readonly ["parameters-not-in-body", "sourceDescription-type", "version-enum", "workflowId-unique", "stepId-unique", "sourceDescription-name-unique", "sourceDescriptions-not-empty", "workflow-dependsOn", "parameters-unique", "step-onSuccess-unique", "step-onFailure-unique", "requestBody-replacements-unique", "no-criteria-xpath", "no-actions-type-end", "criteria-unique"];
|
|
13
|
+
export type BuiltInArazzo1RuleId = typeof builtInArazzo1Rules[number];
|
|
16
14
|
declare const oas2NodeTypesList: readonly ["Root", "Tag", "TagList", "ExternalDocs", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Paths", "PathItem", "Parameter", "ParameterList", "ParameterItems", "Operation", "Example", "ExamplesMap", "Examples", "Header", "Responses", "Response", "Schema", "Xml", "SchemaProperties", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedSecuritySchemes", "SecurityScheme", "TagGroup", "TagGroups", "EnumDescriptions", "Logo", "XCodeSample", "XCodeSampleList", "XServer", "XServerList"];
|
|
17
15
|
export type Oas2NodeType = typeof oas2NodeTypesList[number];
|
|
18
16
|
declare const oas3NodeTypesList: readonly ["Root", "Tag", "TagList", "ExternalDocs", "Server", "ServerList", "ServerVariable", "ServerVariablesMap", "SecurityRequirement", "SecurityRequirementList", "Info", "Contact", "License", "Paths", "PathItem", "Parameter", "ParameterList", "Operation", "Callback", "CallbacksMap", "RequestBody", "MediaTypesMap", "MediaType", "Example", "ExamplesMap", "Encoding", "EncodingMap", "Header", "HeadersMap", "Responses", "Response", "Link", "LinksMap", "Schema", "Xml", "SchemaProperties", "DiscriminatorMapping", "Discriminator", "Components", "NamedSchemas", "NamedResponses", "NamedParameters", "NamedExamples", "NamedRequestBodies", "NamedHeaders", "NamedSecuritySchemes", "NamedLinks", "NamedCallbacks", "ImplicitFlow", "PasswordFlow", "ClientCredentials", "AuthorizationCode", "OAuth2Flows", "SecurityScheme", "TagGroup", "TagGroups", "EnumDescriptions", "Logo", "XCodeSample", "XCodeSampleList", "XUsePkce", "WebhooksMap"];
|