@redocly/openapi-core 1.17.1 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +16 -2
- package/lib/config/all.js +6 -0
- package/lib/config/builtIn.js +10 -2
- package/lib/config/config-resolvers.js +15 -4
- package/lib/config/config.d.ts +2 -2
- package/lib/config/config.js +15 -0
- package/lib/config/load.d.ts +1 -2
- package/lib/config/minimal.js +8 -0
- package/lib/config/recommended-strict.js +8 -0
- package/lib/config/recommended.js +8 -0
- package/lib/config/types.d.ts +10 -4
- package/lib/config/utils.js +13 -1
- 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/index.d.ts +1 -0
- package/lib/index.js +4 -2
- package/lib/oas-types.d.ts +13 -8
- package/lib/oas-types.js +10 -0
- package/lib/rules/arazzo/index.d.ts +3 -0
- package/lib/rules/arazzo/index.js +10 -0
- package/lib/rules/common/path-segment-plural.js +2 -1
- package/lib/rules/common/spec.d.ts +2 -2
- package/lib/types/arazzo.d.ts +2276 -0
- package/lib/types/arazzo.js +386 -0
- package/lib/types/asyncapi.js +17 -43
- package/lib/types/oas3.js +0 -8
- package/lib/types/oas3_1.js +2 -2
- package/lib/types/redocly-yaml.d.ts +4 -4
- package/lib/types/redocly-yaml.js +15 -5
- package/lib/typings/arazzo.d.ts +30 -0
- package/lib/typings/arazzo.js +2 -0
- package/lib/utils.d.ts +8 -4
- package/lib/utils.js +38 -7
- package/lib/visitors.d.ts +11 -0
- package/package.json +3 -2
- package/src/__tests__/lint.test.ts +0 -50
- package/src/bundle.ts +15 -3
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +20 -0
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +3 -0
- package/src/config/__tests__/config.test.ts +6 -0
- package/src/config/all.ts +6 -0
- package/src/config/builtIn.ts +10 -2
- package/src/config/config-resolvers.ts +17 -3
- package/src/config/config.ts +17 -0
- package/src/config/load.ts +1 -2
- package/src/config/minimal.ts +8 -0
- package/src/config/recommended-strict.ts +8 -0
- package/src/config/recommended.ts +8 -0
- package/src/config/types.ts +15 -2
- package/src/config/utils.ts +15 -0
- package/src/decorators/arazzo/index.ts +1 -0
- package/src/decorators/async2/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/oas-types.ts +25 -4
- package/src/rules/arazzo/index.ts +11 -0
- package/src/rules/common/__tests__/spec.test.ts +47 -0
- package/src/rules/common/no-invalid-schema-examples.ts +3 -2
- package/src/rules/common/path-segment-plural.ts +3 -2
- package/src/rules/common/spec.ts +2 -2
- package/src/types/arazzo.ts +391 -0
- package/src/types/asyncapi.ts +22 -43
- package/src/types/oas3.ts +0 -7
- package/src/types/oas3_1.ts +2 -2
- package/src/types/redocly-yaml.ts +18 -8
- package/src/typings/arazzo.ts +44 -0
- package/src/utils.ts +41 -8
- package/src/visitors.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
package/lib/oas-types.js
CHANGED
|
@@ -5,24 +5,28 @@ const oas2_1 = require("./types/oas2");
|
|
|
5
5
|
const oas3_1 = require("./types/oas3");
|
|
6
6
|
const oas3_1_1 = require("./types/oas3_1");
|
|
7
7
|
const asyncapi_1 = require("./types/asyncapi");
|
|
8
|
+
const arazzo_1 = require("./types/arazzo");
|
|
8
9
|
var SpecVersion;
|
|
9
10
|
(function (SpecVersion) {
|
|
10
11
|
SpecVersion["OAS2"] = "oas2";
|
|
11
12
|
SpecVersion["OAS3_0"] = "oas3_0";
|
|
12
13
|
SpecVersion["OAS3_1"] = "oas3_1";
|
|
13
14
|
SpecVersion["Async2"] = "async2";
|
|
15
|
+
SpecVersion["Arazzo"] = "arazzo";
|
|
14
16
|
})(SpecVersion || (exports.SpecVersion = SpecVersion = {}));
|
|
15
17
|
var SpecMajorVersion;
|
|
16
18
|
(function (SpecMajorVersion) {
|
|
17
19
|
SpecMajorVersion["OAS2"] = "oas2";
|
|
18
20
|
SpecMajorVersion["OAS3"] = "oas3";
|
|
19
21
|
SpecMajorVersion["Async2"] = "async2";
|
|
22
|
+
SpecMajorVersion["Arazzo"] = "arazzo";
|
|
20
23
|
})(SpecMajorVersion || (exports.SpecMajorVersion = SpecMajorVersion = {}));
|
|
21
24
|
const typesMap = {
|
|
22
25
|
[SpecVersion.OAS2]: oas2_1.Oas2Types,
|
|
23
26
|
[SpecVersion.OAS3_0]: oas3_1.Oas3Types,
|
|
24
27
|
[SpecVersion.OAS3_1]: oas3_1_1.Oas3_1Types,
|
|
25
28
|
[SpecVersion.Async2]: asyncapi_1.AsyncApi2Types,
|
|
29
|
+
[SpecVersion.Arazzo]: arazzo_1.ArazzoTypes,
|
|
26
30
|
};
|
|
27
31
|
function detectSpec(root) {
|
|
28
32
|
if (typeof root !== 'object') {
|
|
@@ -50,6 +54,9 @@ function detectSpec(root) {
|
|
|
50
54
|
if (root.asyncapi) {
|
|
51
55
|
throw new Error(`Unsupported AsyncAPI version: ${root.asyncapi}`);
|
|
52
56
|
}
|
|
57
|
+
if (root.arazzo && root.arazzo.startsWith('1.')) {
|
|
58
|
+
return SpecVersion.Arazzo;
|
|
59
|
+
}
|
|
53
60
|
throw new Error(`Unsupported specification`);
|
|
54
61
|
}
|
|
55
62
|
exports.detectSpec = detectSpec;
|
|
@@ -60,6 +67,9 @@ function getMajorSpecVersion(version) {
|
|
|
60
67
|
else if (version === SpecVersion.Async2) {
|
|
61
68
|
return SpecMajorVersion.Async2;
|
|
62
69
|
}
|
|
70
|
+
else if (version === SpecVersion.Arazzo) {
|
|
71
|
+
return SpecMajorVersion.Arazzo;
|
|
72
|
+
}
|
|
63
73
|
else {
|
|
64
74
|
return SpecMajorVersion.OAS3;
|
|
65
75
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.preprocessors = exports.rules = void 0;
|
|
4
|
+
const spec_1 = require("../common/spec");
|
|
5
|
+
const assertions_1 = require("../common/assertions");
|
|
6
|
+
exports.rules = {
|
|
7
|
+
spec: spec_1.Spec,
|
|
8
|
+
assertions: assertions_1.Assertions,
|
|
9
|
+
};
|
|
10
|
+
exports.preprocessors = {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PathSegmentPlural = void 0;
|
|
4
|
+
const pluralize = require("pluralize");
|
|
4
5
|
const utils_1 = require("../../utils");
|
|
5
6
|
const PathSegmentPlural = (opts) => {
|
|
6
7
|
const { ignoreLastPathSegment, exceptions } = opts;
|
|
@@ -17,7 +18,7 @@ const PathSegmentPlural = (opts) => {
|
|
|
17
18
|
for (const pathSegment of pathSegments) {
|
|
18
19
|
if (exceptions && exceptions.includes(pathSegment))
|
|
19
20
|
continue;
|
|
20
|
-
if (!(0, utils_1.isPathParameter)(pathSegment) &&
|
|
21
|
+
if (!(0, utils_1.isPathParameter)(pathSegment) && pluralize.isSingular(pathSegment)) {
|
|
21
22
|
report({
|
|
22
23
|
message: `path segment \`${pathSegment}\` should be plural.`,
|
|
23
24
|
location: location.key(),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Oas3Rule, Oas2Rule, Async2Rule } from '../../visitors';
|
|
2
|
-
export declare const Spec: Oas3Rule | Oas2Rule | Async2Rule;
|
|
1
|
+
import type { Oas3Rule, Oas2Rule, Async2Rule, ArazzoRule } from '../../visitors';
|
|
2
|
+
export declare const Spec: Oas3Rule | Oas2Rule | Async2Rule | ArazzoRule;
|