@redocly/openapi-core 1.0.0-beta.117 → 1.0.0-beta.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle.d.ts +1 -1
- package/lib/config/config-resolvers.js +13 -8
- package/lib/decorators/common/media-type-examples-override.d.ts +2 -0
- package/lib/decorators/common/media-type-examples-override.js +53 -0
- package/lib/decorators/oas3/index.d.ts +1 -0
- package/lib/decorators/oas3/index.js +2 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -1
- package/lib/resolve.js +3 -0
- package/lib/rules/common/assertions/asserts.js +10 -2
- package/lib/rules/common/assertions/utils.js +12 -6
- package/lib/rules/common/spec.js +7 -4
- package/lib/rules/oas3/spec-components-invalid-map-name.js +26 -5
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +7 -1
- package/lib/types/oas2.js +16 -0
- package/lib/types/oas3.js +28 -0
- package/lib/types/oas3_1.js +6 -0
- package/lib/types/redocly-yaml.js +1 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +6 -1
- package/lib/visitors.d.ts +3 -1
- package/lib/visitors.js +4 -0
- package/lib/walk.js +8 -0
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/bundle.test.ts.snap +10 -0
- package/src/config/config-resolvers.ts +12 -8
- package/src/decorators/__tests__/media-type-examples-override.test.ts +665 -0
- package/src/decorators/__tests__/resources/request.yaml +3 -0
- package/src/decorators/__tests__/resources/response.yaml +3 -0
- package/src/decorators/common/media-type-examples-override.ts +79 -0
- package/src/decorators/oas3/index.ts +2 -0
- package/src/index.ts +2 -1
- package/src/resolve.ts +4 -1
- package/src/rules/common/assertions/__tests__/asserts.test.ts +89 -19
- package/src/rules/common/assertions/asserts.ts +10 -1
- package/src/rules/common/assertions/utils.ts +15 -6
- package/src/rules/common/spec.ts +8 -5
- package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +88 -0
- package/src/rules/oas3/spec-components-invalid-map-name.ts +26 -5
- package/src/types/index.ts +9 -0
- package/src/types/oas2.ts +16 -0
- package/src/types/oas3.ts +28 -0
- package/src/types/oas3_1.ts +6 -0
- package/src/types/redocly-yaml.ts +1 -0
- package/src/utils.ts +5 -0
- package/src/visitors.ts +7 -1
- package/src/walk.ts +15 -1
- package/tsconfig.tsbuildinfo +1 -1
package/lib/bundle.d.ts
CHANGED
|
@@ -44,4 +44,4 @@ export declare function bundleDocument(opts: {
|
|
|
44
44
|
refTypes: Map<string, NormalizedNodeType> | undefined;
|
|
45
45
|
visitorsData: Record<string, Record<string, unknown>>;
|
|
46
46
|
}>;
|
|
47
|
-
export declare function mapTypeToComponent(typeName: string, version: OasMajorVersion): "headers" | "definitions" | "parameters" | "examples" | "
|
|
47
|
+
export declare function mapTypeToComponent(typeName: string, version: OasMajorVersion): "headers" | "definitions" | "parameters" | "examples" | "schemas" | "responses" | "requestBodies" | "securitySchemes" | "links" | "callbacks" | null;
|
|
@@ -64,14 +64,19 @@ function resolvePlugins(plugins, configPath = '') {
|
|
|
64
64
|
return undefined;
|
|
65
65
|
}
|
|
66
66
|
if (utils_3.isString(plugin)) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// @ts-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
try {
|
|
68
|
+
const absoltePluginPath = path.resolve(path.dirname(configPath), plugin);
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
return typeof __webpack_require__ === 'function'
|
|
72
|
+
? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
__non_webpack_require__(absoltePluginPath)
|
|
75
|
+
: require(absoltePluginPath);
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
throw new Error(`Failed to load plugin "${plugin}". Please provide a valid path`);
|
|
79
|
+
}
|
|
75
80
|
}
|
|
76
81
|
return plugin;
|
|
77
82
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaTypeExamplesOverride = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const ref_utils_1 = require("../../ref-utils");
|
|
6
|
+
const MediaTypeExamplesOverride = ({ operationIds }) => {
|
|
7
|
+
return {
|
|
8
|
+
Operation: {
|
|
9
|
+
enter(operation, ctx) {
|
|
10
|
+
const operationId = operation.operationId;
|
|
11
|
+
if (!operationId) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const properties = operationIds[operationId];
|
|
15
|
+
if (!properties) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (properties.responses && operation.responses) {
|
|
19
|
+
for (const responseCode of Object.keys(properties.responses)) {
|
|
20
|
+
const resolvedResponse = checkAndResolveRef(operation.responses[responseCode], ctx.resolve);
|
|
21
|
+
if (!resolvedResponse) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
resolvedResponse.content = resolvedResponse.content ? resolvedResponse.content : {};
|
|
25
|
+
Object.keys(properties.responses[responseCode]).forEach((mimeType) => {
|
|
26
|
+
resolvedResponse.content[mimeType] = Object.assign(Object.assign({}, resolvedResponse.content[mimeType]), { examples: utils_1.yamlAndJsonSyncReader(properties.responses[responseCode][mimeType]) });
|
|
27
|
+
});
|
|
28
|
+
operation.responses[responseCode] = resolvedResponse;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (properties.request && operation.requestBody) {
|
|
32
|
+
const resolvedRequest = checkAndResolveRef(operation.requestBody, ctx.resolve);
|
|
33
|
+
if (!resolvedRequest) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
resolvedRequest.content = resolvedRequest.content ? resolvedRequest.content : {};
|
|
37
|
+
Object.keys(properties.request).forEach((mimeType) => {
|
|
38
|
+
resolvedRequest.content[mimeType] = Object.assign(Object.assign({}, resolvedRequest.content[mimeType]), { examples: utils_1.yamlAndJsonSyncReader(properties.request[mimeType]) });
|
|
39
|
+
});
|
|
40
|
+
operation.requestBody = resolvedRequest;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.MediaTypeExamplesOverride = MediaTypeExamplesOverride;
|
|
47
|
+
function checkAndResolveRef(node, resolver) {
|
|
48
|
+
if (!ref_utils_1.isRef(node)) {
|
|
49
|
+
return node;
|
|
50
|
+
}
|
|
51
|
+
const resolved = resolver(node);
|
|
52
|
+
return resolved.error ? undefined : JSON.parse(JSON.stringify(resolved.node));
|
|
53
|
+
}
|
|
@@ -8,6 +8,7 @@ const info_description_override_1 = require("../common/info-description-override
|
|
|
8
8
|
const remove_x_internal_1 = require("../common/remove-x-internal");
|
|
9
9
|
const filter_in_1 = require("../common/filters/filter-in");
|
|
10
10
|
const filter_out_1 = require("../common/filters/filter-out");
|
|
11
|
+
const media_type_examples_override_1 = require("../common/media-type-examples-override");
|
|
11
12
|
exports.decorators = {
|
|
12
13
|
'registry-dependencies': registry_dependencies_1.RegistryDependencies,
|
|
13
14
|
'operation-description-override': operation_description_override_1.OperationDescriptionOverride,
|
|
@@ -16,4 +17,5 @@ exports.decorators = {
|
|
|
16
17
|
'remove-x-internal': remove_x_internal_1.RemoveXInternal,
|
|
17
18
|
'filter-in': filter_in_1.FilterIn,
|
|
18
19
|
'filter-out': filter_out_1.FilterOut,
|
|
20
|
+
'media-type-examples-override': media_type_examples_override_1.MediaTypeExamplesOverride,
|
|
19
21
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ export type { Oas2Definition } from './typings/swagger';
|
|
|
8
8
|
export type { StatsAccumulator, StatsName } from './typings/common';
|
|
9
9
|
export { normalizeTypes } from './types';
|
|
10
10
|
export { Stats } from './rules/other/stats';
|
|
11
|
-
export { Config, StyleguideConfig, RawConfig, IGNORE_FILE, Region, getMergedConfig, transformConfig, loadConfig, getConfig, findConfig, CONFIG_FILE_NAMES, RuleSeverity, createConfig, } from './config';
|
|
11
|
+
export { Config, StyleguideConfig, RawConfig, IGNORE_FILE, Region, getMergedConfig, transformConfig, loadConfig, getConfig, findConfig, CONFIG_FILE_NAMES, RuleSeverity, createConfig, ResolvedApi, } from './config';
|
|
12
12
|
export { RedoclyClient, isRedoclyRegistryURL } from './redocly';
|
|
13
13
|
export { Source, BaseResolver, Document, resolveDocument, ResolveError, YamlParseError, makeDocumentFromString, } from './resolve';
|
|
14
14
|
export { parseYaml, stringifyYaml } from './js-yaml';
|
|
15
|
-
export { unescapePointer, isRef } from './ref-utils';
|
|
15
|
+
export { unescapePointer, isRef, isAbsoluteUrl } from './ref-utils';
|
|
16
16
|
export { detectOpenAPI, OasMajorVersion, openAPIMajor, OasVersion } from './oas-types';
|
|
17
17
|
export { normalizeVisitors } from './visitors';
|
|
18
18
|
export { WalkContext, walkDocument, NormalizedProblem, ProblemSeverity, LineColLocationObject, LocationObject, Loc, } from './walk';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.bundleDocument = exports.bundle = exports.lintConfig = exports.lintFromString = exports.lintDocument = exports.validate = exports.lint = exports.getTotals = exports.formatProblems = exports.getLineColLocation = exports.getAstNodeByPointer = exports.walkDocument = exports.normalizeVisitors = exports.OasVersion = exports.openAPIMajor = exports.OasMajorVersion = exports.detectOpenAPI = exports.isAbsoluteUrl = exports.isRef = exports.unescapePointer = exports.stringifyYaml = exports.parseYaml = exports.makeDocumentFromString = exports.YamlParseError = exports.ResolveError = exports.resolveDocument = exports.BaseResolver = exports.Source = exports.isRedoclyRegistryURL = exports.RedoclyClient = exports.createConfig = exports.CONFIG_FILE_NAMES = exports.findConfig = exports.getConfig = exports.loadConfig = exports.transformConfig = exports.getMergedConfig = exports.IGNORE_FILE = exports.StyleguideConfig = exports.Config = exports.Stats = exports.normalizeTypes = exports.ConfigTypes = exports.Oas2Types = exports.Oas3Types = exports.Oas3_1Types = exports.isTruthy = exports.doesYamlFileExist = exports.slash = exports.readFileFromUrl = void 0;
|
|
4
|
+
exports.mapTypeToComponent = void 0;
|
|
4
5
|
var utils_1 = require("./utils");
|
|
5
6
|
Object.defineProperty(exports, "readFileFromUrl", { enumerable: true, get: function () { return utils_1.readFileFromUrl; } });
|
|
6
7
|
Object.defineProperty(exports, "slash", { enumerable: true, get: function () { return utils_1.slash; } });
|
|
@@ -45,6 +46,7 @@ Object.defineProperty(exports, "stringifyYaml", { enumerable: true, get: functio
|
|
|
45
46
|
var ref_utils_1 = require("./ref-utils");
|
|
46
47
|
Object.defineProperty(exports, "unescapePointer", { enumerable: true, get: function () { return ref_utils_1.unescapePointer; } });
|
|
47
48
|
Object.defineProperty(exports, "isRef", { enumerable: true, get: function () { return ref_utils_1.isRef; } });
|
|
49
|
+
Object.defineProperty(exports, "isAbsoluteUrl", { enumerable: true, get: function () { return ref_utils_1.isAbsoluteUrl; } });
|
|
48
50
|
var oas_types_1 = require("./oas-types");
|
|
49
51
|
Object.defineProperty(exports, "detectOpenAPI", { enumerable: true, get: function () { return oas_types_1.detectOpenAPI; } });
|
|
50
52
|
Object.defineProperty(exports, "OasMajorVersion", { enumerable: true, get: function () { return oas_types_1.OasMajorVersion; } });
|
package/lib/resolve.js
CHANGED
|
@@ -221,6 +221,9 @@ function resolveDocument(opts) {
|
|
|
221
221
|
propType = propType(propValue, propName);
|
|
222
222
|
if (propType === undefined)
|
|
223
223
|
propType = unknownType;
|
|
224
|
+
if (type.extensionsPrefix && propName.startsWith(type.extensionsPrefix)) {
|
|
225
|
+
propType = types_1.SpecExtension;
|
|
226
|
+
}
|
|
224
227
|
if (!types_1.isNamedType(propType) && (propType === null || propType === void 0 ? void 0 : propType.directResolveAs)) {
|
|
225
228
|
propType = propType.directResolveAs;
|
|
226
229
|
propValue = { $ref: propValue };
|
|
@@ -178,10 +178,18 @@ exports.asserts = {
|
|
|
178
178
|
.filter(utils_1.isTruthy);
|
|
179
179
|
},
|
|
180
180
|
sortOrder: (value, condition, baseLocation) => {
|
|
181
|
-
if (typeof value === 'undefined' || utils_2.isOrdered(value, condition))
|
|
182
|
-
return [];
|
|
183
181
|
const direction = condition.direction || condition;
|
|
184
182
|
const property = condition.property;
|
|
183
|
+
if (Array.isArray(value) && value.length > 0 && typeof value[0] === 'object' && !property) {
|
|
184
|
+
return [
|
|
185
|
+
{
|
|
186
|
+
message: `Please define a property to sort objects by`,
|
|
187
|
+
location: baseLocation,
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
if (typeof value === 'undefined' || utils_2.isOrdered(value, condition))
|
|
192
|
+
return [];
|
|
185
193
|
return [
|
|
186
194
|
{
|
|
187
195
|
message: `Should be sorted in ${direction === 'asc' ? 'an ascending' : 'a descending'} order${property ? ` by property ${property}` : ''}`,
|
|
@@ -62,10 +62,10 @@ function applyAssertions(assertionDefinition, asserts, { rawLocation, rawNode, r
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
65
|
-
const value =
|
|
65
|
+
const value = Array.isArray(node) ? node : Object.keys(node);
|
|
66
66
|
assertResults.push(runAssertion({
|
|
67
|
-
values:
|
|
68
|
-
rawValues:
|
|
67
|
+
values: value,
|
|
68
|
+
rawValues: rawNode,
|
|
69
69
|
assert,
|
|
70
70
|
location: currentLocation,
|
|
71
71
|
}));
|
|
@@ -187,11 +187,17 @@ function isOrdered(value, options) {
|
|
|
187
187
|
let currValue = value[i];
|
|
188
188
|
let prevVal = value[i - 1];
|
|
189
189
|
if (property) {
|
|
190
|
-
|
|
190
|
+
const currPropValue = value[i][property];
|
|
191
|
+
const prevPropValue = value[i - 1][property];
|
|
192
|
+
if (!currPropValue || !prevPropValue) {
|
|
191
193
|
return false; // property doesn't exist, so collection is not ordered
|
|
192
194
|
}
|
|
193
|
-
currValue =
|
|
194
|
-
prevVal =
|
|
195
|
+
currValue = currPropValue;
|
|
196
|
+
prevVal = prevPropValue;
|
|
197
|
+
}
|
|
198
|
+
if (typeof currValue === 'string' && typeof prevVal === 'string') {
|
|
199
|
+
currValue = currValue.toLowerCase();
|
|
200
|
+
prevVal = prevVal.toLowerCase();
|
|
195
201
|
}
|
|
196
202
|
const result = direction === 'asc' ? currValue >= prevVal : currValue <= prevVal;
|
|
197
203
|
if (!result) {
|
package/lib/rules/common/spec.js
CHANGED
|
@@ -22,10 +22,13 @@ const OasSpec = () => {
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
else if (nodeType !== 'object') {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (type !== types_1.SpecExtension) {
|
|
26
|
+
// do not validate unknown extensions structure
|
|
27
|
+
report({
|
|
28
|
+
message: `Expected type \`${type.name}\` (object) but got \`${nodeType}\``,
|
|
29
|
+
from: refLocation,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
29
32
|
ignoreNextVisitorsOnNode();
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
@@ -12,35 +12,56 @@ const SpecComponentsInvalidMapName = () => {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
return {
|
|
15
|
-
|
|
15
|
+
NamedSchemas: {
|
|
16
|
+
Schema(_node, { key, report, location }) {
|
|
17
|
+
validateKey(key, report, location, 'schemas');
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
NamedParameters: {
|
|
16
21
|
Parameter(_node, { key, report, location }) {
|
|
17
22
|
validateKey(key, report, location, 'parameters');
|
|
18
23
|
},
|
|
24
|
+
},
|
|
25
|
+
NamedResponses: {
|
|
19
26
|
Response(_node, { key, report, location }) {
|
|
20
27
|
validateKey(key, report, location, 'responses');
|
|
21
28
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
29
|
+
},
|
|
30
|
+
NamedExamples: {
|
|
25
31
|
Example(_node, { key, report, location }) {
|
|
26
32
|
validateKey(key, report, location, 'examples');
|
|
27
33
|
},
|
|
34
|
+
},
|
|
35
|
+
NamedRequestBodies: {
|
|
28
36
|
RequestBody(_node, { key, report, location }) {
|
|
29
37
|
validateKey(key, report, location, 'requestBodies');
|
|
30
38
|
},
|
|
39
|
+
},
|
|
40
|
+
NamedHeaders: {
|
|
31
41
|
Header(_node, { key, report, location }) {
|
|
32
42
|
validateKey(key, report, location, 'headers');
|
|
33
43
|
},
|
|
44
|
+
},
|
|
45
|
+
NamedSecuritySchemes: {
|
|
34
46
|
SecurityScheme(_node, { key, report, location }) {
|
|
35
|
-
validateKey(key, report, location, '
|
|
47
|
+
validateKey(key, report, location, 'securitySchemes');
|
|
36
48
|
},
|
|
49
|
+
},
|
|
50
|
+
NamedLinks: {
|
|
37
51
|
Link(_node, { key, report, location }) {
|
|
38
52
|
validateKey(key, report, location, 'links');
|
|
39
53
|
},
|
|
54
|
+
},
|
|
55
|
+
NamedCallbacks: {
|
|
40
56
|
Callback(_node, { key, report, location }) {
|
|
41
57
|
validateKey(key, report, location, 'callbacks');
|
|
42
58
|
},
|
|
43
59
|
},
|
|
60
|
+
ExampleMap: {
|
|
61
|
+
Example(_node, { key, report, location }) {
|
|
62
|
+
validateKey(key, report, location, 'examples');
|
|
63
|
+
},
|
|
64
|
+
},
|
|
44
65
|
};
|
|
45
66
|
};
|
|
46
67
|
exports.SpecComponentsInvalidMapName = SpecComponentsInvalidMapName;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare function mapOf(typeName: string): {
|
|
|
49
49
|
properties: {};
|
|
50
50
|
additionalProperties: () => string;
|
|
51
51
|
};
|
|
52
|
+
export declare const SpecExtension: NormalizedNodeType;
|
|
52
53
|
export declare function normalizeTypes(types: Record<string, NodeType>, options?: {
|
|
53
54
|
doNotResolveExamples?: boolean;
|
|
54
55
|
}): Record<string, NormalizedNodeType>;
|
package/lib/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNamedType = exports.normalizeTypes = exports.mapOf = exports.listOf = void 0;
|
|
3
|
+
exports.isNamedType = exports.normalizeTypes = exports.SpecExtension = exports.mapOf = exports.listOf = void 0;
|
|
4
4
|
function listOf(typeName) {
|
|
5
5
|
return {
|
|
6
6
|
name: `${typeName}List`,
|
|
@@ -17,6 +17,10 @@ function mapOf(typeName) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
exports.mapOf = mapOf;
|
|
20
|
+
exports.SpecExtension = {
|
|
21
|
+
name: 'SpecExtension',
|
|
22
|
+
properties: {},
|
|
23
|
+
};
|
|
20
24
|
function normalizeTypes(types, options = {}) {
|
|
21
25
|
const normalizedTypes = {};
|
|
22
26
|
for (const typeName of Object.keys(types)) {
|
|
@@ -25,6 +29,8 @@ function normalizeTypes(types, options = {}) {
|
|
|
25
29
|
for (const type of Object.values(normalizedTypes)) {
|
|
26
30
|
normalizeType(type);
|
|
27
31
|
}
|
|
32
|
+
// all type trees have a SpecExtension type by default
|
|
33
|
+
normalizedTypes['SpecExtension'] = exports.SpecExtension;
|
|
28
34
|
return normalizedTypes;
|
|
29
35
|
function normalizeType(type) {
|
|
30
36
|
if (type.additionalProperties) {
|
package/lib/types/oas2.js
CHANGED
|
@@ -25,6 +25,7 @@ const Root = {
|
|
|
25
25
|
'x-ignoredHeaderParameters': { type: 'array', items: { type: 'string' } },
|
|
26
26
|
},
|
|
27
27
|
required: ['swagger', 'paths', 'info'],
|
|
28
|
+
extensionsPrefix: 'x-',
|
|
28
29
|
};
|
|
29
30
|
const Info = {
|
|
30
31
|
properties: {
|
|
@@ -37,6 +38,7 @@ const Info = {
|
|
|
37
38
|
'x-logo': 'Logo',
|
|
38
39
|
},
|
|
39
40
|
required: ['title', 'version'],
|
|
41
|
+
extensionsPrefix: 'x-',
|
|
40
42
|
};
|
|
41
43
|
const Logo = {
|
|
42
44
|
properties: {
|
|
@@ -45,6 +47,7 @@ const Logo = {
|
|
|
45
47
|
backgroundColor: { type: 'string' },
|
|
46
48
|
href: { type: 'string' },
|
|
47
49
|
},
|
|
50
|
+
extensionsPrefix: 'x-',
|
|
48
51
|
};
|
|
49
52
|
const Contact = {
|
|
50
53
|
properties: {
|
|
@@ -52,6 +55,7 @@ const Contact = {
|
|
|
52
55
|
url: { type: 'string' },
|
|
53
56
|
email: { type: 'string' },
|
|
54
57
|
},
|
|
58
|
+
extensionsPrefix: 'x-',
|
|
55
59
|
};
|
|
56
60
|
const License = {
|
|
57
61
|
properties: {
|
|
@@ -59,6 +63,7 @@ const License = {
|
|
|
59
63
|
url: { type: 'string' },
|
|
60
64
|
},
|
|
61
65
|
required: ['name'],
|
|
66
|
+
extensionsPrefix: 'x-',
|
|
62
67
|
};
|
|
63
68
|
const Paths = {
|
|
64
69
|
properties: {},
|
|
@@ -76,6 +81,7 @@ const PathItem = {
|
|
|
76
81
|
head: 'Operation',
|
|
77
82
|
patch: 'Operation',
|
|
78
83
|
},
|
|
84
|
+
extensionsPrefix: 'x-',
|
|
79
85
|
};
|
|
80
86
|
const Operation = {
|
|
81
87
|
properties: {
|
|
@@ -96,6 +102,7 @@ const Operation = {
|
|
|
96
102
|
'x-hideTryItPanel': { type: 'boolean' },
|
|
97
103
|
},
|
|
98
104
|
required: ['responses'],
|
|
105
|
+
extensionsPrefix: 'x-',
|
|
99
106
|
};
|
|
100
107
|
const XCodeSample = {
|
|
101
108
|
properties: {
|
|
@@ -117,6 +124,7 @@ const ExternalDocs = {
|
|
|
117
124
|
url: { type: 'string' },
|
|
118
125
|
},
|
|
119
126
|
required: ['url'],
|
|
127
|
+
extensionsPrefix: 'x-',
|
|
120
128
|
};
|
|
121
129
|
const Parameter = {
|
|
122
130
|
properties: {
|
|
@@ -162,6 +170,7 @@ const Parameter = {
|
|
|
162
170
|
}
|
|
163
171
|
}
|
|
164
172
|
},
|
|
173
|
+
extensionsPrefix: 'x-',
|
|
165
174
|
};
|
|
166
175
|
const ParameterItems = {
|
|
167
176
|
properties: {
|
|
@@ -191,6 +200,7 @@ const ParameterItems = {
|
|
|
191
200
|
return ['type'];
|
|
192
201
|
}
|
|
193
202
|
},
|
|
203
|
+
extensionsPrefix: 'x-',
|
|
194
204
|
};
|
|
195
205
|
const Responses = {
|
|
196
206
|
properties: {
|
|
@@ -207,6 +217,7 @@ const Response = {
|
|
|
207
217
|
'x-summary': { type: 'string' },
|
|
208
218
|
},
|
|
209
219
|
required: ['description'],
|
|
220
|
+
extensionsPrefix: 'x-',
|
|
210
221
|
};
|
|
211
222
|
const Examples = {
|
|
212
223
|
properties: {},
|
|
@@ -241,6 +252,7 @@ const Header = {
|
|
|
241
252
|
return ['type'];
|
|
242
253
|
}
|
|
243
254
|
},
|
|
255
|
+
extensionsPrefix: 'x-',
|
|
244
256
|
};
|
|
245
257
|
const Tag = {
|
|
246
258
|
properties: {
|
|
@@ -251,6 +263,7 @@ const Tag = {
|
|
|
251
263
|
'x-displayName': { type: 'string' },
|
|
252
264
|
},
|
|
253
265
|
required: ['name'],
|
|
266
|
+
extensionsPrefix: 'x-',
|
|
254
267
|
};
|
|
255
268
|
const TagGroup = {
|
|
256
269
|
properties: {
|
|
@@ -313,6 +326,7 @@ const Schema = {
|
|
|
313
326
|
'x-explicitMappingOnly': { type: 'boolean' },
|
|
314
327
|
'x-enumDescriptions': 'EnumDescriptions',
|
|
315
328
|
},
|
|
329
|
+
extensionsPrefix: 'x-',
|
|
316
330
|
};
|
|
317
331
|
const EnumDescriptions = {
|
|
318
332
|
properties: {},
|
|
@@ -330,6 +344,7 @@ const Xml = {
|
|
|
330
344
|
attribute: { type: 'boolean' },
|
|
331
345
|
wrapped: { type: 'boolean' },
|
|
332
346
|
},
|
|
347
|
+
extensionsPrefix: 'x-',
|
|
333
348
|
};
|
|
334
349
|
const SecurityScheme = {
|
|
335
350
|
properties: {
|
|
@@ -398,6 +413,7 @@ const Example = {
|
|
|
398
413
|
description: { type: 'string' },
|
|
399
414
|
externalValue: { type: 'string' },
|
|
400
415
|
},
|
|
416
|
+
extensionsPrefix: 'x-',
|
|
401
417
|
};
|
|
402
418
|
exports.Oas2Types = {
|
|
403
419
|
Root,
|
package/lib/types/oas3.js
CHANGED
|
@@ -19,6 +19,7 @@ const Root = {
|
|
|
19
19
|
'x-ignoredHeaderParameters': { type: 'array', items: { type: 'string' } },
|
|
20
20
|
},
|
|
21
21
|
required: ['openapi', 'paths', 'info'],
|
|
22
|
+
extensionsPrefix: 'x-',
|
|
22
23
|
};
|
|
23
24
|
const Tag = {
|
|
24
25
|
properties: {
|
|
@@ -29,12 +30,14 @@ const Tag = {
|
|
|
29
30
|
'x-displayName': { type: 'string' },
|
|
30
31
|
},
|
|
31
32
|
required: ['name'],
|
|
33
|
+
extensionsPrefix: 'x-',
|
|
32
34
|
};
|
|
33
35
|
const TagGroup = {
|
|
34
36
|
properties: {
|
|
35
37
|
name: { type: 'string' },
|
|
36
38
|
tags: { type: 'array', items: { type: 'string' } },
|
|
37
39
|
},
|
|
40
|
+
extensionsPrefix: 'x-',
|
|
38
41
|
};
|
|
39
42
|
const ExternalDocs = {
|
|
40
43
|
properties: {
|
|
@@ -42,6 +45,7 @@ const ExternalDocs = {
|
|
|
42
45
|
url: { type: 'string' },
|
|
43
46
|
},
|
|
44
47
|
required: ['url'],
|
|
48
|
+
extensionsPrefix: 'x-',
|
|
45
49
|
};
|
|
46
50
|
const Server = {
|
|
47
51
|
properties: {
|
|
@@ -50,6 +54,7 @@ const Server = {
|
|
|
50
54
|
variables: 'ServerVariablesMap',
|
|
51
55
|
},
|
|
52
56
|
required: ['url'],
|
|
57
|
+
extensionsPrefix: 'x-',
|
|
53
58
|
};
|
|
54
59
|
const ServerVariable = {
|
|
55
60
|
properties: {
|
|
@@ -61,6 +66,7 @@ const ServerVariable = {
|
|
|
61
66
|
description: null,
|
|
62
67
|
},
|
|
63
68
|
required: ['default'],
|
|
69
|
+
extensionsPrefix: 'x-',
|
|
64
70
|
};
|
|
65
71
|
const SecurityRequirement = {
|
|
66
72
|
properties: {},
|
|
@@ -77,6 +83,7 @@ const Info = {
|
|
|
77
83
|
'x-logo': 'Logo',
|
|
78
84
|
},
|
|
79
85
|
required: ['title', 'version'],
|
|
86
|
+
extensionsPrefix: 'x-',
|
|
80
87
|
};
|
|
81
88
|
const Logo = {
|
|
82
89
|
properties: {
|
|
@@ -92,6 +99,7 @@ const Contact = {
|
|
|
92
99
|
url: { type: 'string' },
|
|
93
100
|
email: { type: 'string' },
|
|
94
101
|
},
|
|
102
|
+
extensionsPrefix: 'x-',
|
|
95
103
|
};
|
|
96
104
|
const License = {
|
|
97
105
|
properties: {
|
|
@@ -99,6 +107,7 @@ const License = {
|
|
|
99
107
|
url: { type: 'string' },
|
|
100
108
|
},
|
|
101
109
|
required: ['name'],
|
|
110
|
+
extensionsPrefix: 'x-',
|
|
102
111
|
};
|
|
103
112
|
const Paths = {
|
|
104
113
|
properties: {},
|
|
@@ -124,6 +133,7 @@ const PathItem = {
|
|
|
124
133
|
patch: 'Operation',
|
|
125
134
|
trace: 'Operation',
|
|
126
135
|
},
|
|
136
|
+
extensionsPrefix: 'x-',
|
|
127
137
|
};
|
|
128
138
|
const Parameter = {
|
|
129
139
|
properties: {
|
|
@@ -145,6 +155,7 @@ const Parameter = {
|
|
|
145
155
|
},
|
|
146
156
|
required: ['name', 'in'],
|
|
147
157
|
requiredOneOf: ['schema', 'content'],
|
|
158
|
+
extensionsPrefix: 'x-',
|
|
148
159
|
};
|
|
149
160
|
const Operation = {
|
|
150
161
|
properties: {
|
|
@@ -168,6 +179,7 @@ const Operation = {
|
|
|
168
179
|
'x-hideTryItPanel': { type: 'boolean' },
|
|
169
180
|
},
|
|
170
181
|
required: ['responses'],
|
|
182
|
+
extensionsPrefix: 'x-',
|
|
171
183
|
};
|
|
172
184
|
const XCodeSample = {
|
|
173
185
|
properties: {
|
|
@@ -183,6 +195,7 @@ const RequestBody = {
|
|
|
183
195
|
content: 'MediaTypesMap',
|
|
184
196
|
},
|
|
185
197
|
required: ['content'],
|
|
198
|
+
extensionsPrefix: 'x-',
|
|
186
199
|
};
|
|
187
200
|
const MediaTypesMap = {
|
|
188
201
|
properties: {},
|
|
@@ -195,6 +208,7 @@ const MediaType = {
|
|
|
195
208
|
examples: 'ExamplesMap',
|
|
196
209
|
encoding: 'EncodingMap',
|
|
197
210
|
},
|
|
211
|
+
extensionsPrefix: 'x-',
|
|
198
212
|
};
|
|
199
213
|
const Example = {
|
|
200
214
|
properties: {
|
|
@@ -203,6 +217,7 @@ const Example = {
|
|
|
203
217
|
description: { type: 'string' },
|
|
204
218
|
externalValue: { type: 'string' },
|
|
205
219
|
},
|
|
220
|
+
extensionsPrefix: 'x-',
|
|
206
221
|
};
|
|
207
222
|
const Encoding = {
|
|
208
223
|
properties: {
|
|
@@ -214,6 +229,7 @@ const Encoding = {
|
|
|
214
229
|
explode: { type: 'boolean' },
|
|
215
230
|
allowReserved: { type: 'boolean' },
|
|
216
231
|
},
|
|
232
|
+
extensionsPrefix: 'x-',
|
|
217
233
|
};
|
|
218
234
|
const EnumDescriptions = {
|
|
219
235
|
properties: {},
|
|
@@ -236,6 +252,7 @@ const Header = {
|
|
|
236
252
|
content: 'MediaTypesMap',
|
|
237
253
|
},
|
|
238
254
|
requiredOneOf: ['schema', 'content'],
|
|
255
|
+
extensionsPrefix: 'x-',
|
|
239
256
|
};
|
|
240
257
|
const Responses = {
|
|
241
258
|
properties: { default: 'Response' },
|
|
@@ -250,6 +267,7 @@ const Response = {
|
|
|
250
267
|
'x-summary': { type: 'string' },
|
|
251
268
|
},
|
|
252
269
|
required: ['description'],
|
|
270
|
+
extensionsPrefix: 'x-',
|
|
253
271
|
};
|
|
254
272
|
const Link = {
|
|
255
273
|
properties: {
|
|
@@ -260,6 +278,7 @@ const Link = {
|
|
|
260
278
|
description: { type: 'string' },
|
|
261
279
|
server: 'Server',
|
|
262
280
|
},
|
|
281
|
+
extensionsPrefix: 'x-',
|
|
263
282
|
};
|
|
264
283
|
const Schema = {
|
|
265
284
|
properties: {
|
|
@@ -326,6 +345,7 @@ const Schema = {
|
|
|
326
345
|
'x-additionalPropertiesName': { type: 'string' },
|
|
327
346
|
'x-explicitMappingOnly': { type: 'boolean' },
|
|
328
347
|
},
|
|
348
|
+
extensionsPrefix: 'x-',
|
|
329
349
|
};
|
|
330
350
|
const Xml = {
|
|
331
351
|
properties: {
|
|
@@ -335,6 +355,7 @@ const Xml = {
|
|
|
335
355
|
attribute: { type: 'boolean' },
|
|
336
356
|
wrapped: { type: 'boolean' },
|
|
337
357
|
},
|
|
358
|
+
extensionsPrefix: 'x-',
|
|
338
359
|
};
|
|
339
360
|
const SchemaProperties = {
|
|
340
361
|
properties: {},
|
|
@@ -357,6 +378,7 @@ const Discriminator = {
|
|
|
357
378
|
mapping: 'DiscriminatorMapping',
|
|
358
379
|
},
|
|
359
380
|
required: ['propertyName'],
|
|
381
|
+
extensionsPrefix: 'x-',
|
|
360
382
|
};
|
|
361
383
|
const Components = {
|
|
362
384
|
properties: {
|
|
@@ -370,6 +392,7 @@ const Components = {
|
|
|
370
392
|
links: 'NamedLinks',
|
|
371
393
|
callbacks: 'NamedCallbacks',
|
|
372
394
|
},
|
|
395
|
+
extensionsPrefix: 'x-',
|
|
373
396
|
};
|
|
374
397
|
const ImplicitFlow = {
|
|
375
398
|
properties: {
|
|
@@ -378,6 +401,7 @@ const ImplicitFlow = {
|
|
|
378
401
|
authorizationUrl: { type: 'string' },
|
|
379
402
|
},
|
|
380
403
|
required: ['authorizationUrl', 'scopes'],
|
|
404
|
+
extensionsPrefix: 'x-',
|
|
381
405
|
};
|
|
382
406
|
const PasswordFlow = {
|
|
383
407
|
properties: {
|
|
@@ -386,6 +410,7 @@ const PasswordFlow = {
|
|
|
386
410
|
tokenUrl: { type: 'string' },
|
|
387
411
|
},
|
|
388
412
|
required: ['tokenUrl', 'scopes'],
|
|
413
|
+
extensionsPrefix: 'x-',
|
|
389
414
|
};
|
|
390
415
|
const ClientCredentials = {
|
|
391
416
|
properties: {
|
|
@@ -394,6 +419,7 @@ const ClientCredentials = {
|
|
|
394
419
|
tokenUrl: { type: 'string' },
|
|
395
420
|
},
|
|
396
421
|
required: ['tokenUrl', 'scopes'],
|
|
422
|
+
extensionsPrefix: 'x-',
|
|
397
423
|
};
|
|
398
424
|
const AuthorizationCode = {
|
|
399
425
|
properties: {
|
|
@@ -411,6 +437,7 @@ const AuthorizationCode = {
|
|
|
411
437
|
},
|
|
412
438
|
},
|
|
413
439
|
required: ['authorizationUrl', 'tokenUrl', 'scopes'],
|
|
440
|
+
extensionsPrefix: 'x-',
|
|
414
441
|
};
|
|
415
442
|
const OAuth2Flows = {
|
|
416
443
|
properties: {
|
|
@@ -419,6 +446,7 @@ const OAuth2Flows = {
|
|
|
419
446
|
clientCredentials: 'ClientCredentials',
|
|
420
447
|
authorizationCode: 'AuthorizationCode',
|
|
421
448
|
},
|
|
449
|
+
extensionsPrefix: 'x-',
|
|
422
450
|
};
|
|
423
451
|
const SecurityScheme = {
|
|
424
452
|
properties: {
|