@skmtc/core 0.0.808 → 0.0.810
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/types.d.ts +0 -8
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/model/toModelBase.d.ts +24 -2
- package/esm/dsl/model/toModelBase.d.ts.map +1 -1
- package/esm/dsl/model/types.d.ts +2 -2
- package/esm/dsl/operation/toOperationBase.d.ts +26 -3
- package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/types.d.ts +2 -2
- package/esm/oas/array/array-types.d.ts +238 -25
- package/esm/oas/array/array-types.d.ts.map +1 -1
- package/esm/oas/array/array-types.js +97 -5
- package/esm/oas/boolean/boolean-types.d.ts +81 -9
- package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
- package/esm/oas/boolean/boolean-types.js +32 -2
- package/esm/oas/contact/contact-types.d.ts +176 -0
- package/esm/oas/contact/contact-types.d.ts.map +1 -1
- package/esm/oas/contact/contact-types.js +102 -0
- package/esm/oas/header/Header.d.ts +8 -185
- package/esm/oas/header/Header.d.ts.map +1 -1
- package/esm/oas/header/Header.js +57 -220
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts +288 -0
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.js +272 -0
- package/esm/oas/operation/operation-types.d.ts +251 -0
- package/esm/oas/operation/operation-types.d.ts.map +1 -1
- package/esm/oas/operation/operation-types.js +98 -0
- package/esm/oas/string/string-types.d.ts +192 -18
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/string-types.js +76 -4
- package/esm/types/ModuleExport.d.ts +130 -0
- package/esm/types/ModuleExport.d.ts.map +1 -1
- package/esm/types/ModuleExport.js +36 -0
- package/esm/typescript/List.d.ts +2 -2
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +4 -4
- package/esm/typescript/toPathTemplate.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/context/types.d.ts +0 -8
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/model/toModelBase.d.ts +24 -2
- package/script/dsl/model/toModelBase.d.ts.map +1 -1
- package/script/dsl/model/types.d.ts +2 -2
- package/script/dsl/operation/toOperationBase.d.ts +26 -3
- package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
- package/script/dsl/operation/types.d.ts +2 -2
- package/script/oas/array/array-types.d.ts +238 -25
- package/script/oas/array/array-types.d.ts.map +1 -1
- package/script/oas/array/array-types.js +97 -5
- package/script/oas/boolean/boolean-types.d.ts +81 -9
- package/script/oas/boolean/boolean-types.d.ts.map +1 -1
- package/script/oas/boolean/boolean-types.js +32 -2
- package/script/oas/contact/contact-types.d.ts +176 -0
- package/script/oas/contact/contact-types.d.ts.map +1 -1
- package/script/oas/contact/contact-types.js +102 -0
- package/script/oas/header/Header.d.ts +8 -185
- package/script/oas/header/Header.d.ts.map +1 -1
- package/script/oas/header/Header.js +57 -220
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts +288 -0
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/script/oas/mediaType/toMediaTypeItemV3.js +272 -0
- package/script/oas/operation/operation-types.d.ts +251 -0
- package/script/oas/operation/operation-types.d.ts.map +1 -1
- package/script/oas/operation/operation-types.js +98 -0
- package/script/oas/string/string-types.d.ts +192 -18
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/string-types.js +76 -4
- package/script/types/ModuleExport.d.ts +130 -0
- package/script/types/ModuleExport.d.ts.map +1 -1
- package/script/types/ModuleExport.js +36 -0
- package/script/typescript/List.d.ts +2 -2
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +4 -4
- package/script/typescript/toPathTemplate.d.ts.map +1 -1
package/esm/context/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
2
1
|
import type { ManifestEntry } from '../types/Manifest.js';
|
|
3
2
|
import type { Mapping, Preview } from '../types/Preview.js';
|
|
4
3
|
import type { ResultsItem } from '../types/Results.js';
|
|
@@ -14,13 +13,6 @@ export type GetFileOptions = {
|
|
|
14
13
|
/** Whether to throw an error if the file is not found */
|
|
15
14
|
throwIfNotFound?: boolean;
|
|
16
15
|
};
|
|
17
|
-
/**
|
|
18
|
-
* Arguments for adding a generator key to the context.
|
|
19
|
-
*/
|
|
20
|
-
export type AddGeneratorKeyArgs = {
|
|
21
|
-
/** The generator key to add */
|
|
22
|
-
generatorKey: GeneratorKey;
|
|
23
|
-
};
|
|
24
16
|
/**
|
|
25
17
|
* Result of rendering files in the context.
|
|
26
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEtE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yDAAyD;IACzD,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;CACrC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,oCAAoC;IACpC,OAAO,EAAE,WAAW,CAAA;CACrB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAA;AAE3F;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,qBAAqB,GACrB,qBAAqB,GACrB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,wBAAwB,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
2
|
import type { RefName } from '../../types/RefName.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
-
import { ModelBase } from './ModelBase.js';
|
|
5
4
|
import type { Identifier } from '../Identifier.js';
|
|
6
5
|
import * as v from 'valibot';
|
|
6
|
+
import type { ModelInsertable } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Arguments for creating a model insertable instance.
|
|
9
9
|
*
|
|
@@ -17,6 +17,10 @@ export type ModelInsertableArgs<EnrichmentType = undefined> = {
|
|
|
17
17
|
/** Reference name identifying the model schema */
|
|
18
18
|
refName: RefName;
|
|
19
19
|
};
|
|
20
|
+
type ToEnrichmentsArgs = {
|
|
21
|
+
refName: RefName;
|
|
22
|
+
context: GenerateContext;
|
|
23
|
+
};
|
|
20
24
|
/**
|
|
21
25
|
* Configuration for creating a base model class.
|
|
22
26
|
*
|
|
@@ -81,5 +85,23 @@ export type BaseModelConfig<EnrichmentType = undefined> = {
|
|
|
81
85
|
* });
|
|
82
86
|
* ```
|
|
83
87
|
*/
|
|
84
|
-
export declare const toModelBase: <EnrichmentType = undefined>(config: BaseModelConfig<EnrichmentType>) =>
|
|
88
|
+
export declare const toModelBase: <EnrichmentType = undefined>(config: BaseModelConfig<EnrichmentType>) => {
|
|
89
|
+
new (args: ModelInsertableArgs<EnrichmentType>): {
|
|
90
|
+
settings: ContentSettings<EnrichmentType>;
|
|
91
|
+
refName: RefName;
|
|
92
|
+
generatorKey: import("../../mod.js").GeneratorKey;
|
|
93
|
+
insertModel<V extends import("../../mod.js").GeneratedValue, EnrichmentType_1 = undefined>(insertable: ModelInsertable<V, EnrichmentType_1>, refName: RefName, options?: Pick<import("../../mod.js").InsertModelOptions<"force">, "noExport">): import("../Inserted.js").Inserted<V, "force", EnrichmentType_1>;
|
|
94
|
+
insertNormalizedModel<V extends import("../../mod.js").GeneratedValue, Schema extends import("../../mod.js").OasSchema | import("../../mod.js").OasRef<"schema"> | import("../../mod.js").OasVoid, EnrichmentType_2 = undefined>(insertable: ModelInsertable<V, EnrichmentType_2>, { schema, fallbackName }: Omit<import("../../mod.js").InsertNormalisedModelArgs<Schema>, "destinationPath">, options?: Pick<import("../../mod.js").InsertModelOptions<"force">, "noExport">): import("../../mod.js").InsertNormalisedModelReturn<V, Schema>;
|
|
95
|
+
register(args: import("../../mod.js").BaseRegisterArgs): void;
|
|
96
|
+
context: GenerateContext;
|
|
97
|
+
skipped: boolean;
|
|
98
|
+
};
|
|
99
|
+
id: string;
|
|
100
|
+
type: "model";
|
|
101
|
+
toIdentifier: (refName: RefName) => Identifier;
|
|
102
|
+
toExportPath: (refName: RefName) => string;
|
|
103
|
+
toEnrichments: ({ refName, context }: ToEnrichmentsArgs) => EnrichmentType;
|
|
104
|
+
isSupported: () => boolean;
|
|
105
|
+
};
|
|
106
|
+
export {};
|
|
85
107
|
//# sourceMappingURL=toModelBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"toModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC5D,2EAA2E;IAC3E,OAAO,EAAE,eAAe,CAAA;IACxB,iEAAiE;IACjE,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IACzC,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,CAAC,cAAc,GAAG,SAAS,IAAI;IACxD,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,CAAA;IAC9C,6DAA6D;IAC7D,YAAY,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;IAC1C,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC9F,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,GAAI,cAAc,GAAG,SAAS,EACpD,QAAQ,eAAe,CAAC,cAAc,CAAC;eAiBnB,mBAAmB,CAAC,cAAc,CAAC;;;;;;;;;;;UAbvC,OAAO;4BA1DC,OAAO,KAAK,UAAU;4BAEtB,OAAO,KAAK,MAAM;oBA4DhB,sBAAsB,iBAAiB,KAAG,cAAc;;CAmBnF,CAAA"}
|
package/esm/dsl/model/types.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type WithTransformModel = {
|
|
|
30
30
|
/**
|
|
31
31
|
* Arguments for generating enrichment data for models.
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
33
|
+
export type ToModelEnrichmentsArgs = {
|
|
34
34
|
refName: RefName;
|
|
35
35
|
context: GenerateContext;
|
|
36
36
|
};
|
|
@@ -81,7 +81,7 @@ export type ModelInsertable<V, EnrichmentType = undefined> = {
|
|
|
81
81
|
type: 'model';
|
|
82
82
|
toIdentifier: (refName: RefName) => Identifier;
|
|
83
83
|
toExportPath: (refName: RefName) => string;
|
|
84
|
-
toEnrichments: ({ refName, context }:
|
|
84
|
+
toEnrichments: ({ refName, context }: ToModelEnrichmentsArgs) => EnrichmentType;
|
|
85
85
|
schemaToValueFn: SchemaToValueFn;
|
|
86
86
|
createIdentifier: (name: string) => Identifier;
|
|
87
87
|
} & Function;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
1
2
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
2
|
-
import { OperationBase } from './OperationBase.js';
|
|
3
3
|
import type { Identifier } from '../Identifier.js';
|
|
4
|
-
import type { OperationInsertableArgs } from './types.js';
|
|
4
|
+
import type { OperationInsertable, OperationInsertableArgs } from './types.js';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for creating a base operation class.
|
|
@@ -21,6 +21,10 @@ export type BaseOperationConfig<EnrichmentType = undefined> = {
|
|
|
21
21
|
/** Optional function to provide enrichment validation schema */
|
|
22
22
|
toEnrichmentSchema?: () => v.BaseSchema<EnrichmentType, EnrichmentType, v.BaseIssue<unknown>>;
|
|
23
23
|
};
|
|
24
|
+
type ToEnrichmentsArgs = {
|
|
25
|
+
operation: OasOperation;
|
|
26
|
+
context: GenerateContext;
|
|
27
|
+
};
|
|
24
28
|
/**
|
|
25
29
|
* Creates a base operation class constructor for generating type-safe operation artifacts.
|
|
26
30
|
*
|
|
@@ -67,5 +71,24 @@ export type BaseOperationConfig<EnrichmentType = undefined> = {
|
|
|
67
71
|
* });
|
|
68
72
|
* ```
|
|
69
73
|
*/
|
|
70
|
-
export declare const toOperationBase: <EnrichmentType = undefined>(config: BaseOperationConfig<EnrichmentType>) =>
|
|
74
|
+
export declare const toOperationBase: <EnrichmentType = undefined>(config: BaseOperationConfig<EnrichmentType>) => {
|
|
75
|
+
new (args: OperationInsertableArgs<EnrichmentType>): {
|
|
76
|
+
settings: import("../ContentSettings.js").ContentSettings<EnrichmentType>;
|
|
77
|
+
operation: OasOperation;
|
|
78
|
+
generatorKey: import("../../mod.js").GeneratorKey;
|
|
79
|
+
insertOperation<V extends import("../../mod.js").GeneratedValue, EnrichmentType_1 = undefined>(insertable: OperationInsertable<V, EnrichmentType_1>, operation: OasOperation, options?: Pick<import("../../mod.js").InsertOperationOptions<"force">, "noExport">): import("../Inserted.js").Inserted<V, "force", EnrichmentType_1>;
|
|
80
|
+
insertModel<V extends import("../../mod.js").GeneratedValue, EnrichmentType_2 = undefined>(insertable: import("../model/types.js").ModelInsertable<V, EnrichmentType_2>, refName: import("../../mod.js").RefName, options?: Pick<import("../../mod.js").InsertModelOptions<"force">, "noExport">): import("../Inserted.js").Inserted<V, "force", EnrichmentType_2>;
|
|
81
|
+
insertNormalizedModel<V extends import("../../mod.js").GeneratedValue, Schema extends import("../../mod.js").OasSchema | import("../../mod.js").OasRef<"schema"> | import("../../mod.js").OasVoid, EnrichmentType_3 = undefined>(insertable: import("../model/types.js").ModelInsertable<V, EnrichmentType_3>, { schema, fallbackName }: Omit<import("../../mod.js").InsertNormalisedModelArgs<Schema>, "destinationPath">, options?: Pick<import("../../mod.js").InsertModelOptions<"force">, "noExport">): import("../../mod.js").InsertNormalisedModelReturn<V, Schema>;
|
|
82
|
+
defineAndRegister<V extends import("../../mod.js").GeneratedValue>({ identifier, value, noExport }: Omit<import("../../mod.js").DefineAndRegisterArgs<V>, "destinationPath">): import("../Definition.js").Definition<V>;
|
|
83
|
+
register(args: import("../../mod.js").BaseRegisterArgs): void;
|
|
84
|
+
context: GenerateContext;
|
|
85
|
+
skipped: boolean;
|
|
86
|
+
};
|
|
87
|
+
id: string;
|
|
88
|
+
type: "operation";
|
|
89
|
+
toIdentifier: (operation: OasOperation) => Identifier;
|
|
90
|
+
toExportPath: (operation: OasOperation) => string;
|
|
91
|
+
toEnrichments: ({ operation, context }: ToEnrichmentsArgs) => EnrichmentType;
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
71
94
|
//# sourceMappingURL=toOperationBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAI5B;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,CAAC,cAAc,GAAG,SAAS,IAAI;IAC5D,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,uDAAuD;IACvD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAA;IACrD,wDAAwD;IACxD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,MAAM,CAAA;IACjD,gEAAgE;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;CAC9F,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,GAAG,SAAS,EACxD,QAAQ,mBAAmB,CAAC,cAAc,CAAC;eAoBvB,uBAAuB,CAAC,cAAc,CAAC;;;;;;;;;;;;;UAhB3C,WAAW;8BA/DD,YAAY,KAAK,UAAU;8BAE3B,YAAY,KAAK,MAAM;oBAkEvB,wBAAwB,iBAAiB,KAAG,cAAc;CAqBrF,CAAA"}
|
|
@@ -54,7 +54,7 @@ export type IsSupportedOperationArgs = {
|
|
|
54
54
|
/**
|
|
55
55
|
* Arguments for generating enrichment data for operations.
|
|
56
56
|
*/
|
|
57
|
-
export type
|
|
57
|
+
export type ToOperationEnrichmentsArgs = {
|
|
58
58
|
operation: OasOperation;
|
|
59
59
|
context: GenerateContext;
|
|
60
60
|
};
|
|
@@ -95,7 +95,7 @@ export type OperationInsertable<V, EnrichmentType = undefined> = {
|
|
|
95
95
|
type: 'operation';
|
|
96
96
|
toIdentifier: (operation: OasOperation) => Identifier;
|
|
97
97
|
toExportPath: (operation: OasOperation) => string;
|
|
98
|
-
toEnrichments: ({ operation, context }:
|
|
98
|
+
toEnrichments: ({ operation, context }: ToOperationEnrichmentsArgs) => EnrichmentType;
|
|
99
99
|
} & Function;
|
|
100
100
|
/**
|
|
101
101
|
* Arguments for checking if an operation is supported for generation.
|
|
@@ -4,67 +4,280 @@ import { type OasSchemaRefData } from '../ref/ref-types.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Valibot schema for validating OpenAPI array data objects.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* to handle recursive schema references
|
|
7
|
+
* This comprehensive schema validates OpenAPI array schemas according to the OpenAPI v3
|
|
8
|
+
* specification, including item type definitions, length constraints, uniqueness requirements,
|
|
9
|
+
* and enumeration values. It uses lazy evaluation to handle recursive schema references,
|
|
10
|
+
* allowing for complex nested array structures and self-referential schemas.
|
|
11
|
+
*
|
|
12
|
+
* The schema supports both direct schema definitions and reference objects for the items
|
|
13
|
+
* property, enabling flexible array type definitions that can reference other schemas
|
|
14
|
+
* in the document or define inline item types.
|
|
15
|
+
*
|
|
16
|
+
* @example Validating a simple array schema
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { oasArrayData } from '@skmtc/core/oas/array';
|
|
19
|
+
* import * as v from 'valibot';
|
|
20
|
+
*
|
|
21
|
+
* const schema = {
|
|
22
|
+
* type: 'array',
|
|
23
|
+
* items: {
|
|
24
|
+
* type: 'string'
|
|
25
|
+
* },
|
|
26
|
+
* description: 'List of user names',
|
|
27
|
+
* minItems: 1,
|
|
28
|
+
* maxItems: 100
|
|
29
|
+
* };
|
|
30
|
+
*
|
|
31
|
+
* const validated = v.parse(oasArrayData, schema);
|
|
32
|
+
* console.log(validated.minItems); // 1
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Validating array with reference items
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const refArraySchema = {
|
|
38
|
+
* type: 'array',
|
|
39
|
+
* items: {
|
|
40
|
+
* $ref: '#/components/schemas/User'
|
|
41
|
+
* },
|
|
42
|
+
* title: 'User List',
|
|
43
|
+
* uniqueItems: true,
|
|
44
|
+
* default: []
|
|
45
|
+
* };
|
|
46
|
+
*
|
|
47
|
+
* const result = v.parse(oasArrayData, refArraySchema);
|
|
48
|
+
* console.log(result.uniqueItems); // true
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Validating constrained arrays
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const constrainedArray = {
|
|
54
|
+
* type: 'array',
|
|
55
|
+
* items: { type: 'number' },
|
|
56
|
+
* minItems: 2,
|
|
57
|
+
* maxItems: 10,
|
|
58
|
+
* uniqueItems: true,
|
|
59
|
+
* enums: [[1, 2, 3], [4, 5, 6]]
|
|
60
|
+
* };
|
|
61
|
+
*
|
|
62
|
+
* const validated = v.parse(oasArrayData, constrainedArray);
|
|
63
|
+
* console.log(validated.maxItems); // 10
|
|
64
|
+
* ```
|
|
10
65
|
*/
|
|
11
66
|
export declare const oasArrayData: v.GenericSchema<OasArrayData>;
|
|
12
67
|
/**
|
|
13
68
|
* Valibot schema for array data without the items property.
|
|
14
69
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
70
|
+
* This specialized schema validates array schemas when the items property is processed
|
|
71
|
+
* separately from the main array constraints. It's commonly used during schema parsing
|
|
72
|
+
* and transformation processes where items need special handling, such as when resolving
|
|
73
|
+
* references or applying schema merging operations.
|
|
74
|
+
*
|
|
75
|
+
* This pattern is useful in multi-phase parsing where array constraints (like min/max
|
|
76
|
+
* items, uniqueness) are validated independently from the item type definitions,
|
|
77
|
+
* allowing for more flexible processing pipelines.
|
|
78
|
+
*
|
|
79
|
+
* @example Validating array constraints without items
|
|
80
|
+
* ```typescript
|
|
81
|
+
* import { oasArrayDataWithoutItems } from '@skmtc/core/oas/array';
|
|
82
|
+
* import * as v from 'valibot';
|
|
83
|
+
*
|
|
84
|
+
* const constraintsOnly = {
|
|
85
|
+
* type: 'array',
|
|
86
|
+
* title: 'Validation Rules',
|
|
87
|
+
* minItems: 1,
|
|
88
|
+
* maxItems: 50,
|
|
89
|
+
* uniqueItems: true,
|
|
90
|
+
* default: []
|
|
91
|
+
* };
|
|
92
|
+
*
|
|
93
|
+
* const validated = v.parse(oasArrayDataWithoutItems, constraintsOnly);
|
|
94
|
+
* console.log(validated.uniqueItems); // true
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @example Usage in two-phase parsing
|
|
98
|
+
* ```typescript
|
|
99
|
+
* function parseArraySchema(schema: unknown) {
|
|
100
|
+
* // Phase 1: Validate basic array structure
|
|
101
|
+
* const arrayConstraints = v.parse(oasArrayDataWithoutItems, schema);
|
|
102
|
+
*
|
|
103
|
+
* // Phase 2: Process items separately (not shown)
|
|
104
|
+
* const items = processItemsSchema((schema as any).items);
|
|
105
|
+
*
|
|
106
|
+
* return { ...arrayConstraints, items };
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
17
109
|
*/
|
|
18
110
|
export declare const oasArrayDataWithoutItems: v.GenericSchema<OasArrayDataWithoutItems>;
|
|
19
111
|
/**
|
|
20
112
|
* Data type for OpenAPI array schema objects.
|
|
21
113
|
*
|
|
22
|
-
* Represents array schemas
|
|
23
|
-
*
|
|
24
|
-
*
|
|
114
|
+
* Represents the complete structure of OpenAPI array schemas as processed by the SKMTC
|
|
115
|
+
* pipeline. This type includes all standard OpenAPI array schema properties including
|
|
116
|
+
* item type specifications, length constraints, uniqueness requirements, and metadata
|
|
117
|
+
* fields. It's used throughout the array processing pipeline for type-safe handling
|
|
118
|
+
* of array schema definitions.
|
|
119
|
+
*
|
|
120
|
+
* ## Usage in SKMTC Pipeline
|
|
121
|
+
*
|
|
122
|
+
* This type is used by:
|
|
123
|
+
* - Schema parsers to validate incoming array schema data
|
|
124
|
+
* - Array processors to transform OpenAPI schemas into OAS objects
|
|
125
|
+
* - Code generators to access array constraints and generate validation code
|
|
126
|
+
* - Type generators to create appropriate array type definitions
|
|
127
|
+
*
|
|
128
|
+
* @example Basic string array schema
|
|
129
|
+
* ```typescript
|
|
130
|
+
* import type { OasArrayData } from '@skmtc/core/oas/array';
|
|
131
|
+
*
|
|
132
|
+
* const tagListSchema: OasArrayData = {
|
|
133
|
+
* type: 'array',
|
|
134
|
+
* items: {
|
|
135
|
+
* type: 'string',
|
|
136
|
+
* minLength: 1,
|
|
137
|
+
* maxLength: 50
|
|
138
|
+
* },
|
|
139
|
+
* title: 'Tag List',
|
|
140
|
+
* description: 'Collection of tags for categorization',
|
|
141
|
+
* minItems: 0,
|
|
142
|
+
* maxItems: 20,
|
|
143
|
+
* uniqueItems: true,
|
|
144
|
+
* default: []
|
|
145
|
+
* };
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @example Array of referenced objects
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const userListSchema: OasArrayData = {
|
|
151
|
+
* type: 'array',
|
|
152
|
+
* items: {
|
|
153
|
+
* $ref: '#/components/schemas/User'
|
|
154
|
+
* },
|
|
155
|
+
* title: 'User Collection',
|
|
156
|
+
* description: 'List of user objects',
|
|
157
|
+
* minItems: 1,
|
|
158
|
+
* default: []
|
|
159
|
+
* };
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @example Complex nested array schema
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const matrixSchema: OasArrayData = {
|
|
165
|
+
* type: 'array',
|
|
166
|
+
* items: {
|
|
167
|
+
* type: 'array',
|
|
168
|
+
* items: {
|
|
169
|
+
* type: 'number'
|
|
170
|
+
* },
|
|
171
|
+
* minItems: 3,
|
|
172
|
+
* maxItems: 3
|
|
173
|
+
* },
|
|
174
|
+
* title: '3x3 Matrix',
|
|
175
|
+
* description: 'Two-dimensional number array representing a 3x3 matrix',
|
|
176
|
+
* minItems: 3,
|
|
177
|
+
* maxItems: 3
|
|
178
|
+
* };
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @example Enum array with constraints
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const statusListSchema: OasArrayData = {
|
|
184
|
+
* type: 'array',
|
|
185
|
+
* items: {
|
|
186
|
+
* type: 'string',
|
|
187
|
+
* enum: ['active', 'inactive', 'pending']
|
|
188
|
+
* },
|
|
189
|
+
* title: 'Status List',
|
|
190
|
+
* description: 'Multiple status values',
|
|
191
|
+
* uniqueItems: true,
|
|
192
|
+
* enums: [
|
|
193
|
+
* ['active'],
|
|
194
|
+
* ['active', 'pending'],
|
|
195
|
+
* ['inactive', 'pending']
|
|
196
|
+
* ]
|
|
197
|
+
* };
|
|
198
|
+
* ```
|
|
25
199
|
*/
|
|
26
200
|
export type OasArrayData = {
|
|
27
201
|
/** Type identifier (always 'array') */
|
|
28
202
|
type: 'array';
|
|
29
|
-
/** Schema definition for array items */
|
|
203
|
+
/** Schema definition for array items (can be direct schema or reference) */
|
|
30
204
|
items: OasSchemaData | OasSchemaRefData;
|
|
31
|
-
/** Human-readable title for the array */
|
|
205
|
+
/** Human-readable title for the array schema */
|
|
32
206
|
title?: string;
|
|
33
|
-
/** Detailed description
|
|
207
|
+
/** Detailed description explaining the array's purpose and contents */
|
|
34
208
|
description?: string;
|
|
35
|
-
/** Default value
|
|
209
|
+
/** Default value used when no explicit array is provided */
|
|
36
210
|
default?: unknown[];
|
|
37
|
-
/** Maximum number of items allowed */
|
|
211
|
+
/** Maximum number of items allowed in the array */
|
|
38
212
|
maxItems?: number;
|
|
39
|
-
/** Minimum number of items required */
|
|
213
|
+
/** Minimum number of items required in the array */
|
|
40
214
|
minItems?: number;
|
|
41
|
-
/** Whether all items must be unique */
|
|
215
|
+
/** Whether all items in the array must be unique */
|
|
42
216
|
uniqueItems?: boolean;
|
|
43
|
-
/** Array of valid enumeration values */
|
|
217
|
+
/** Array of valid enumeration values for the entire array */
|
|
44
218
|
enums?: unknown[];
|
|
45
219
|
};
|
|
46
220
|
/**
|
|
47
221
|
* Array schema data without the items property.
|
|
48
222
|
*
|
|
49
|
-
* Represents an array schema with all properties except the items definition.
|
|
50
|
-
*
|
|
223
|
+
* Represents an array schema with all standard properties except the items definition.
|
|
224
|
+
* This type is used during parsing phases where item schemas are processed separately
|
|
225
|
+
* from array constraints, enabling more flexible processing pipelines and better
|
|
226
|
+
* separation of concerns in complex schema transformation operations.
|
|
227
|
+
*
|
|
228
|
+
* ## Common Use Cases
|
|
229
|
+
*
|
|
230
|
+
* - **Two-phase parsing**: Validate array structure first, then process items
|
|
231
|
+
* - **Schema merging**: Combine array constraints from multiple sources
|
|
232
|
+
* - **Constraint extraction**: Extract array rules for validation generation
|
|
233
|
+
* - **Reference resolution**: Process items after resolving schema references
|
|
234
|
+
*
|
|
235
|
+
* @example Array constraints for validation
|
|
236
|
+
* ```typescript
|
|
237
|
+
* import type { OasArrayDataWithoutItems } from '@skmtc/core/oas/array';
|
|
238
|
+
*
|
|
239
|
+
* const constraintsSchema: OasArrayDataWithoutItems = {
|
|
240
|
+
* type: 'array',
|
|
241
|
+
* title: 'Validation Rules',
|
|
242
|
+
* description: 'Array with length and uniqueness constraints',
|
|
243
|
+
* minItems: 1,
|
|
244
|
+
* maxItems: 100,
|
|
245
|
+
* uniqueItems: true,
|
|
246
|
+
* default: []
|
|
247
|
+
* };
|
|
248
|
+
* ```
|
|
249
|
+
*
|
|
250
|
+
* @example Enum constraints without item types
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const enumArrayConstraints: OasArrayDataWithoutItems = {
|
|
253
|
+
* type: 'array',
|
|
254
|
+
* title: 'Option Groups',
|
|
255
|
+
* description: 'Predefined option combinations',
|
|
256
|
+
* enums: [
|
|
257
|
+
* ['option1', 'option2'],
|
|
258
|
+
* ['option3', 'option4'],
|
|
259
|
+
* ['option1', 'option3', 'option4']
|
|
260
|
+
* ],
|
|
261
|
+
* uniqueItems: true
|
|
262
|
+
* };
|
|
263
|
+
* ```
|
|
51
264
|
*/
|
|
52
265
|
export type OasArrayDataWithoutItems = {
|
|
53
266
|
/** Type identifier (always 'array') */
|
|
54
267
|
type: 'array';
|
|
55
|
-
/** Human-readable title for the array */
|
|
268
|
+
/** Human-readable title for the array schema */
|
|
56
269
|
title?: string;
|
|
57
|
-
/** Detailed description
|
|
270
|
+
/** Detailed description explaining the array's purpose and contents */
|
|
58
271
|
description?: string;
|
|
59
|
-
/** Default value
|
|
272
|
+
/** Default value used when no explicit array is provided */
|
|
60
273
|
default?: unknown[];
|
|
61
|
-
/** Maximum number of items allowed */
|
|
274
|
+
/** Maximum number of items allowed in the array */
|
|
62
275
|
maxItems?: number;
|
|
63
|
-
/** Minimum number of items required */
|
|
276
|
+
/** Minimum number of items required in the array */
|
|
64
277
|
minItems?: number;
|
|
65
|
-
/** Whether all items must be unique */
|
|
278
|
+
/** Whether all items in the array must be unique */
|
|
66
279
|
uniqueItems?: boolean;
|
|
67
|
-
/** Array of valid enumeration values */
|
|
280
|
+
/** Array of valid enumeration values for the entire array */
|
|
68
281
|
enums?: unknown[];
|
|
69
282
|
};
|
|
70
283
|
//# sourceMappingURL=array-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-types.d.ts","sourceRoot":"","sources":["../../../src/oas/array/array-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;AAE7E
|
|
1
|
+
{"version":3,"file":"array-types.d.ts","sourceRoot":"","sources":["../../../src/oas/array/array-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;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAUrD,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,aAAa,CAAC,wBAAwB,CAS7E,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,4EAA4E;IAC5E,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAAA;IACvC,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;IACnB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;CAClB,CAAA"}
|
|
@@ -4,9 +4,64 @@ import { oasSchemaRefData } from '../ref/ref-types.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Valibot schema for validating OpenAPI array data objects.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* to handle recursive schema references
|
|
7
|
+
* This comprehensive schema validates OpenAPI array schemas according to the OpenAPI v3
|
|
8
|
+
* specification, including item type definitions, length constraints, uniqueness requirements,
|
|
9
|
+
* and enumeration values. It uses lazy evaluation to handle recursive schema references,
|
|
10
|
+
* allowing for complex nested array structures and self-referential schemas.
|
|
11
|
+
*
|
|
12
|
+
* The schema supports both direct schema definitions and reference objects for the items
|
|
13
|
+
* property, enabling flexible array type definitions that can reference other schemas
|
|
14
|
+
* in the document or define inline item types.
|
|
15
|
+
*
|
|
16
|
+
* @example Validating a simple array schema
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { oasArrayData } from '@skmtc/core/oas/array';
|
|
19
|
+
* import * as v from 'valibot';
|
|
20
|
+
*
|
|
21
|
+
* const schema = {
|
|
22
|
+
* type: 'array',
|
|
23
|
+
* items: {
|
|
24
|
+
* type: 'string'
|
|
25
|
+
* },
|
|
26
|
+
* description: 'List of user names',
|
|
27
|
+
* minItems: 1,
|
|
28
|
+
* maxItems: 100
|
|
29
|
+
* };
|
|
30
|
+
*
|
|
31
|
+
* const validated = v.parse(oasArrayData, schema);
|
|
32
|
+
* console.log(validated.minItems); // 1
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Validating array with reference items
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const refArraySchema = {
|
|
38
|
+
* type: 'array',
|
|
39
|
+
* items: {
|
|
40
|
+
* $ref: '#/components/schemas/User'
|
|
41
|
+
* },
|
|
42
|
+
* title: 'User List',
|
|
43
|
+
* uniqueItems: true,
|
|
44
|
+
* default: []
|
|
45
|
+
* };
|
|
46
|
+
*
|
|
47
|
+
* const result = v.parse(oasArrayData, refArraySchema);
|
|
48
|
+
* console.log(result.uniqueItems); // true
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @example Validating constrained arrays
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const constrainedArray = {
|
|
54
|
+
* type: 'array',
|
|
55
|
+
* items: { type: 'number' },
|
|
56
|
+
* minItems: 2,
|
|
57
|
+
* maxItems: 10,
|
|
58
|
+
* uniqueItems: true,
|
|
59
|
+
* enums: [[1, 2, 3], [4, 5, 6]]
|
|
60
|
+
* };
|
|
61
|
+
*
|
|
62
|
+
* const validated = v.parse(oasArrayData, constrainedArray);
|
|
63
|
+
* console.log(validated.maxItems); // 10
|
|
64
|
+
* ```
|
|
10
65
|
*/
|
|
11
66
|
export const oasArrayData = v.object({
|
|
12
67
|
type: v.literal('array'),
|
|
@@ -22,8 +77,45 @@ export const oasArrayData = v.object({
|
|
|
22
77
|
/**
|
|
23
78
|
* Valibot schema for array data without the items property.
|
|
24
79
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
80
|
+
* This specialized schema validates array schemas when the items property is processed
|
|
81
|
+
* separately from the main array constraints. It's commonly used during schema parsing
|
|
82
|
+
* and transformation processes where items need special handling, such as when resolving
|
|
83
|
+
* references or applying schema merging operations.
|
|
84
|
+
*
|
|
85
|
+
* This pattern is useful in multi-phase parsing where array constraints (like min/max
|
|
86
|
+
* items, uniqueness) are validated independently from the item type definitions,
|
|
87
|
+
* allowing for more flexible processing pipelines.
|
|
88
|
+
*
|
|
89
|
+
* @example Validating array constraints without items
|
|
90
|
+
* ```typescript
|
|
91
|
+
* import { oasArrayDataWithoutItems } from '@skmtc/core/oas/array';
|
|
92
|
+
* import * as v from 'valibot';
|
|
93
|
+
*
|
|
94
|
+
* const constraintsOnly = {
|
|
95
|
+
* type: 'array',
|
|
96
|
+
* title: 'Validation Rules',
|
|
97
|
+
* minItems: 1,
|
|
98
|
+
* maxItems: 50,
|
|
99
|
+
* uniqueItems: true,
|
|
100
|
+
* default: []
|
|
101
|
+
* };
|
|
102
|
+
*
|
|
103
|
+
* const validated = v.parse(oasArrayDataWithoutItems, constraintsOnly);
|
|
104
|
+
* console.log(validated.uniqueItems); // true
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example Usage in two-phase parsing
|
|
108
|
+
* ```typescript
|
|
109
|
+
* function parseArraySchema(schema: unknown) {
|
|
110
|
+
* // Phase 1: Validate basic array structure
|
|
111
|
+
* const arrayConstraints = v.parse(oasArrayDataWithoutItems, schema);
|
|
112
|
+
*
|
|
113
|
+
* // Phase 2: Process items separately (not shown)
|
|
114
|
+
* const items = processItemsSchema((schema as any).items);
|
|
115
|
+
*
|
|
116
|
+
* return { ...arrayConstraints, items };
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
27
119
|
*/
|
|
28
120
|
export const oasArrayDataWithoutItems = v.object({
|
|
29
121
|
type: v.literal('array'),
|