@skmtc/core 0.0.612 → 0.0.614
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/esm/context/CoreContext.js +1 -1
- package/esm/context/ParseContext.d.ts +35 -15
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +62 -11
- package/esm/context/StackTrail.d.ts +3 -0
- package/esm/context/StackTrail.d.ts.map +1 -1
- package/esm/context/StackTrail.js +20 -0
- package/esm/context/types.d.ts +1 -1
- package/esm/context/types.d.ts.map +1 -1
- package/esm/oas/components/Components.d.ts +2 -0
- package/esm/oas/components/Components.d.ts.map +1 -1
- package/esm/oas/components/Components.js +14 -0
- package/esm/oas/document/Document.d.ts +4 -0
- package/esm/oas/document/Document.d.ts.map +1 -1
- package/esm/oas/document/Document.js +22 -0
- package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/esm/oas/document/toDocumentFieldsV3.js +1 -2
- package/esm/oas/integer/toInteger.d.ts +1 -1
- package/esm/oas/integer/toInteger.d.ts.map +1 -1
- package/esm/oas/integer/toInteger.js +8 -3
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +5 -2
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +16 -2
- package/esm/oas/ref/toRefV31.d.ts.map +1 -1
- package/esm/oas/ref/toRefV31.js +3 -3
- package/esm/oas/response/toResponseV3.d.ts.map +1 -1
- package/esm/oas/response/toResponseV3.js +5 -2
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +19 -10
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +2 -1
- package/package.json +1 -1
- package/script/context/CoreContext.js +1 -1
- package/script/context/ParseContext.d.ts +35 -15
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +62 -11
- package/script/context/StackTrail.d.ts +3 -0
- package/script/context/StackTrail.d.ts.map +1 -1
- package/script/context/StackTrail.js +20 -0
- package/script/context/types.d.ts +1 -1
- package/script/context/types.d.ts.map +1 -1
- package/script/oas/components/Components.d.ts +2 -0
- package/script/oas/components/Components.d.ts.map +1 -1
- package/script/oas/components/Components.js +15 -1
- package/script/oas/document/Document.d.ts +4 -0
- package/script/oas/document/Document.d.ts.map +1 -1
- package/script/oas/document/Document.js +22 -0
- package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/script/oas/document/toDocumentFieldsV3.js +1 -2
- package/script/oas/integer/toInteger.d.ts +1 -1
- package/script/oas/integer/toInteger.d.ts.map +1 -1
- package/script/oas/integer/toInteger.js +8 -3
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +8 -2
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +19 -2
- package/script/oas/ref/toRefV31.d.ts.map +1 -1
- package/script/oas/ref/toRefV31.js +3 -3
- package/script/oas/response/toResponseV3.d.ts.map +1 -1
- package/script/oas/response/toResponseV3.js +8 -2
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +22 -10
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDocumentFieldsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/document/toDocumentFieldsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAKjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,KAAK,gBAAgB,GAAG;IACtB,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,gCAG5B,gBAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"toDocumentFieldsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/document/toDocumentFieldsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAKjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,KAAK,gBAAgB,GAAG;IACtB,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,gCAG5B,gBAAgB,KAAG,cAoBrB,CAAA"}
|
|
@@ -16,7 +16,7 @@ const toDocumentFieldsV3 = ({ documentObject, context }) => {
|
|
|
16
16
|
context,
|
|
17
17
|
parentType: 'document'
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
return {
|
|
20
20
|
openapi,
|
|
21
21
|
info: context.trace('info', () => (0, toInfoV3_js_1.toInfoV3)({ info, context })),
|
|
22
22
|
servers: context.trace('servers', () => (0, toServerV3_js_1.toOptionalServersV3)({ servers, context })),
|
|
@@ -26,6 +26,5 @@ const toDocumentFieldsV3 = ({ documentObject, context }) => {
|
|
|
26
26
|
security: context.trace('security', () => (0, toSecurityRequirement_js_1.toSecurityRequirementsV3)({ security, context })),
|
|
27
27
|
extensionFields
|
|
28
28
|
};
|
|
29
|
-
return fields;
|
|
30
29
|
};
|
|
31
30
|
exports.toDocumentFieldsV3 = toDocumentFieldsV3;
|
|
@@ -13,6 +13,6 @@ type ToParsedIntegerArgs<Nullable extends boolean | undefined> = {
|
|
|
13
13
|
example: Nullable extends true ? number | null | undefined : number | undefined;
|
|
14
14
|
enums: Nullable extends true ? (number | null)[] | undefined : number[] | undefined;
|
|
15
15
|
};
|
|
16
|
-
export declare const toParsedInteger: <Nullable extends boolean | undefined>({ context, nullable, example, enums, value }: ToParsedIntegerArgs<Nullable>) => OasInteger<Nullable>;
|
|
16
|
+
export declare const toParsedInteger: <Nullable extends boolean | undefined>({ context, nullable, example, enums, value: valueWithoutEnums }: ToParsedIntegerArgs<Nullable>) => OasInteger<Nullable>;
|
|
17
17
|
export {};
|
|
18
18
|
//# sourceMappingURL=toInteger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toInteger.d.ts","sourceRoot":"","sources":["../../../src/oas/integer/toInteger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"toInteger.d.ts","sourceRoot":"","sources":["../../../src/oas/integer/toInteger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AASzC,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,SAAS,uBAAwB,aAAa,KAAG,UA2B7D,CAAA;AAED,KAAK,mBAAmB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC/D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAA;IACrE,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;IAC/E,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;CACpF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,mEAMjE,mBAAmB,CAAC,QAAQ,CAAC,KAAG,UAAU,CAAC,QAAQ,CA2CrD,CAAA"}
|
|
@@ -57,11 +57,16 @@ const toInteger = ({ value, context }) => {
|
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
exports.toInteger = toInteger;
|
|
60
|
-
const toParsedInteger = ({ context, nullable, example, enums, value }) => {
|
|
61
|
-
const {
|
|
60
|
+
const toParsedInteger = ({ context, nullable, example, enums, value: valueWithoutEnums }) => {
|
|
61
|
+
// const { format, value: valueWithoutFormat } = parseFormat({
|
|
62
|
+
// value: valueWithoutEnums,
|
|
63
|
+
// valibotSchema: integerFormat,
|
|
64
|
+
// context
|
|
65
|
+
// })
|
|
66
|
+
const { type: _type, title, description, default: defaultValue, multipleOf, maximum, exclusiveMaximum, minimum, format, exclusiveMinimum, ...skipped } = v.parse(integer_types_js_1.oasIntegerData, valueWithoutEnums);
|
|
62
67
|
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
63
68
|
skipped,
|
|
64
|
-
parent:
|
|
69
|
+
parent: valueWithoutEnums,
|
|
65
70
|
context,
|
|
66
71
|
parentType: 'schema:integer'
|
|
67
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAK1D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAOD,eAAO,MAAM,aAAa,0CAIvB,iBAAiB,KAAG,YAsCtB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,SAAS,CAAC,WAAW,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,uBAAwB,kBAAkB,KAAG,YAAY,EAoEnF,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
4
7
|
const toRequestBodiesV3_js_1 = require("../requestBody/toRequestBodiesV3.js");
|
|
@@ -9,6 +12,7 @@ const toPathItemV3_js_1 = require("../pathItem/toPathItemV3.js");
|
|
|
9
12
|
const Method_js_1 = require("../../types/Method.js");
|
|
10
13
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
11
14
|
const toSecurityRequirement_js_1 = require("../securityRequirement/toSecurityRequirement.js");
|
|
15
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
12
16
|
const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
13
17
|
const { method, path, pathItem } = operationInfo;
|
|
14
18
|
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, ...skipped } = operation;
|
|
@@ -77,10 +81,12 @@ const toOperationsV3 = ({ paths, context }) => {
|
|
|
77
81
|
});
|
|
78
82
|
}
|
|
79
83
|
catch (error) {
|
|
80
|
-
|
|
84
|
+
(0, tiny_invariant_1.default)(error instanceof Error, 'Invalid error');
|
|
85
|
+
context.logIssue({
|
|
81
86
|
key: method,
|
|
82
|
-
message: error instanceof Error ? error.message : 'Failed to parse operation',
|
|
83
87
|
parent: operation,
|
|
88
|
+
level: 'error',
|
|
89
|
+
error,
|
|
84
90
|
type: 'INVALID_OPERATION'
|
|
85
91
|
});
|
|
86
92
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;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(this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.toOptionalParametersV3 = exports.toParametersV3 = exports.toParameterListV3 = void 0;
|
|
27
30
|
const refFns_js_1 = require("../../helpers/refFns.js");
|
|
@@ -34,6 +37,7 @@ const Parameter_js_1 = require("./Parameter.js");
|
|
|
34
37
|
const ts_pattern_1 = require("ts-pattern");
|
|
35
38
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
36
39
|
const v = __importStar(require("valibot"));
|
|
40
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
37
41
|
const toParameterListV3 = ({ parameters, context }) => {
|
|
38
42
|
if (!parameters) {
|
|
39
43
|
return undefined;
|
|
@@ -44,8 +48,21 @@ const toParameterListV3 = ({ parameters, context }) => {
|
|
|
44
48
|
};
|
|
45
49
|
exports.toParameterListV3 = toParameterListV3;
|
|
46
50
|
const toParametersV3 = ({ parameters, context }) => {
|
|
47
|
-
return Object.fromEntries(Object.entries(parameters).map(([key,
|
|
48
|
-
|
|
51
|
+
return Object.fromEntries(Object.entries(parameters).map(([key, parameter]) => {
|
|
52
|
+
try {
|
|
53
|
+
return [key, context.trace(key, () => toParameterV3({ parameter, context }))];
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
(0, tiny_invariant_1.default)(error instanceof Error, 'Invalid error');
|
|
57
|
+
context.logIssue({
|
|
58
|
+
key: key,
|
|
59
|
+
level: 'error',
|
|
60
|
+
error,
|
|
61
|
+
parent: parameter,
|
|
62
|
+
type: 'INVALID_PARAMETER'
|
|
63
|
+
});
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
49
66
|
}));
|
|
50
67
|
};
|
|
51
68
|
exports.toParametersV3 = toParametersV3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toRefV31.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/toRefV31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"toRefV31.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/toRefV31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,KAAK,YAAY,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI;IACnD,GAAG,EAAE,WAAW,CAAC,eAAe,CAAA;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,6BAIrD,YAAY,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAgB5B,CAAA"}
|
|
@@ -5,12 +5,12 @@ const Ref_js_1 = require("./Ref.js");
|
|
|
5
5
|
const toRefV31 = ({ ref, refType, context }) => {
|
|
6
6
|
const { $ref, summary, description, ...skipped } = ref;
|
|
7
7
|
context.logSkippedFields({ skipped, parent: ref, parentType: 'ref' });
|
|
8
|
-
|
|
8
|
+
context.registerRef(context.stackTrail.clone(), $ref);
|
|
9
|
+
return new Ref_js_1.OasRef({
|
|
9
10
|
refType,
|
|
10
11
|
$ref,
|
|
11
12
|
summary,
|
|
12
13
|
description
|
|
13
|
-
};
|
|
14
|
-
return new Ref_js_1.OasRef(fields, context.oasDocument);
|
|
14
|
+
}, context.oasDocument);
|
|
15
15
|
};
|
|
16
16
|
exports.toRefV31 = toRefV31;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toResponseV3.d.ts","sourceRoot":"","sources":["../../../src/oas/response/toResponseV3.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,aAAa,2BAGvB,iBAAiB,KAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"toResponseV3.d.ts","sourceRoot":"","sources":["../../../src/oas/response/toResponseV3.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAG3C,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,aAAa,2BAGvB,iBAAiB,KAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAsBrE,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAA;IAChD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,qBAAqB,2BAG/B,yBAAyB,KAAG,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,SAMjF,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,cAAc,CAAA;IAC9D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY,0BAGtB,gBAAgB,KAAG,WAAW,GAAG,MAAM,CAAC,UAAU,CAsBpD,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.toResponseV3 = exports.toOptionalResponsesV3 = exports.toResponsesV3 = void 0;
|
|
4
7
|
const toRefV31_js_1 = require("../ref/toRefV31.js");
|
|
@@ -7,6 +10,7 @@ const refFns_js_1 = require("../../helpers/refFns.js");
|
|
|
7
10
|
const toMediaTypeItemV3_js_1 = require("../mediaType/toMediaTypeItemV3.js");
|
|
8
11
|
const Response_js_1 = require("./Response.js");
|
|
9
12
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
13
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
10
14
|
const toResponsesV3 = ({ responses, context }) => {
|
|
11
15
|
return Object.fromEntries(Object.entries(responses)
|
|
12
16
|
.map(([key, value]) => {
|
|
@@ -14,9 +18,11 @@ const toResponsesV3 = ({ responses, context }) => {
|
|
|
14
18
|
return [key, context.trace(key, () => (0, exports.toResponseV3)({ response: value, context }))];
|
|
15
19
|
}
|
|
16
20
|
catch (error) {
|
|
17
|
-
|
|
21
|
+
(0, tiny_invariant_1.default)(error instanceof Error, 'Invalid error');
|
|
22
|
+
context.logIssue({
|
|
18
23
|
key,
|
|
19
|
-
|
|
24
|
+
level: 'error',
|
|
25
|
+
error,
|
|
20
26
|
parent: value,
|
|
21
27
|
type: 'INVALID_RESPONSE'
|
|
22
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toSchemasV3.d.ts","sourceRoot":"","sources":["../../../src/oas/schema/toSchemasV3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"toSchemasV3.d.ts","sourceRoot":"","sources":["../../../src/oas/schema/toSchemasV3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAa3C,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,yBAGrB,eAAe,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CA2B/D,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAA;IACvF,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,yBAG7B,uBAAuB,KAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,SAM3E,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,CAAA;IAC1D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CA0I3F,CAAA;AA+CD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,YAAY,GAAG,SAAS,CAAA;IACtE,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,wBAG5B,sBAAsB,KAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAM1D,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.toOptionalSchemaV3 = exports.toSchemaV3 = exports.toOptionalSchemasV3 = exports.toSchemasV3 = void 0;
|
|
4
7
|
const toRefV31_js_1 = require("../ref/toRefV31.js");
|
|
@@ -15,6 +18,7 @@ const toUnion_js_1 = require("../union/toUnion.js");
|
|
|
15
18
|
const refFns_js_2 = require("../../helpers/refFns.js");
|
|
16
19
|
const merge_intersection_js_1 = require("../_merge-all-of/merge-intersection.js");
|
|
17
20
|
const merge_union_js_1 = require("../_merge-all-of/merge-union.js");
|
|
21
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
18
22
|
const toSchemasV3 = ({ schemas, context }) => {
|
|
19
23
|
return Object.fromEntries(Object.entries(schemas)
|
|
20
24
|
.map(([key, schema]) => {
|
|
@@ -27,9 +31,11 @@ const toSchemasV3 = ({ schemas, context }) => {
|
|
|
27
31
|
];
|
|
28
32
|
}
|
|
29
33
|
catch (error) {
|
|
30
|
-
|
|
34
|
+
(0, tiny_invariant_1.default)(error instanceof Error, 'Invalid error');
|
|
35
|
+
context.logIssue({
|
|
31
36
|
key,
|
|
32
|
-
|
|
37
|
+
level: 'error',
|
|
38
|
+
error,
|
|
33
39
|
parent: schema,
|
|
34
40
|
type: 'INVALID_SCHEMA'
|
|
35
41
|
});
|
|
@@ -50,10 +56,6 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
50
56
|
if ((0, refFns_js_1.isRef)(schema)) {
|
|
51
57
|
return (0, toRefV31_js_1.toRefV31)({ ref: schema, refType: 'schema', context });
|
|
52
58
|
}
|
|
53
|
-
// Workaround for dodgy Reapit schema
|
|
54
|
-
// if (schema.type !== 'array' && 'optional' in schema && schema.optional === true) {
|
|
55
|
-
// schema.nullable = true
|
|
56
|
-
// }
|
|
57
59
|
return (0, ts_pattern_1.match)(schema)
|
|
58
60
|
.with({ allOf: ts_pattern_1.P.array() }, schema => {
|
|
59
61
|
return context.trace('allOf', () => {
|
|
@@ -75,6 +77,9 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
75
77
|
throw new Error('Missing "oneOf" array');
|
|
76
78
|
}
|
|
77
79
|
const { oneOf: members, ...value } = merged;
|
|
80
|
+
if (members.length === 1) {
|
|
81
|
+
return (0, exports.toSchemaV3)({ schema: members[0], context });
|
|
82
|
+
}
|
|
78
83
|
return (0, toUnion_js_1.toUnion)({ value, members, parentType: 'oneOf', context });
|
|
79
84
|
});
|
|
80
85
|
})
|
|
@@ -89,6 +94,9 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
89
94
|
throw new Error('Missing "anyOf" array');
|
|
90
95
|
}
|
|
91
96
|
const { anyOf: members, ...value } = merged;
|
|
97
|
+
if (members.length === 1) {
|
|
98
|
+
return (0, exports.toSchemaV3)({ schema: members[0], context });
|
|
99
|
+
}
|
|
92
100
|
return (0, toUnion_js_1.toUnion)({ value, members, parentType: 'anyOf', context });
|
|
93
101
|
});
|
|
94
102
|
})
|
|
@@ -100,7 +108,8 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
100
108
|
.with({ type: 'string' }, value => (0, toString_js_1.toString)({ value, context }))
|
|
101
109
|
.otherwise(value => {
|
|
102
110
|
if (possibleObject(value)) {
|
|
103
|
-
context.
|
|
111
|
+
context.logIssueNoKey({
|
|
112
|
+
level: 'warning',
|
|
104
113
|
message: 'Object has "properties" property, but is missing type="object" property',
|
|
105
114
|
parent: value,
|
|
106
115
|
type: 'MISSING_OBJECT_TYPE'
|
|
@@ -114,7 +123,8 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
114
123
|
});
|
|
115
124
|
}
|
|
116
125
|
if (possibleArray(value)) {
|
|
117
|
-
context.
|
|
126
|
+
context.logIssueNoKey({
|
|
127
|
+
level: 'warning',
|
|
118
128
|
message: 'Object has "items" property, but is missing type="array" property',
|
|
119
129
|
parent: value,
|
|
120
130
|
type: 'MISSING_ARRAY_TYPE'
|
|
@@ -129,7 +139,8 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
129
139
|
});
|
|
130
140
|
}
|
|
131
141
|
if (possibleBoolean(value)) {
|
|
132
|
-
context.
|
|
142
|
+
context.logIssueNoKey({
|
|
143
|
+
level: 'warning',
|
|
133
144
|
message: 'Object has a boolean "default" or "example" property, but is missing type="boolean" property',
|
|
134
145
|
parent: value,
|
|
135
146
|
type: 'MISSING_BOOLEAN_TYPE'
|
|
@@ -143,7 +154,8 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
143
154
|
});
|
|
144
155
|
}
|
|
145
156
|
if (possibleString(value)) {
|
|
146
|
-
context.
|
|
157
|
+
context.logIssueNoKey({
|
|
158
|
+
level: 'warning',
|
|
147
159
|
message: 'Object has a string "default" or "example" property, but is missing type="string" property',
|
|
148
160
|
parent: value,
|
|
149
161
|
type: 'MISSING_STRING_TYPE'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,mCAmCxD,CAAA;AAED,KAAK,kBAAkB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC9D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACjF,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;IAC/E,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAA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AAA;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,8DAOhE,kBAAkB,CAAC,QAAQ,CAAC,KAAG,SAAS,CAAC,QAAQ,CA0CnD,CAAA"}
|
|
@@ -74,8 +74,9 @@ const toParsedString = ({ context, nullable, example, enums, defaultValue, value
|
|
|
74
74
|
parentType: 'schema:string'
|
|
75
75
|
});
|
|
76
76
|
if (format && !v.is(string_types_js_1.stringFormat, format)) {
|
|
77
|
-
context.
|
|
77
|
+
context.logIssue({
|
|
78
78
|
key: 'format',
|
|
79
|
+
level: 'warning',
|
|
79
80
|
message: `Unexpected format: ${format}`,
|
|
80
81
|
parent: value,
|
|
81
82
|
type: 'UNEXPECTED_FORMAT'
|