@redocly/openapi-core 1.0.0-beta.116 → 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 -11
- package/lib/types/oas3.js +28 -11
- 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 -12
- package/src/types/oas3.ts +28 -12
- 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: {
|
|
@@ -94,9 +100,9 @@ const Operation = {
|
|
|
94
100
|
'x-codeSamples': 'XCodeSampleList',
|
|
95
101
|
'x-code-samples': 'XCodeSampleList',
|
|
96
102
|
'x-hideTryItPanel': { type: 'boolean' },
|
|
97
|
-
'x-meta': 'XMetaList',
|
|
98
103
|
},
|
|
99
104
|
required: ['responses'],
|
|
105
|
+
extensionsPrefix: 'x-',
|
|
100
106
|
};
|
|
101
107
|
const XCodeSample = {
|
|
102
108
|
properties: {
|
|
@@ -118,6 +124,7 @@ const ExternalDocs = {
|
|
|
118
124
|
url: { type: 'string' },
|
|
119
125
|
},
|
|
120
126
|
required: ['url'],
|
|
127
|
+
extensionsPrefix: 'x-',
|
|
121
128
|
};
|
|
122
129
|
const Parameter = {
|
|
123
130
|
properties: {
|
|
@@ -163,6 +170,7 @@ const Parameter = {
|
|
|
163
170
|
}
|
|
164
171
|
}
|
|
165
172
|
},
|
|
173
|
+
extensionsPrefix: 'x-',
|
|
166
174
|
};
|
|
167
175
|
const ParameterItems = {
|
|
168
176
|
properties: {
|
|
@@ -192,6 +200,7 @@ const ParameterItems = {
|
|
|
192
200
|
return ['type'];
|
|
193
201
|
}
|
|
194
202
|
},
|
|
203
|
+
extensionsPrefix: 'x-',
|
|
195
204
|
};
|
|
196
205
|
const Responses = {
|
|
197
206
|
properties: {
|
|
@@ -208,6 +217,7 @@ const Response = {
|
|
|
208
217
|
'x-summary': { type: 'string' },
|
|
209
218
|
},
|
|
210
219
|
required: ['description'],
|
|
220
|
+
extensionsPrefix: 'x-',
|
|
211
221
|
};
|
|
212
222
|
const Examples = {
|
|
213
223
|
properties: {},
|
|
@@ -242,6 +252,7 @@ const Header = {
|
|
|
242
252
|
return ['type'];
|
|
243
253
|
}
|
|
244
254
|
},
|
|
255
|
+
extensionsPrefix: 'x-',
|
|
245
256
|
};
|
|
246
257
|
const Tag = {
|
|
247
258
|
properties: {
|
|
@@ -252,6 +263,7 @@ const Tag = {
|
|
|
252
263
|
'x-displayName': { type: 'string' },
|
|
253
264
|
},
|
|
254
265
|
required: ['name'],
|
|
266
|
+
extensionsPrefix: 'x-',
|
|
255
267
|
};
|
|
256
268
|
const TagGroup = {
|
|
257
269
|
properties: {
|
|
@@ -314,6 +326,7 @@ const Schema = {
|
|
|
314
326
|
'x-explicitMappingOnly': { type: 'boolean' },
|
|
315
327
|
'x-enumDescriptions': 'EnumDescriptions',
|
|
316
328
|
},
|
|
329
|
+
extensionsPrefix: 'x-',
|
|
317
330
|
};
|
|
318
331
|
const EnumDescriptions = {
|
|
319
332
|
properties: {},
|
|
@@ -331,6 +344,7 @@ const Xml = {
|
|
|
331
344
|
attribute: { type: 'boolean' },
|
|
332
345
|
wrapped: { type: 'boolean' },
|
|
333
346
|
},
|
|
347
|
+
extensionsPrefix: 'x-',
|
|
334
348
|
};
|
|
335
349
|
const SecurityScheme = {
|
|
336
350
|
properties: {
|
|
@@ -399,14 +413,7 @@ const Example = {
|
|
|
399
413
|
description: { type: 'string' },
|
|
400
414
|
externalValue: { type: 'string' },
|
|
401
415
|
},
|
|
402
|
-
|
|
403
|
-
const XMeta = {
|
|
404
|
-
properties: {
|
|
405
|
-
title: { type: 'string' },
|
|
406
|
-
description: { type: 'string' },
|
|
407
|
-
keywords: { type: 'string' },
|
|
408
|
-
image: { type: 'string' },
|
|
409
|
-
},
|
|
416
|
+
extensionsPrefix: 'x-',
|
|
410
417
|
};
|
|
411
418
|
exports.Oas2Types = {
|
|
412
419
|
Root,
|
|
@@ -444,8 +451,6 @@ exports.Oas2Types = {
|
|
|
444
451
|
SecurityScheme,
|
|
445
452
|
XCodeSample,
|
|
446
453
|
XCodeSampleList: _1.listOf('XCodeSample'),
|
|
447
|
-
XMeta,
|
|
448
|
-
XMetaList: _1.listOf('XMeta'),
|
|
449
454
|
XServerList: _1.listOf('XServer'),
|
|
450
455
|
XServer,
|
|
451
456
|
};
|