@skmtc/core 0.0.800 → 0.0.802
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.d.ts +0 -3
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +12 -17
- package/esm/context/GenerateContext.d.ts +14 -2
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/RenderContext.d.ts +151 -2
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +185 -11
- package/esm/context/types.d.ts +30 -0
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/model/ModelBase.d.ts +1 -1
- package/esm/dsl/model/ModelBase.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.d.ts +62 -0
- package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.js +63 -1
- package/esm/dsl/model/toModelBase.d.ts +66 -0
- package/esm/dsl/model/toModelBase.d.ts.map +1 -1
- package/esm/dsl/model/toModelBase.js +46 -0
- package/esm/dsl/model/toModelEntry.d.ts +63 -0
- package/esm/dsl/model/toModelEntry.d.ts.map +1 -1
- package/esm/dsl/model/toModelEntry.js +63 -0
- package/esm/dsl/operation/OperationBase.d.ts +3 -3
- package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.d.ts +48 -0
- package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.js +49 -1
- package/esm/helpers/isEmpty.d.ts +1 -1
- package/esm/helpers/isEmpty.d.ts.map +1 -1
- package/esm/helpers/tracer.d.ts +1 -1
- package/esm/helpers/tracer.d.ts.map +1 -1
- package/esm/helpers/tracer.js +1 -1
- package/esm/mod.d.ts +51 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +51 -0
- package/esm/oas/array/array-types.d.ts +20 -11
- package/esm/oas/array/array-types.d.ts.map +1 -1
- package/esm/oas/array/array-types.js +10 -0
- package/esm/oas/array/toArray.d.ts +111 -0
- package/esm/oas/array/toArray.d.ts.map +1 -1
- package/esm/oas/array/toArray.js +115 -3
- package/esm/oas/boolean/boolean-types.d.ts +1 -7
- package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
- package/esm/oas/components/components-types.d.ts +19 -0
- package/esm/oas/components/components-types.d.ts.map +1 -0
- package/esm/oas/components/components-types.js +21 -0
- package/esm/oas/contact/contact-types.d.ts +9 -0
- package/esm/oas/contact/contact-types.d.ts.map +1 -0
- package/esm/oas/contact/contact-types.js +7 -0
- package/esm/oas/discriminator/discriminator-types.d.ts +1 -5
- package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/esm/oas/document/document-types.d.ts +16 -0
- package/esm/oas/document/document-types.d.ts.map +1 -0
- package/esm/oas/document/document-types.js +18 -0
- package/esm/oas/example/example-types.d.ts +1 -6
- package/esm/oas/example/example-types.d.ts.map +1 -1
- package/esm/oas/header/header-types.d.ts +50 -0
- package/esm/oas/header/header-types.d.ts.map +1 -0
- package/esm/oas/header/header-types.js +30 -0
- package/esm/oas/info/info-types.d.ts +14 -0
- package/esm/oas/info/info-types.d.ts.map +1 -0
- package/esm/oas/info/info-types.js +13 -0
- package/esm/oas/integer/integer-types.d.ts +3 -17
- package/esm/oas/integer/integer-types.d.ts.map +1 -1
- package/esm/oas/license/license-types.d.ts +9 -0
- package/esm/oas/license/license-types.d.ts.map +1 -0
- package/esm/oas/license/license-types.js +7 -0
- package/esm/oas/mediaType/mediaType-types.d.ts +1 -11
- package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/esm/oas/number/number-types.d.ts +2 -16
- package/esm/oas/number/number-types.d.ts.map +1 -1
- package/esm/oas/operation/operation-types.d.ts +22 -0
- package/esm/oas/operation/operation-types.d.ts.map +1 -0
- package/esm/oas/operation/operation-types.js +35 -0
- package/esm/oas/parameter/parameter-types.d.ts +3 -58
- package/esm/oas/parameter/parameter-types.d.ts.map +1 -1
- package/esm/oas/pathItem/pathItem-types.d.ts +12 -0
- package/esm/oas/pathItem/pathItem-types.d.ts.map +1 -0
- package/esm/oas/pathItem/pathItem-types.js +12 -0
- package/esm/oas/requestBody/requestBody-types.d.ts +10 -0
- package/esm/oas/requestBody/requestBody-types.d.ts.map +1 -0
- package/esm/oas/requestBody/requestBody-types.js +9 -0
- package/esm/oas/response/response-types.d.ts +12 -0
- package/esm/oas/response/response-types.d.ts.map +1 -0
- package/esm/oas/response/response-types.js +11 -0
- package/esm/oas/schema/toSchemasV3.js +2 -2
- package/esm/oas/server/toServerV3.d.ts.map +1 -1
- package/esm/oas/string/string-types.d.ts +2 -29
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/toString.d.ts +125 -1
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +119 -0
- package/esm/oas/tag/tag-types.d.ts +8 -0
- package/esm/oas/tag/tag-types.d.ts.map +1 -0
- package/esm/oas/tag/tag-types.js +8 -0
- package/esm/oas/union/union-types.d.ts +1 -12
- package/esm/oas/union/union-types.d.ts.map +1 -1
- package/esm/oas/unknown/unknown-types.d.ts +1 -7
- package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
- package/esm/types/Preview.d.ts +37 -0
- package/esm/types/Preview.d.ts.map +1 -1
- package/esm/types/Preview.js +37 -0
- package/esm/types/Settings.d.ts +35 -0
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +27 -0
- package/esm/typescript/FunctionParameter.d.ts +4 -4
- package/esm/typescript/FunctionParameter.d.ts.map +1 -1
- package/esm/typescript/List.d.ts +40 -2
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +32 -0
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +0 -3
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +12 -17
- package/script/context/GenerateContext.d.ts +14 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/RenderContext.d.ts +151 -2
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +185 -11
- package/script/context/types.d.ts +30 -0
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/model/ModelBase.d.ts +1 -1
- package/script/dsl/model/ModelBase.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.d.ts +62 -0
- package/script/dsl/model/ModelDriver.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.js +63 -1
- package/script/dsl/model/toModelBase.d.ts +66 -0
- package/script/dsl/model/toModelBase.d.ts.map +1 -1
- package/script/dsl/model/toModelBase.js +46 -0
- package/script/dsl/model/toModelEntry.d.ts +63 -0
- package/script/dsl/model/toModelEntry.d.ts.map +1 -1
- package/script/dsl/model/toModelEntry.js +63 -0
- package/script/dsl/operation/OperationBase.d.ts +3 -3
- package/script/dsl/operation/OperationBase.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.d.ts +48 -0
- package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.js +49 -1
- package/script/helpers/isEmpty.d.ts +1 -1
- package/script/helpers/isEmpty.d.ts.map +1 -1
- package/script/helpers/tracer.d.ts +1 -1
- package/script/helpers/tracer.d.ts.map +1 -1
- package/script/helpers/tracer.js +1 -1
- package/script/mod.d.ts +51 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +51 -0
- package/script/oas/array/array-types.d.ts +20 -11
- package/script/oas/array/array-types.d.ts.map +1 -1
- package/script/oas/array/array-types.js +11 -1
- package/script/oas/array/toArray.d.ts +111 -0
- package/script/oas/array/toArray.d.ts.map +1 -1
- package/script/oas/array/toArray.js +114 -2
- package/script/oas/boolean/boolean-types.d.ts +1 -7
- package/script/oas/boolean/boolean-types.d.ts.map +1 -1
- package/script/oas/components/components-types.d.ts +19 -0
- package/script/oas/components/components-types.d.ts.map +1 -0
- package/script/oas/components/components-types.js +57 -0
- package/script/oas/contact/contact-types.d.ts +9 -0
- package/script/oas/contact/contact-types.d.ts.map +1 -0
- package/script/oas/contact/contact-types.js +43 -0
- package/script/oas/discriminator/discriminator-types.d.ts +1 -5
- package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/script/oas/document/document-types.d.ts +16 -0
- package/script/oas/document/document-types.d.ts.map +1 -0
- package/script/oas/document/document-types.js +54 -0
- package/script/oas/example/example-types.d.ts +1 -6
- package/script/oas/example/example-types.d.ts.map +1 -1
- package/script/oas/header/header-types.d.ts +50 -0
- package/script/oas/header/header-types.d.ts.map +1 -0
- package/script/oas/header/header-types.js +66 -0
- package/script/oas/info/info-types.d.ts +14 -0
- package/script/oas/info/info-types.d.ts.map +1 -0
- package/script/oas/info/info-types.js +49 -0
- package/script/oas/integer/integer-types.d.ts +3 -17
- package/script/oas/integer/integer-types.d.ts.map +1 -1
- package/script/oas/license/license-types.d.ts +9 -0
- package/script/oas/license/license-types.d.ts.map +1 -0
- package/script/oas/license/license-types.js +43 -0
- package/script/oas/mediaType/mediaType-types.d.ts +1 -11
- package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/script/oas/number/number-types.d.ts +2 -16
- package/script/oas/number/number-types.d.ts.map +1 -1
- package/script/oas/operation/operation-types.d.ts +22 -0
- package/script/oas/operation/operation-types.d.ts.map +1 -0
- package/script/oas/operation/operation-types.js +71 -0
- package/script/oas/parameter/parameter-types.d.ts +3 -58
- package/script/oas/parameter/parameter-types.d.ts.map +1 -1
- package/script/oas/pathItem/pathItem-types.d.ts +12 -0
- package/script/oas/pathItem/pathItem-types.d.ts.map +1 -0
- package/script/oas/pathItem/pathItem-types.js +48 -0
- package/script/oas/requestBody/requestBody-types.d.ts +10 -0
- package/script/oas/requestBody/requestBody-types.d.ts.map +1 -0
- package/script/oas/requestBody/requestBody-types.js +45 -0
- package/script/oas/response/response-types.d.ts +12 -0
- package/script/oas/response/response-types.d.ts.map +1 -0
- package/script/oas/response/response-types.js +47 -0
- package/script/oas/schema/toSchemasV3.js +2 -2
- package/script/oas/server/toServerV3.d.ts.map +1 -1
- package/script/oas/string/string-types.d.ts +2 -29
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/toString.d.ts +125 -1
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +119 -0
- package/script/oas/tag/tag-types.d.ts +8 -0
- package/script/oas/tag/tag-types.d.ts.map +1 -0
- package/script/oas/tag/tag-types.js +44 -0
- package/script/oas/union/union-types.d.ts +1 -12
- package/script/oas/union/union-types.d.ts.map +1 -1
- package/script/oas/unknown/unknown-types.d.ts +1 -7
- package/script/oas/unknown/unknown-types.d.ts.map +1 -1
- package/script/types/Preview.d.ts +37 -0
- package/script/types/Preview.d.ts.map +1 -1
- package/script/types/Preview.js +37 -0
- package/script/types/Settings.d.ts +35 -0
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +27 -0
- package/script/typescript/FunctionParameter.d.ts +4 -4
- package/script/typescript/FunctionParameter.d.ts.map +1 -1
- package/script/typescript/List.d.ts +40 -2
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +32 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.oasPathItemData = void 0;
|
|
37
|
+
const markdown_types_js_1 = require("../markdown/markdown-types.js");
|
|
38
|
+
const parameter_types_js_1 = require("../parameter/parameter-types.js");
|
|
39
|
+
const ref_types_js_1 = require("../ref/ref-types.js");
|
|
40
|
+
const v = __importStar(require("valibot"));
|
|
41
|
+
exports.oasPathItemData = v.object({
|
|
42
|
+
oasType: v.literal('pathItem'),
|
|
43
|
+
$ref: v.optional(v.string()),
|
|
44
|
+
summary: v.optional(v.string()),
|
|
45
|
+
description: v.optional(markdown_types_js_1.markdown),
|
|
46
|
+
// servers: z.array(server).optional(),
|
|
47
|
+
parameters: v.optional(v.array(v.union([parameter_types_js_1.oasParameterData, ref_types_js_1.oasParameterRefData])))
|
|
48
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type OasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
export type OasRequestBodyData = {
|
|
4
|
+
oasType: 'requestBody';
|
|
5
|
+
description?: string;
|
|
6
|
+
content: Record<string, OasMediaTypeData>;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const oasRequestBodyData: v.GenericSchema<OasRequestBodyData>;
|
|
10
|
+
//# sourceMappingURL=requestBody-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestBody-types.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/requestBody-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,aAAa,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,aAAa,CAAC,kBAAkB,CAKjE,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.oasRequestBodyData = void 0;
|
|
37
|
+
const markdown_types_js_1 = require("../markdown/markdown-types.js");
|
|
38
|
+
const mediaType_types_js_1 = require("../mediaType/mediaType-types.js");
|
|
39
|
+
const v = __importStar(require("valibot"));
|
|
40
|
+
exports.oasRequestBodyData = v.object({
|
|
41
|
+
oasType: v.literal('requestBody'),
|
|
42
|
+
description: v.optional(markdown_types_js_1.markdown),
|
|
43
|
+
content: v.record(v.string(), mediaType_types_js_1.oasMediaTypeData),
|
|
44
|
+
required: v.optional(v.boolean())
|
|
45
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type OasHeaderData } from '../header/header-types.js';
|
|
2
|
+
import { type OasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
3
|
+
import { type OasHeaderRefData } from '../ref/ref-types.js';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
export type OasResponseData = {
|
|
6
|
+
oasType: 'response';
|
|
7
|
+
description: string;
|
|
8
|
+
headers?: Record<string, OasHeaderData | OasHeaderRefData>;
|
|
9
|
+
content?: Record<string, OasMediaTypeData>;
|
|
10
|
+
};
|
|
11
|
+
export declare const oasResponseData: v.GenericSchema<OasResponseData>;
|
|
12
|
+
//# sourceMappingURL=response-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-types.d.ts","sourceRoot":"","sources":["../../../src/oas/response/response-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,UAAU,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAE3C,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAM3D,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.oasResponseData = void 0;
|
|
37
|
+
const header_types_js_1 = require("../header/header-types.js");
|
|
38
|
+
const mediaType_types_js_1 = require("../mediaType/mediaType-types.js");
|
|
39
|
+
const ref_types_js_1 = require("../ref/ref-types.js");
|
|
40
|
+
const v = __importStar(require("valibot"));
|
|
41
|
+
exports.oasResponseData = v.object({
|
|
42
|
+
oasType: v.literal('response'),
|
|
43
|
+
description: v.string(),
|
|
44
|
+
headers: v.optional(v.record(v.string(), v.union([header_types_js_1.oasHeaderData, ref_types_js_1.oasHeaderRefData]))),
|
|
45
|
+
content: v.optional(v.record(v.string(), mediaType_types_js_1.oasMediaTypeData))
|
|
46
|
+
// links: z.record(z.union([link, ref])).optional()
|
|
47
|
+
});
|
|
@@ -88,8 +88,8 @@ const toSchemaV3 = ({ schema, context }) => {
|
|
|
88
88
|
})
|
|
89
89
|
.with({ anyOf: ts_pattern_1.P.array() }, matched => {
|
|
90
90
|
return context.trace('anyOf', () => {
|
|
91
|
-
const
|
|
92
|
-
const
|
|
91
|
+
const _lastThree = context.stackTrail.slice(-3).toString();
|
|
92
|
+
const _lastFive = context.stackTrail.slice(-5).toString();
|
|
93
93
|
// deno-lint-ignore ban-ts-comment
|
|
94
94
|
// @ts-expect-error
|
|
95
95
|
if (matched['x-expansionResources']) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toServerV3.d.ts","sourceRoot":"","sources":["../../../src/oas/server/toServerV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"toServerV3.d.ts","sourceRoot":"","sources":["../../../src/oas/server/toServerV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,CAAA;IACjC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,sBAAsB,eAAe,KAAG,SAAS,EAI5E,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,SAAS,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,sBAGjC,uBAAuB,KAAG,SAAS,EAAE,GAAG,SAM1C,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAA;IAC9B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,qBAAqB,cAAc,KAAG,SAgBhE,CAAA"}
|
|
@@ -13,41 +13,14 @@ export type StringFormat = 'date-time' | 'time' | 'date' | 'duration' | 'email'
|
|
|
13
13
|
* Defines the standard string formats supported by OpenAPI v3,
|
|
14
14
|
* including date/time formats, network formats, and encoding formats.
|
|
15
15
|
*/
|
|
16
|
-
export declare const stringFormat: v.
|
|
17
|
-
readonly 'date-time': "date-time";
|
|
18
|
-
readonly time: "time";
|
|
19
|
-
readonly date: "date";
|
|
20
|
-
readonly duration: "duration";
|
|
21
|
-
readonly email: "email";
|
|
22
|
-
readonly hostname: "hostname";
|
|
23
|
-
readonly ipv4: "ipv4";
|
|
24
|
-
readonly ipv6: "ipv6";
|
|
25
|
-
readonly uuid: "uuid";
|
|
26
|
-
readonly uri: "uri";
|
|
27
|
-
readonly regex: "regex";
|
|
28
|
-
readonly password: "password";
|
|
29
|
-
readonly byte: "byte";
|
|
30
|
-
readonly binary: "binary";
|
|
31
|
-
}, undefined>;
|
|
16
|
+
export declare const stringFormat: v.GenericSchema<StringFormat>;
|
|
32
17
|
/**
|
|
33
18
|
* Valibot schema for validating OpenAPI string data objects.
|
|
34
19
|
*
|
|
35
20
|
* Validates string schema objects including length constraints,
|
|
36
21
|
* pattern validation, format specifiers, and enumeration values.
|
|
37
22
|
*/
|
|
38
|
-
export declare const oasStringData: v.
|
|
39
|
-
readonly type: v.LiteralSchema<"string", undefined>;
|
|
40
|
-
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
41
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
42
|
-
readonly default: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
43
|
-
readonly maxLength: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
44
|
-
readonly minLength: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
45
|
-
readonly pattern: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
46
|
-
readonly enum: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
47
|
-
readonly format: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
48
|
-
readonly nullable: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
49
|
-
readonly example: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
50
|
-
}, undefined>;
|
|
23
|
+
export declare const oasStringData: v.GenericSchema<OasStringData>;
|
|
51
24
|
/**
|
|
52
25
|
* Data type for OpenAPI string schema objects.
|
|
53
26
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,OAAO,GACP,UAAU,GACV,MAAM,GACN,QAAQ,CAAA;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,OAAO,GACP,UAAU,GACV,MAAM,GACN,QAAQ,CAAA;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAerD,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAYvD,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,IAAI,EAAE,QAAQ,CAAA;IACd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
|
@@ -1,11 +1,75 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import type { ParseContext } from '../../context/ParseContext.js';
|
|
3
3
|
import { OasString } from './String.js';
|
|
4
|
+
/**
|
|
5
|
+
* Arguments for transforming an OpenAPI string schema into OAS representation.
|
|
6
|
+
*/
|
|
4
7
|
type ToStringArgs = {
|
|
8
|
+
/** The OpenAPI v3 schema object to transform (must be type 'string') */
|
|
5
9
|
value: OpenAPIV3.SchemaObject;
|
|
10
|
+
/** Parse context providing utilities and tracing capabilities */
|
|
6
11
|
context: ParseContext;
|
|
7
12
|
};
|
|
8
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Transforms an OpenAPI v3 string schema object into an internal OAS string representation.
|
|
15
|
+
*
|
|
16
|
+
* This function processes OpenAPI string schemas by extracting and parsing nullable values,
|
|
17
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
18
|
+
* raw OpenAPI JSON to the SKMTC internal string representation with proper validation
|
|
19
|
+
* of string formats and constraints.
|
|
20
|
+
*
|
|
21
|
+
* The transformation follows a pipeline approach:
|
|
22
|
+
* 1. Parse nullable flag and extract base value
|
|
23
|
+
* 2. Parse example values with nullable support
|
|
24
|
+
* 3. Parse enumeration constraints
|
|
25
|
+
* 4. Parse default values
|
|
26
|
+
* 5. Create final OasString instance with format validation
|
|
27
|
+
*
|
|
28
|
+
* @param args - Transformation arguments
|
|
29
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
30
|
+
* @param args.value - The OpenAPI v3 string schema object to transform
|
|
31
|
+
* @returns Transformed OAS string object with parsed properties
|
|
32
|
+
*
|
|
33
|
+
* @example Basic string transformation
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { toString } from '@skmtc/core';
|
|
36
|
+
*
|
|
37
|
+
* const openApiString = {
|
|
38
|
+
* type: 'string',
|
|
39
|
+
* format: 'email',
|
|
40
|
+
* maxLength: 255,
|
|
41
|
+
* pattern: '^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$'
|
|
42
|
+
* };
|
|
43
|
+
*
|
|
44
|
+
* const oasString = toString({
|
|
45
|
+
* context: parseContext,
|
|
46
|
+
* value: openApiString
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* console.log(oasString.format); // 'email'
|
|
50
|
+
* console.log(oasString.maxLength); // 255
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @example String with nullable and enums
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const statusString = {
|
|
56
|
+
* type: 'string',
|
|
57
|
+
* nullable: true,
|
|
58
|
+
* enum: ['active', 'inactive', 'pending', null],
|
|
59
|
+
* default: 'active',
|
|
60
|
+
* example: 'pending'
|
|
61
|
+
* };
|
|
62
|
+
*
|
|
63
|
+
* const oasString = toString({
|
|
64
|
+
* context: parseContext,
|
|
65
|
+
* value: statusString
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* console.log(oasString.nullable); // true
|
|
69
|
+
* console.log(oasString.enums); // ['active', 'inactive', 'pending', null]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare const toString: ({ context, value }: ToStringArgs) => OasString;
|
|
9
73
|
type ToParsedStringArgs<Nullable extends boolean | undefined> = {
|
|
10
74
|
value: Omit<OpenAPIV3.SchemaObject, 'nullable' | 'example' | 'enums' | 'default'>;
|
|
11
75
|
context: ParseContext;
|
|
@@ -14,6 +78,66 @@ type ToParsedStringArgs<Nullable extends boolean | undefined> = {
|
|
|
14
78
|
enums: Nullable extends true ? (string | null)[] | undefined : string[] | undefined;
|
|
15
79
|
defaultValue: Nullable extends true ? string | null | undefined : string | undefined;
|
|
16
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Creates an OAS string instance from pre-parsed string schema components.
|
|
83
|
+
*
|
|
84
|
+
* This function is the final step in the string transformation pipeline, taking
|
|
85
|
+
* already-parsed nullable, example, enum, and default values and combining them
|
|
86
|
+
* with the remaining string properties to create the complete OasString instance.
|
|
87
|
+
*
|
|
88
|
+
* The function handles format validation against known OpenAPI string formats,
|
|
89
|
+
* length constraints parsing, pattern validation, and specification extension
|
|
90
|
+
* processing. It logs warnings for unrecognized formats while still preserving
|
|
91
|
+
* them in the output.
|
|
92
|
+
*
|
|
93
|
+
* @template Nullable - Boolean type indicating if the string can be null
|
|
94
|
+
* @param args - Pre-parsed string components
|
|
95
|
+
* @param args.context - Parse context for tracing and issue logging
|
|
96
|
+
* @param args.nullable - Parsed nullable flag
|
|
97
|
+
* @param args.example - Parsed example value (type-safe with nullable)
|
|
98
|
+
* @param args.enums - Parsed enumeration constraints (type-safe with nullable)
|
|
99
|
+
* @param args.defaultValue - Parsed default value (type-safe with nullable)
|
|
100
|
+
* @param args.value - OpenAPI string object without parsed fields
|
|
101
|
+
* @returns Complete OAS string instance with all properties and validation
|
|
102
|
+
*
|
|
103
|
+
* @example Date-time string with validation
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const dateTimeString = toParsedString({
|
|
106
|
+
* context: parseContext,
|
|
107
|
+
* nullable: false,
|
|
108
|
+
* example: '2023-12-25T10:00:00Z',
|
|
109
|
+
* enums: undefined,
|
|
110
|
+
* defaultValue: undefined,
|
|
111
|
+
* value: {
|
|
112
|
+
* type: 'string',
|
|
113
|
+
* format: 'date-time',
|
|
114
|
+
* title: 'Event Date',
|
|
115
|
+
* description: 'When the event occurs'
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
*
|
|
119
|
+
* console.log(dateTimeString.format); // 'date-time'
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @example String with custom format (generates warning)
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const customFormatString = toParsedString({
|
|
125
|
+
* context: parseContext,
|
|
126
|
+
* nullable: false,
|
|
127
|
+
* example: 'ABC123',
|
|
128
|
+
* enums: undefined,
|
|
129
|
+
* defaultValue: undefined,
|
|
130
|
+
* value: {
|
|
131
|
+
* type: 'string',
|
|
132
|
+
* format: 'custom-id', // Unknown format, will log warning
|
|
133
|
+
* pattern: '^[A-Z]{3}[0-9]{3}$'
|
|
134
|
+
* }
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // Logs: "Unexpected format: custom-id"
|
|
138
|
+
* console.log(customFormatString.format); // 'custom-id' (still preserved)
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
17
141
|
export declare const toParsedString: <Nullable extends boolean | undefined>({ context, nullable, example, enums, defaultValue, value }: ToParsedStringArgs<Nullable>) => OasString<Nullable>;
|
|
18
142
|
export {};
|
|
19
143
|
//# sourceMappingURL=toString.d.ts.map
|
|
@@ -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,GAAI,oBAAoB,YAAY,
|
|
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;;GAEG;AACH,KAAK,YAAY,GAAG;IAClB,wEAAwE;IACxE,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,iEAAiE;IACjE,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,QAAQ,GAAI,oBAAoB,YAAY,KAAG,SAmC3D,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,SAAS,CAAA;IACnF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;CACrF,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,EAAE,4DAOlE,kBAAkB,CAAC,QAAQ,CAAC,KAAG,SAAS,CAAC,QAAQ,CA0CnD,CAAA"}
|
|
@@ -42,6 +42,65 @@ const parseNullable_js_1 = require("../_helpers/parseNullable.js");
|
|
|
42
42
|
const parseExample_js_1 = require("../_helpers/parseExample.js");
|
|
43
43
|
const parseEnum_js_1 = require("../_helpers/parseEnum.js");
|
|
44
44
|
const parseDefault_js_1 = require("../_helpers/parseDefault.js");
|
|
45
|
+
/**
|
|
46
|
+
* Transforms an OpenAPI v3 string schema object into an internal OAS string representation.
|
|
47
|
+
*
|
|
48
|
+
* This function processes OpenAPI string schemas by extracting and parsing nullable values,
|
|
49
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
50
|
+
* raw OpenAPI JSON to the SKMTC internal string representation with proper validation
|
|
51
|
+
* of string formats and constraints.
|
|
52
|
+
*
|
|
53
|
+
* The transformation follows a pipeline approach:
|
|
54
|
+
* 1. Parse nullable flag and extract base value
|
|
55
|
+
* 2. Parse example values with nullable support
|
|
56
|
+
* 3. Parse enumeration constraints
|
|
57
|
+
* 4. Parse default values
|
|
58
|
+
* 5. Create final OasString instance with format validation
|
|
59
|
+
*
|
|
60
|
+
* @param args - Transformation arguments
|
|
61
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
62
|
+
* @param args.value - The OpenAPI v3 string schema object to transform
|
|
63
|
+
* @returns Transformed OAS string object with parsed properties
|
|
64
|
+
*
|
|
65
|
+
* @example Basic string transformation
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { toString } from '@skmtc/core';
|
|
68
|
+
*
|
|
69
|
+
* const openApiString = {
|
|
70
|
+
* type: 'string',
|
|
71
|
+
* format: 'email',
|
|
72
|
+
* maxLength: 255,
|
|
73
|
+
* pattern: '^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$'
|
|
74
|
+
* };
|
|
75
|
+
*
|
|
76
|
+
* const oasString = toString({
|
|
77
|
+
* context: parseContext,
|
|
78
|
+
* value: openApiString
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* console.log(oasString.format); // 'email'
|
|
82
|
+
* console.log(oasString.maxLength); // 255
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example String with nullable and enums
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const statusString = {
|
|
88
|
+
* type: 'string',
|
|
89
|
+
* nullable: true,
|
|
90
|
+
* enum: ['active', 'inactive', 'pending', null],
|
|
91
|
+
* default: 'active',
|
|
92
|
+
* example: 'pending'
|
|
93
|
+
* };
|
|
94
|
+
*
|
|
95
|
+
* const oasString = toString({
|
|
96
|
+
* context: parseContext,
|
|
97
|
+
* value: statusString
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* console.log(oasString.nullable); // true
|
|
101
|
+
* console.log(oasString.enums); // ['active', 'inactive', 'pending', null]
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
45
104
|
const toString = ({ context, value }) => {
|
|
46
105
|
const { nullable, value: valueWithoutNullable } = (0, parseNullable_js_1.parseNullable)({
|
|
47
106
|
value,
|
|
@@ -75,6 +134,66 @@ const toString = ({ context, value }) => {
|
|
|
75
134
|
});
|
|
76
135
|
};
|
|
77
136
|
exports.toString = toString;
|
|
137
|
+
/**
|
|
138
|
+
* Creates an OAS string instance from pre-parsed string schema components.
|
|
139
|
+
*
|
|
140
|
+
* This function is the final step in the string transformation pipeline, taking
|
|
141
|
+
* already-parsed nullable, example, enum, and default values and combining them
|
|
142
|
+
* with the remaining string properties to create the complete OasString instance.
|
|
143
|
+
*
|
|
144
|
+
* The function handles format validation against known OpenAPI string formats,
|
|
145
|
+
* length constraints parsing, pattern validation, and specification extension
|
|
146
|
+
* processing. It logs warnings for unrecognized formats while still preserving
|
|
147
|
+
* them in the output.
|
|
148
|
+
*
|
|
149
|
+
* @template Nullable - Boolean type indicating if the string can be null
|
|
150
|
+
* @param args - Pre-parsed string components
|
|
151
|
+
* @param args.context - Parse context for tracing and issue logging
|
|
152
|
+
* @param args.nullable - Parsed nullable flag
|
|
153
|
+
* @param args.example - Parsed example value (type-safe with nullable)
|
|
154
|
+
* @param args.enums - Parsed enumeration constraints (type-safe with nullable)
|
|
155
|
+
* @param args.defaultValue - Parsed default value (type-safe with nullable)
|
|
156
|
+
* @param args.value - OpenAPI string object without parsed fields
|
|
157
|
+
* @returns Complete OAS string instance with all properties and validation
|
|
158
|
+
*
|
|
159
|
+
* @example Date-time string with validation
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const dateTimeString = toParsedString({
|
|
162
|
+
* context: parseContext,
|
|
163
|
+
* nullable: false,
|
|
164
|
+
* example: '2023-12-25T10:00:00Z',
|
|
165
|
+
* enums: undefined,
|
|
166
|
+
* defaultValue: undefined,
|
|
167
|
+
* value: {
|
|
168
|
+
* type: 'string',
|
|
169
|
+
* format: 'date-time',
|
|
170
|
+
* title: 'Event Date',
|
|
171
|
+
* description: 'When the event occurs'
|
|
172
|
+
* }
|
|
173
|
+
* });
|
|
174
|
+
*
|
|
175
|
+
* console.log(dateTimeString.format); // 'date-time'
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @example String with custom format (generates warning)
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const customFormatString = toParsedString({
|
|
181
|
+
* context: parseContext,
|
|
182
|
+
* nullable: false,
|
|
183
|
+
* example: 'ABC123',
|
|
184
|
+
* enums: undefined,
|
|
185
|
+
* defaultValue: undefined,
|
|
186
|
+
* value: {
|
|
187
|
+
* type: 'string',
|
|
188
|
+
* format: 'custom-id', // Unknown format, will log warning
|
|
189
|
+
* pattern: '^[A-Z]{3}[0-9]{3}$'
|
|
190
|
+
* }
|
|
191
|
+
* });
|
|
192
|
+
*
|
|
193
|
+
* // Logs: "Unexpected format: custom-id"
|
|
194
|
+
* console.log(customFormatString.format); // 'custom-id' (still preserved)
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
78
197
|
const toParsedString = ({ context, nullable, example, enums, defaultValue, value }) => {
|
|
79
198
|
const { type: _type, title, description, format, maxLength, minLength, pattern, ...skipped } = v.parse(string_types_js_1.oasStringData, value);
|
|
80
199
|
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-types.d.ts","sourceRoot":"","sources":["../../../src/oas/tag/tag-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,KAAK,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CAKjD,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.oasTagData = void 0;
|
|
37
|
+
const markdown_types_js_1 = require("../markdown/markdown-types.js");
|
|
38
|
+
const v = __importStar(require("valibot"));
|
|
39
|
+
exports.oasTagData = v.object({
|
|
40
|
+
oasType: v.literal('tag'),
|
|
41
|
+
name: v.string(),
|
|
42
|
+
description: v.optional(markdown_types_js_1.markdown)
|
|
43
|
+
// externalDocs: externalDocs.optional()
|
|
44
|
+
});
|
|
@@ -30,16 +30,5 @@ export type OasUnionData = {
|
|
|
30
30
|
* discriminator properties. Uses lazy evaluation to handle recursive
|
|
31
31
|
* schema references in union members.
|
|
32
32
|
*/
|
|
33
|
-
export declare const oasUnionData: v.
|
|
34
|
-
readonly oasType: v.LiteralSchema<"schema", undefined>;
|
|
35
|
-
readonly type: v.LiteralSchema<"union", undefined>;
|
|
36
|
-
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
37
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
38
|
-
readonly members: v.LazySchema<v.ArraySchema<v.UnionSchema<[v.GenericSchema<OasSchemaData>, v.GenericSchema<OasSchemaRefData>], undefined>, undefined>>;
|
|
39
|
-
readonly discriminator: v.OptionalSchema<v.ObjectSchema<{
|
|
40
|
-
readonly oasType: v.LiteralSchema<"discriminator", undefined>;
|
|
41
|
-
readonly propertyName: v.StringSchema<undefined>;
|
|
42
|
-
readonly mapping: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
43
|
-
}, undefined>, undefined>;
|
|
44
|
-
}, undefined>;
|
|
33
|
+
export declare const oasUnionData: v.GenericSchema<OasUnionData>;
|
|
45
34
|
//# sourceMappingURL=union-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union-types.d.ts","sourceRoot":"","sources":["../../../src/oas/union/union-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,yCAAyC,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,kDAAkD;IAClD,OAAO,EAAE,QAAQ,CAAA;IACjB,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,OAAO,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC7C,2DAA2D;IAC3D,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"union-types.d.ts","sourceRoot":"","sources":["../../../src/oas/union/union-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,yCAAyC,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,kDAAkD;IAClD,OAAO,EAAE,QAAQ,CAAA;IACjB,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,OAAO,EAAE,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAA;IAC7C,2DAA2D;IAC3D,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAOrD,CAAA"}
|
|
@@ -5,13 +5,7 @@ import * as v from 'valibot';
|
|
|
5
5
|
* Validates unknown/unspecified schemas used as fallbacks when
|
|
6
6
|
* schema types cannot be determined or for flexible data handling.
|
|
7
7
|
*/
|
|
8
|
-
export declare const oasUnknownData: v.
|
|
9
|
-
readonly oasType: v.LiteralSchema<"schema", undefined>;
|
|
10
|
-
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
11
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
12
|
-
readonly default: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
13
|
-
readonly type: v.LiteralSchema<"unknown", undefined>;
|
|
14
|
-
}, undefined>;
|
|
8
|
+
export declare const oasUnknownData: v.GenericSchema<OasUnknownData>;
|
|
15
9
|
/**
|
|
16
10
|
* Data type for OpenAPI unknown schema objects.
|
|
17
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown-types.d.ts","sourceRoot":"","sources":["../../../src/oas/unknown/unknown-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"unknown-types.d.ts","sourceRoot":"","sources":["../../../src/oas/unknown/unknown-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAMzD,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,kDAAkD;IAClD,OAAO,EAAE,QAAQ,CAAA;IACjB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA"}
|