@skmtc/core 0.0.799 → 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 +35 -3
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +21 -1
- package/esm/context/ParseContext.d.ts +64 -3
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +61 -0
- 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/ResultsHandler.d.ts +10 -3
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- 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/model/types.d.ts +51 -4
- package/esm/dsl/model/types.d.ts.map +1 -1
- 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/dsl/operation/types.d.ts +61 -3
- package/esm/dsl/operation/types.d.ts.map +1 -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.d.ts +47 -2
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +43 -0
- 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/ref/Ref.d.ts +49 -2
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +28 -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 +104 -5
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +75 -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 +35 -3
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +21 -1
- package/script/context/ParseContext.d.ts +64 -3
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +61 -0
- 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/ResultsHandler.d.ts +10 -3
- package/script/context/ResultsHandler.d.ts.map +1 -1
- 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/model/types.d.ts +51 -4
- package/script/dsl/model/types.d.ts.map +1 -1
- 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/dsl/operation/types.d.ts +61 -3
- package/script/dsl/operation/types.d.ts.map +1 -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.d.ts +47 -2
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +43 -0
- 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/ref/Ref.d.ts +49 -2
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +28 -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 +104 -5
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +75 -0
|
@@ -5,6 +5,65 @@ type ToArrayArgs = {
|
|
|
5
5
|
value: OpenAPIV3.ArraySchemaObject;
|
|
6
6
|
context: ParseContext;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Transforms an OpenAPI v3 array schema object into an internal OAS array representation.
|
|
10
|
+
*
|
|
11
|
+
* This function processes OpenAPI array schemas by extracting and parsing nullable values,
|
|
12
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
13
|
+
* raw OpenAPI JSON to the SKMTC internal array representation with proper type safety.
|
|
14
|
+
*
|
|
15
|
+
* The transformation follows a pipeline approach:
|
|
16
|
+
* 1. Parse nullable flag and extract base value
|
|
17
|
+
* 2. Parse example values with nullable support
|
|
18
|
+
* 3. Parse enumeration constraints
|
|
19
|
+
* 4. Parse default values
|
|
20
|
+
* 5. Create final OasArray instance
|
|
21
|
+
*
|
|
22
|
+
* @param args - Transformation arguments
|
|
23
|
+
* @param args.value - The OpenAPI v3 array schema object to transform
|
|
24
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
25
|
+
* @returns Transformed OAS array object with parsed properties
|
|
26
|
+
*
|
|
27
|
+
* @example Basic array transformation
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { toArray } from '@skmtc/core';
|
|
30
|
+
*
|
|
31
|
+
* const openApiArray = {
|
|
32
|
+
* type: 'array',
|
|
33
|
+
* items: { type: 'string' },
|
|
34
|
+
* maxItems: 10,
|
|
35
|
+
* uniqueItems: true
|
|
36
|
+
* };
|
|
37
|
+
*
|
|
38
|
+
* const oasArray = toArray({
|
|
39
|
+
* value: openApiArray,
|
|
40
|
+
* context: parseContext
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* console.log(oasArray.maxItems); // 10
|
|
44
|
+
* console.log(oasArray.uniqueItems); // true
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Array with nullable and examples
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const complexArray = {
|
|
50
|
+
* type: 'array',
|
|
51
|
+
* items: { type: 'number' },
|
|
52
|
+
* nullable: true,
|
|
53
|
+
* example: [1, 2, 3],
|
|
54
|
+
* default: [],
|
|
55
|
+
* enum: [[1, 2], [3, 4], null]
|
|
56
|
+
* };
|
|
57
|
+
*
|
|
58
|
+
* const oasArray = toArray({
|
|
59
|
+
* value: complexArray,
|
|
60
|
+
* context: parseContext
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* console.log(oasArray.nullable); // true
|
|
64
|
+
* console.log(oasArray.example); // [1, 2, 3]
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
8
67
|
export declare const toArray: ({ value, context }: ToArrayArgs) => OasArray;
|
|
9
68
|
type ToParsedArrayArgs<Nullable extends boolean | undefined> = {
|
|
10
69
|
value: Omit<OpenAPIV3.ArraySchemaObject, 'nullable' | 'example' | 'enums' | 'default'>;
|
|
@@ -14,6 +73,58 @@ type ToParsedArrayArgs<Nullable extends boolean | undefined> = {
|
|
|
14
73
|
enums: Nullable extends true ? (unknown[] | null)[] | undefined : unknown[] | undefined;
|
|
15
74
|
defaultValue: Nullable extends true ? unknown[] | null | undefined : unknown[] | undefined;
|
|
16
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Creates an OAS array instance from pre-parsed array schema components.
|
|
78
|
+
*
|
|
79
|
+
* This function is the final step in the array transformation pipeline, taking
|
|
80
|
+
* already-parsed nullable, example, enum, and default values and combining them
|
|
81
|
+
* with the remaining array properties to create the complete OasArray instance.
|
|
82
|
+
*
|
|
83
|
+
* The function handles type-safe nullable parsing, items schema resolution,
|
|
84
|
+
* and specification extension processing. It uses Valibot for schema validation
|
|
85
|
+
* and maintains proper type relationships between nullable flags and value types.
|
|
86
|
+
*
|
|
87
|
+
* @template Nullable - Boolean type indicating if the array can be null
|
|
88
|
+
* @param args - Pre-parsed array components
|
|
89
|
+
* @param args.value - OpenAPI array object without parsed fields
|
|
90
|
+
* @param args.context - Parse context for tracing and utilities
|
|
91
|
+
* @param args.nullable - Parsed nullable flag
|
|
92
|
+
* @param args.example - Parsed example value (type-safe with nullable)
|
|
93
|
+
* @param args.enums - Parsed enumeration constraints (type-safe with nullable)
|
|
94
|
+
* @param args.defaultValue - Parsed default value (type-safe with nullable)
|
|
95
|
+
* @returns Complete OAS array instance with all properties
|
|
96
|
+
*
|
|
97
|
+
* @example Type-safe nullable array
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const nullableArray = toParsedArray({
|
|
100
|
+
* context: parseContext,
|
|
101
|
+
* nullable: true,
|
|
102
|
+
* example: [1, 2, 3], // Can be null due to nullable: true
|
|
103
|
+
* enums: [[1], [2], null], // Null allowed in enums
|
|
104
|
+
* defaultValue: null,
|
|
105
|
+
* value: {
|
|
106
|
+
* type: 'array',
|
|
107
|
+
* items: { type: 'number' },
|
|
108
|
+
* maxItems: 5
|
|
109
|
+
* }
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @example Non-nullable array
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const regularArray = toParsedArray({
|
|
116
|
+
* context: parseContext,
|
|
117
|
+
* nullable: false,
|
|
118
|
+
* example: ['a', 'b'], // Cannot be null
|
|
119
|
+
* enums: [['x'], ['y']], // No null values allowed
|
|
120
|
+
* defaultValue: [],
|
|
121
|
+
* value: {
|
|
122
|
+
* type: 'array',
|
|
123
|
+
* items: { type: 'string' }
|
|
124
|
+
* }
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
17
128
|
export declare const toParsedArray: <Nullable extends boolean | undefined>({ context, nullable, example, enums, defaultValue, value }: ToParsedArrayArgs<Nullable>) => OasArray<Nullable>;
|
|
18
129
|
export {};
|
|
19
130
|
//# sourceMappingURL=toArray.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../../src/oas/array/toArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,oBAAoB,WAAW,KAAG,QAmCzD,CAAA;AAED,KAAK,iBAAiB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC7D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACtF,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACvF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;CAC3F,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,EAAE,4DAOjE,iBAAiB,CAAC,QAAQ,CAAC,KAAG,QAAQ,CAAC,QAAQ,CAyCjD,CAAA"}
|
|
1
|
+
{"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../../src/oas/array/toArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,OAAO,GAAI,oBAAoB,WAAW,KAAG,QAmCzD,CAAA;AAED,KAAK,iBAAiB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC7D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACtF,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACvF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;CAC3F,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,EAAE,4DAOjE,iBAAiB,CAAC,QAAQ,CAAC,KAAG,QAAQ,CAAC,QAAQ,CAyCjD,CAAA"}
|
package/esm/oas/array/toArray.js
CHANGED
|
@@ -5,8 +5,67 @@ import { parseNullable } from '../_helpers/parseNullable.js';
|
|
|
5
5
|
import { parseExample } from '../_helpers/parseExample.js';
|
|
6
6
|
import { parseEnum } from '../_helpers/parseEnum.js';
|
|
7
7
|
import * as v from 'valibot';
|
|
8
|
-
import {
|
|
8
|
+
import { oasArrayDataWithoutItems } from './array-types.js';
|
|
9
9
|
import { parseDefault } from '../_helpers/parseDefault.js';
|
|
10
|
+
/**
|
|
11
|
+
* Transforms an OpenAPI v3 array schema object into an internal OAS array representation.
|
|
12
|
+
*
|
|
13
|
+
* This function processes OpenAPI array schemas by extracting and parsing nullable values,
|
|
14
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
15
|
+
* raw OpenAPI JSON to the SKMTC internal array representation with proper type safety.
|
|
16
|
+
*
|
|
17
|
+
* The transformation follows a pipeline approach:
|
|
18
|
+
* 1. Parse nullable flag and extract base value
|
|
19
|
+
* 2. Parse example values with nullable support
|
|
20
|
+
* 3. Parse enumeration constraints
|
|
21
|
+
* 4. Parse default values
|
|
22
|
+
* 5. Create final OasArray instance
|
|
23
|
+
*
|
|
24
|
+
* @param args - Transformation arguments
|
|
25
|
+
* @param args.value - The OpenAPI v3 array schema object to transform
|
|
26
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
27
|
+
* @returns Transformed OAS array object with parsed properties
|
|
28
|
+
*
|
|
29
|
+
* @example Basic array transformation
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { toArray } from '@skmtc/core';
|
|
32
|
+
*
|
|
33
|
+
* const openApiArray = {
|
|
34
|
+
* type: 'array',
|
|
35
|
+
* items: { type: 'string' },
|
|
36
|
+
* maxItems: 10,
|
|
37
|
+
* uniqueItems: true
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* const oasArray = toArray({
|
|
41
|
+
* value: openApiArray,
|
|
42
|
+
* context: parseContext
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* console.log(oasArray.maxItems); // 10
|
|
46
|
+
* console.log(oasArray.uniqueItems); // true
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example Array with nullable and examples
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const complexArray = {
|
|
52
|
+
* type: 'array',
|
|
53
|
+
* items: { type: 'number' },
|
|
54
|
+
* nullable: true,
|
|
55
|
+
* example: [1, 2, 3],
|
|
56
|
+
* default: [],
|
|
57
|
+
* enum: [[1, 2], [3, 4], null]
|
|
58
|
+
* };
|
|
59
|
+
*
|
|
60
|
+
* const oasArray = toArray({
|
|
61
|
+
* value: complexArray,
|
|
62
|
+
* context: parseContext
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* console.log(oasArray.nullable); // true
|
|
66
|
+
* console.log(oasArray.example); // [1, 2, 3]
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
10
69
|
export const toArray = ({ value, context }) => {
|
|
11
70
|
const { nullable, value: valueWithoutNullable } = parseNullable({
|
|
12
71
|
value,
|
|
@@ -39,11 +98,64 @@ export const toArray = ({ value, context }) => {
|
|
|
39
98
|
value: valueWithoutDefault
|
|
40
99
|
});
|
|
41
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Creates an OAS array instance from pre-parsed array schema components.
|
|
103
|
+
*
|
|
104
|
+
* This function is the final step in the array transformation pipeline, taking
|
|
105
|
+
* already-parsed nullable, example, enum, and default values and combining them
|
|
106
|
+
* with the remaining array properties to create the complete OasArray instance.
|
|
107
|
+
*
|
|
108
|
+
* The function handles type-safe nullable parsing, items schema resolution,
|
|
109
|
+
* and specification extension processing. It uses Valibot for schema validation
|
|
110
|
+
* and maintains proper type relationships between nullable flags and value types.
|
|
111
|
+
*
|
|
112
|
+
* @template Nullable - Boolean type indicating if the array can be null
|
|
113
|
+
* @param args - Pre-parsed array components
|
|
114
|
+
* @param args.value - OpenAPI array object without parsed fields
|
|
115
|
+
* @param args.context - Parse context for tracing and utilities
|
|
116
|
+
* @param args.nullable - Parsed nullable flag
|
|
117
|
+
* @param args.example - Parsed example value (type-safe with nullable)
|
|
118
|
+
* @param args.enums - Parsed enumeration constraints (type-safe with nullable)
|
|
119
|
+
* @param args.defaultValue - Parsed default value (type-safe with nullable)
|
|
120
|
+
* @returns Complete OAS array instance with all properties
|
|
121
|
+
*
|
|
122
|
+
* @example Type-safe nullable array
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const nullableArray = toParsedArray({
|
|
125
|
+
* context: parseContext,
|
|
126
|
+
* nullable: true,
|
|
127
|
+
* example: [1, 2, 3], // Can be null due to nullable: true
|
|
128
|
+
* enums: [[1], [2], null], // Null allowed in enums
|
|
129
|
+
* defaultValue: null,
|
|
130
|
+
* value: {
|
|
131
|
+
* type: 'array',
|
|
132
|
+
* items: { type: 'number' },
|
|
133
|
+
* maxItems: 5
|
|
134
|
+
* }
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* @example Non-nullable array
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const regularArray = toParsedArray({
|
|
141
|
+
* context: parseContext,
|
|
142
|
+
* nullable: false,
|
|
143
|
+
* example: ['a', 'b'], // Cannot be null
|
|
144
|
+
* enums: [['x'], ['y']], // No null values allowed
|
|
145
|
+
* defaultValue: [],
|
|
146
|
+
* value: {
|
|
147
|
+
* type: 'array',
|
|
148
|
+
* items: { type: 'string' }
|
|
149
|
+
* }
|
|
150
|
+
* });
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
42
153
|
export const toParsedArray = ({ context, nullable, example, enums, defaultValue, value }) => {
|
|
43
154
|
// We only want parse non-items fields here since items is handled below
|
|
44
155
|
const { items, ...rest } = value;
|
|
45
|
-
|
|
46
|
-
const
|
|
156
|
+
// Parse the object without items field
|
|
157
|
+
const parsed = v.parse(oasArrayDataWithoutItems, rest);
|
|
158
|
+
const { type: _type, title, description, uniqueItems, maxItems, minItems, ...skipped } = parsed;
|
|
47
159
|
const extensionFields = toSpecificationExtensionsV3({
|
|
48
160
|
skipped,
|
|
49
161
|
parent: value,
|
|
@@ -5,13 +5,7 @@ import * as v from 'valibot';
|
|
|
5
5
|
* Validates boolean schemas including default values and enumeration
|
|
6
6
|
* constraints. Boolean enums typically contain [true, false] or single values.
|
|
7
7
|
*/
|
|
8
|
-
export declare const oasBooleanData: v.
|
|
9
|
-
readonly type: v.LiteralSchema<"boolean", 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.BooleanSchema<undefined>, undefined>;
|
|
13
|
-
readonly enum: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
|
|
14
|
-
}, undefined>;
|
|
8
|
+
export declare const oasBooleanData: v.GenericSchema<OasBooleanData>;
|
|
15
9
|
/**
|
|
16
10
|
* Data type for OpenAPI boolean schema objects.
|
|
17
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean-types.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/boolean-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"boolean-types.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/boolean-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,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type OasExampleData } from '../example/example-types.js';
|
|
2
|
+
import { type OasHeaderData } from '../header/header-types.js';
|
|
3
|
+
import { type OasParameterData } from '../parameter/parameter-types.js';
|
|
4
|
+
import type { OasExampleRefData, OasHeaderRefData, OasParameterRefData, OasRequestBodyRefData, OasResponseRefData, OasSchemaRefData } from '../ref/ref-types.js';
|
|
5
|
+
import { type OasRequestBodyData } from '../requestBody/requestBody-types.js';
|
|
6
|
+
import { type OasResponseData } from '../response/response-types.js';
|
|
7
|
+
import { type OasSchemaData } from '../schema/schema-types.js';
|
|
8
|
+
import * as v from 'valibot';
|
|
9
|
+
export type OasComponentsData = {
|
|
10
|
+
oasType: 'components';
|
|
11
|
+
schemas?: Record<string, OasSchemaData | OasSchemaRefData>;
|
|
12
|
+
responses?: Record<string, OasResponseData | OasResponseRefData>;
|
|
13
|
+
parameters?: Record<string, OasParameterData | OasParameterRefData>;
|
|
14
|
+
examples?: Record<string, OasExampleData | OasExampleRefData>;
|
|
15
|
+
requestBodies?: Record<string, OasRequestBodyData | OasRequestBodyRefData>;
|
|
16
|
+
headers?: Record<string, OasHeaderData | OasHeaderRefData>;
|
|
17
|
+
};
|
|
18
|
+
export declare const oasComponentsData: v.GenericSchema<OasComponentsData>;
|
|
19
|
+
//# sourceMappingURL=components-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-types.d.ts","sourceRoot":"","sources":["../../../src/oas/components/components-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AACjF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AAS5B,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,qCAAqC,CAAA;AACjG,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,YAAY,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC,CAAA;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,CAAA;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,CAAA;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,qBAAqB,CAAC,CAAA;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;CAC3D,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAc/D,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { oasExampleData } from '../example/example-types.js';
|
|
2
|
+
import { oasHeaderData } from '../header/header-types.js';
|
|
3
|
+
import { oasParameterData } from '../parameter/parameter-types.js';
|
|
4
|
+
import { oasExampleRefData, oasHeaderRefData, oasParameterRefData, oasRequestBodyRefData, oasResponseRefData, oasSchemaRefData } from '../ref/ref-types.js';
|
|
5
|
+
import { oasRequestBodyData } from '../requestBody/requestBody-types.js';
|
|
6
|
+
import { oasResponseData } from '../response/response-types.js';
|
|
7
|
+
import { oasSchemaData } from '../schema/schema-types.js';
|
|
8
|
+
import * as v from 'valibot';
|
|
9
|
+
export const oasComponentsData = v.object({
|
|
10
|
+
oasType: v.literal('components'),
|
|
11
|
+
schemas: v.optional(v.record(v.string(), v.union([oasSchemaData, oasSchemaRefData]))),
|
|
12
|
+
responses: v.optional(v.record(v.string(), v.union([oasResponseData, oasResponseRefData]))),
|
|
13
|
+
parameters: v.optional(v.record(v.string(), v.union([oasParameterData, oasParameterRefData]))),
|
|
14
|
+
examples: v.optional(v.record(v.string(), v.union([oasExampleData, oasExampleRefData]))),
|
|
15
|
+
requestBodies: v.optional(v.record(v.string(), v.union([oasRequestBodyData, oasRequestBodyRefData]))),
|
|
16
|
+
headers: v.optional(v.record(v.string(), v.union([oasHeaderData, oasHeaderRefData])))
|
|
17
|
+
// securitySchemes: z.record(z.union([securityScheme, ref])),
|
|
18
|
+
// links: z.record(z.union([link, ref])),
|
|
19
|
+
// callbacks: z.never(),
|
|
20
|
+
// pathItems: z.record(z.union([oasPathItemData, oasPathItemRefData])).optional()
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact-types.d.ts","sourceRoot":"","sources":["../../../src/oas/contact/contact-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA"}
|
|
@@ -21,9 +21,5 @@ export type OasDiscriminatorData = {
|
|
|
21
21
|
* and optional value-to-schema mappings. Used to ensure discriminator
|
|
22
22
|
* objects conform to OpenAPI specification requirements.
|
|
23
23
|
*/
|
|
24
|
-
export declare const oasDiscriminatorData: v.
|
|
25
|
-
readonly oasType: v.LiteralSchema<"discriminator", undefined>;
|
|
26
|
-
readonly propertyName: v.StringSchema<undefined>;
|
|
27
|
-
readonly mapping: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
|
|
28
|
-
}, undefined>;
|
|
24
|
+
export declare const oasDiscriminatorData: v.GenericSchema<OasDiscriminatorData>;
|
|
29
25
|
//# sourceMappingURL=discriminator-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discriminator-types.d.ts","sourceRoot":"","sources":["../../../src/oas/discriminator/discriminator-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,yDAAyD;IACzD,OAAO,EAAE,eAAe,CAAA;IACxB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"discriminator-types.d.ts","sourceRoot":"","sources":["../../../src/oas/discriminator/discriminator-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,yDAAyD;IACzD,OAAO,EAAE,eAAe,CAAA;IACxB,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,aAAa,CAAC,oBAAoB,CAIrE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type OasTagData } from '../tag/tag-types.js';
|
|
2
|
+
import { type OasOperationData } from '../operation/operation-types.js';
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
import { type OasComponentsData } from '../components/components-types.js';
|
|
5
|
+
import { type OasInfoData } from '../info/info-types.js';
|
|
6
|
+
export type OasDocumentData = {
|
|
7
|
+
oasType: 'openapi';
|
|
8
|
+
openapi: string;
|
|
9
|
+
info: OasInfoData;
|
|
10
|
+
jsonSchemaDialect?: string;
|
|
11
|
+
operations: OasOperationData[];
|
|
12
|
+
components?: OasComponentsData;
|
|
13
|
+
tags?: OasTagData[];
|
|
14
|
+
};
|
|
15
|
+
export declare const oasDocumentData: v.GenericSchema<OasDocumentData>;
|
|
16
|
+
//# sourceMappingURL=document-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-types.d.ts","sourceRoot":"","sources":["../../../src/oas/document/document-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,mCAAmC,CAAA;AAC7F,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,uBAAuB,CAAA;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,WAAW,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAE1B,UAAU,EAAE,gBAAgB,EAAE,CAAA;IAE9B,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAE9B,IAAI,CAAC,EAAE,UAAU,EAAE,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAY3D,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { oasTagData } from '../tag/tag-types.js';
|
|
2
|
+
import { oasOperationData } from '../operation/operation-types.js';
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
import { oasComponentsData } from '../components/components-types.js';
|
|
5
|
+
import { oasInfoData } from '../info/info-types.js';
|
|
6
|
+
export const oasDocumentData = v.object({
|
|
7
|
+
oasType: v.literal('openapi'),
|
|
8
|
+
openapi: v.string(),
|
|
9
|
+
info: oasInfoData,
|
|
10
|
+
jsonSchemaDialect: v.optional(v.string()),
|
|
11
|
+
// servers: z.array(server).optional(),
|
|
12
|
+
operations: v.array(oasOperationData),
|
|
13
|
+
// webhooks: z.record(z.union([pathItem, ref])).optional(),
|
|
14
|
+
components: v.optional(oasComponentsData),
|
|
15
|
+
// security: z.never(),
|
|
16
|
+
tags: v.optional(v.array(oasTagData))
|
|
17
|
+
// externalDocs: externalDocs.optional()
|
|
18
|
+
});
|
|
@@ -5,10 +5,5 @@ export type OasExampleData = {
|
|
|
5
5
|
description?: string;
|
|
6
6
|
value?: unknown;
|
|
7
7
|
};
|
|
8
|
-
export declare const oasExampleData: v.
|
|
9
|
-
readonly oasType: v.LiteralSchema<"example", undefined>;
|
|
10
|
-
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
11
|
-
readonly description: v.OptionalSchema<v.GenericSchema<string>, undefined>;
|
|
12
|
-
readonly value: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
13
|
-
}, undefined>;
|
|
8
|
+
export declare const oasExampleData: v.GenericSchema<OasExampleData>;
|
|
14
9
|
//# sourceMappingURL=example-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example-types.d.ts","sourceRoot":"","sources":["../../../src/oas/example/example-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;CAEhB,CAAA;AAED,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"example-types.d.ts","sourceRoot":"","sources":["../../../src/oas/example/example-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,CAAA;CAEhB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAMzD,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type OasExampleData } from '../example/example-types.js';
|
|
2
|
+
import { type OasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
3
|
+
import { type OasExampleRefData, type OasSchemaRefData } from '../ref/ref-types.js';
|
|
4
|
+
import { type OasSchemaData } from '../schema/schema-types.js';
|
|
5
|
+
import * as v from 'valibot';
|
|
6
|
+
/**
|
|
7
|
+
* Data type for OpenAPI header objects in the SKMTC internal representation.
|
|
8
|
+
*
|
|
9
|
+
* Represents HTTP headers in OpenAPI specifications, including validation
|
|
10
|
+
* rules, examples, and serialization parameters. Headers are used in
|
|
11
|
+
* responses and can include complex schemas and multiple examples.
|
|
12
|
+
*/
|
|
13
|
+
export type OasHeaderData = {
|
|
14
|
+
/** Type identifier for OAS header objects */
|
|
15
|
+
oasType: 'header';
|
|
16
|
+
/** Human-readable description of the header */
|
|
17
|
+
description?: string;
|
|
18
|
+
/** Whether the header is required */
|
|
19
|
+
required?: boolean;
|
|
20
|
+
/** Whether the header is deprecated */
|
|
21
|
+
deprecated?: boolean;
|
|
22
|
+
/** Whether empty values are allowed for the header */
|
|
23
|
+
allowEmptyValue?: boolean;
|
|
24
|
+
/** Schema definition for the header value */
|
|
25
|
+
schema?: OasSchemaData | OasSchemaRefData;
|
|
26
|
+
/** Named examples for the header value */
|
|
27
|
+
examples?: Record<string, OasExampleData | OasExampleRefData>;
|
|
28
|
+
/** Media type definitions for complex header content */
|
|
29
|
+
content?: Record<string, OasMediaTypeData>;
|
|
30
|
+
/** Serialization style (always 'simple' for headers) */
|
|
31
|
+
style?: OasHeaderStyle;
|
|
32
|
+
/** Whether to explode parameter values */
|
|
33
|
+
explode?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Valid serialization styles for OpenAPI headers.
|
|
37
|
+
*
|
|
38
|
+
* Headers can only use the 'simple' serialization style according to
|
|
39
|
+
* the OpenAPI specification.
|
|
40
|
+
*/
|
|
41
|
+
export type OasHeaderStyle = 'simple';
|
|
42
|
+
/**
|
|
43
|
+
* Valibot schema for validating OAS header data structures.
|
|
44
|
+
*
|
|
45
|
+
* Validates the structure and content of OpenAPI header objects,
|
|
46
|
+
* ensuring proper types for all fields including nested schemas,
|
|
47
|
+
* examples, and content definitions.
|
|
48
|
+
*/
|
|
49
|
+
export declare const oasHeaderData: v.GenericSchema<OasHeaderData>;
|
|
50
|
+
//# sourceMappingURL=header-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-types.d.ts","sourceRoot":"","sources":["../../../src/oas/header/header-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AAEjF,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,QAAQ,CAAA;IACjB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAA;IACzC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,CAAA;IAC7D,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAC1C,wDAAwD;IACxD,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAID;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAA;AAErC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAcvD,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { oasExampleData } from '../example/example-types.js';
|
|
2
|
+
import { markdown } from '../markdown/markdown-types.js';
|
|
3
|
+
import { oasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
4
|
+
import { oasExampleRefData, oasSchemaRefData } from '../ref/ref-types.js';
|
|
5
|
+
import { oasSchemaData } from '../schema/schema-types.js';
|
|
6
|
+
import * as v from 'valibot';
|
|
7
|
+
const oasHeaderStyle = v.literal('simple');
|
|
8
|
+
/**
|
|
9
|
+
* Valibot schema for validating OAS header data structures.
|
|
10
|
+
*
|
|
11
|
+
* Validates the structure and content of OpenAPI header objects,
|
|
12
|
+
* ensuring proper types for all fields including nested schemas,
|
|
13
|
+
* examples, and content definitions.
|
|
14
|
+
*/
|
|
15
|
+
export const oasHeaderData = v.object({
|
|
16
|
+
oasType: v.literal('header'),
|
|
17
|
+
description: v.optional(markdown),
|
|
18
|
+
required: v.optional(v.boolean()),
|
|
19
|
+
deprecated: v.optional(v.boolean()),
|
|
20
|
+
allowEmptyValue: v.optional(v.boolean()),
|
|
21
|
+
// Default values (based on value of in): for query - form; for path - simple; for header - simple; for cookie - form.
|
|
22
|
+
style: v.optional(oasHeaderStyle),
|
|
23
|
+
explode: v.optional(v.boolean()),
|
|
24
|
+
// allowReserved: v.boolean().optional(),
|
|
25
|
+
schema: v.optional(v.union([oasSchemaData, oasSchemaRefData])),
|
|
26
|
+
// example: z.any().optional(),
|
|
27
|
+
examples: v.optional(v.record(v.string(), v.union([oasExampleData, oasExampleRefData]))),
|
|
28
|
+
content: v.optional(v.record(v.string(), oasMediaTypeData))
|
|
29
|
+
});
|
|
30
|
+
// export type OasHeaders = Record<string, OasHeader | OasHeaderRef>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type OasLicenseData } from '../license/license-types.js';
|
|
2
|
+
import { type OasContactData } from '../contact/contact-types.js';
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
export type OasInfoData = {
|
|
5
|
+
oasType: 'info';
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
termsOfService?: string;
|
|
9
|
+
contact?: OasContactData;
|
|
10
|
+
license?: OasLicenseData;
|
|
11
|
+
version: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const oasInfoData: v.GenericSchema<OasInfoData>;
|
|
14
|
+
//# sourceMappingURL=info-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-types.d.ts","sourceRoot":"","sources":["../../../src/oas/info/info-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AACjF,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AAEjF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAQnD,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { oasLicenseData } from '../license/license-types.js';
|
|
2
|
+
import { oasContactData } from '../contact/contact-types.js';
|
|
3
|
+
import { markdown } from '../markdown/markdown-types.js';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
export const oasInfoData = v.object({
|
|
6
|
+
oasType: v.literal('info'),
|
|
7
|
+
title: v.string(),
|
|
8
|
+
description: v.optional(markdown),
|
|
9
|
+
termsOfService: v.optional(v.string()),
|
|
10
|
+
contact: v.optional(oasContactData),
|
|
11
|
+
license: v.optional(oasLicenseData),
|
|
12
|
+
version: v.string()
|
|
13
|
+
});
|
|
@@ -5,35 +5,21 @@ import * as v from 'valibot';
|
|
|
5
5
|
* Ensures values are numbers and specifically integers,
|
|
6
6
|
* used for integer validation throughout OAS processing.
|
|
7
7
|
*/
|
|
8
|
-
export declare const integerSchema: v.
|
|
8
|
+
export declare const integerSchema: v.GenericSchema<number>;
|
|
9
9
|
/**
|
|
10
10
|
* Valibot schema for valid integer format values.
|
|
11
11
|
*
|
|
12
12
|
* Defines the size formats for integer types: int32 for 32-bit signed
|
|
13
13
|
* integers and int64 for 64-bit signed integers.
|
|
14
14
|
*/
|
|
15
|
-
export declare const integerFormat: v.
|
|
15
|
+
export declare const integerFormat: v.GenericSchema<'int32' | 'int64'>;
|
|
16
16
|
/**
|
|
17
17
|
* Valibot schema for validating OpenAPI integer data objects.
|
|
18
18
|
*
|
|
19
19
|
* Validates integer schemas including size formats (int32/int64),
|
|
20
20
|
* range constraints, multiple validation, and enumeration values.
|
|
21
21
|
*/
|
|
22
|
-
export declare const oasIntegerData: v.
|
|
23
|
-
readonly type: v.LiteralSchema<"integer", undefined>;
|
|
24
|
-
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
25
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
26
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
|
|
27
|
-
readonly format: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"int32", undefined>, v.LiteralSchema<"int64", undefined>], undefined>, undefined>;
|
|
28
|
-
readonly enum: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>, undefined>;
|
|
29
|
-
readonly nullable: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
30
|
-
readonly example: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
|
|
31
|
-
readonly multipleOf: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
|
|
32
|
-
readonly maximum: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
|
|
33
|
-
readonly exclusiveMaximum: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
34
|
-
readonly minimum: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
|
|
35
|
-
readonly exclusiveMinimum: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
36
|
-
}, undefined>;
|
|
22
|
+
export declare const oasIntegerData: v.GenericSchema<OasIntegerData>;
|
|
37
23
|
export type OasIntegerData = {
|
|
38
24
|
type: 'integer';
|
|
39
25
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integer-types.d.ts","sourceRoot":"","sources":["../../../src/oas/integer/integer-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"integer-types.d.ts","sourceRoot":"","sources":["../../../src/oas/integer/integer-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAmC,CAAA;AAErF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,GAAG,OAAO,CAAqD,CAAA;AAElH;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAczD,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-types.d.ts","sourceRoot":"","sources":["../../../src/oas/license/license-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA"}
|