@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.
Files changed (73) hide show
  1. package/esm/context/types.d.ts +0 -8
  2. package/esm/context/types.d.ts.map +1 -1
  3. package/esm/dsl/model/toModelBase.d.ts +24 -2
  4. package/esm/dsl/model/toModelBase.d.ts.map +1 -1
  5. package/esm/dsl/model/types.d.ts +2 -2
  6. package/esm/dsl/operation/toOperationBase.d.ts +26 -3
  7. package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
  8. package/esm/dsl/operation/types.d.ts +2 -2
  9. package/esm/oas/array/array-types.d.ts +238 -25
  10. package/esm/oas/array/array-types.d.ts.map +1 -1
  11. package/esm/oas/array/array-types.js +97 -5
  12. package/esm/oas/boolean/boolean-types.d.ts +81 -9
  13. package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
  14. package/esm/oas/boolean/boolean-types.js +32 -2
  15. package/esm/oas/contact/contact-types.d.ts +176 -0
  16. package/esm/oas/contact/contact-types.d.ts.map +1 -1
  17. package/esm/oas/contact/contact-types.js +102 -0
  18. package/esm/oas/header/Header.d.ts +8 -185
  19. package/esm/oas/header/Header.d.ts.map +1 -1
  20. package/esm/oas/header/Header.js +57 -220
  21. package/esm/oas/mediaType/toMediaTypeItemV3.d.ts +288 -0
  22. package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
  23. package/esm/oas/mediaType/toMediaTypeItemV3.js +272 -0
  24. package/esm/oas/operation/operation-types.d.ts +251 -0
  25. package/esm/oas/operation/operation-types.d.ts.map +1 -1
  26. package/esm/oas/operation/operation-types.js +98 -0
  27. package/esm/oas/string/string-types.d.ts +192 -18
  28. package/esm/oas/string/string-types.d.ts.map +1 -1
  29. package/esm/oas/string/string-types.js +76 -4
  30. package/esm/types/ModuleExport.d.ts +130 -0
  31. package/esm/types/ModuleExport.d.ts.map +1 -1
  32. package/esm/types/ModuleExport.js +36 -0
  33. package/esm/typescript/List.d.ts +2 -2
  34. package/esm/typescript/List.d.ts.map +1 -1
  35. package/esm/typescript/List.js +4 -4
  36. package/esm/typescript/toPathTemplate.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/script/context/types.d.ts +0 -8
  39. package/script/context/types.d.ts.map +1 -1
  40. package/script/dsl/model/toModelBase.d.ts +24 -2
  41. package/script/dsl/model/toModelBase.d.ts.map +1 -1
  42. package/script/dsl/model/types.d.ts +2 -2
  43. package/script/dsl/operation/toOperationBase.d.ts +26 -3
  44. package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
  45. package/script/dsl/operation/types.d.ts +2 -2
  46. package/script/oas/array/array-types.d.ts +238 -25
  47. package/script/oas/array/array-types.d.ts.map +1 -1
  48. package/script/oas/array/array-types.js +97 -5
  49. package/script/oas/boolean/boolean-types.d.ts +81 -9
  50. package/script/oas/boolean/boolean-types.d.ts.map +1 -1
  51. package/script/oas/boolean/boolean-types.js +32 -2
  52. package/script/oas/contact/contact-types.d.ts +176 -0
  53. package/script/oas/contact/contact-types.d.ts.map +1 -1
  54. package/script/oas/contact/contact-types.js +102 -0
  55. package/script/oas/header/Header.d.ts +8 -185
  56. package/script/oas/header/Header.d.ts.map +1 -1
  57. package/script/oas/header/Header.js +57 -220
  58. package/script/oas/mediaType/toMediaTypeItemV3.d.ts +288 -0
  59. package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
  60. package/script/oas/mediaType/toMediaTypeItemV3.js +272 -0
  61. package/script/oas/operation/operation-types.d.ts +251 -0
  62. package/script/oas/operation/operation-types.d.ts.map +1 -1
  63. package/script/oas/operation/operation-types.js +98 -0
  64. package/script/oas/string/string-types.d.ts +192 -18
  65. package/script/oas/string/string-types.d.ts.map +1 -1
  66. package/script/oas/string/string-types.js +76 -4
  67. package/script/types/ModuleExport.d.ts +130 -0
  68. package/script/types/ModuleExport.d.ts.map +1 -1
  69. package/script/types/ModuleExport.js +36 -0
  70. package/script/typescript/List.d.ts +2 -2
  71. package/script/typescript/List.d.ts.map +1 -1
  72. package/script/typescript/List.js +4 -4
  73. package/script/typescript/toPathTemplate.d.ts.map +1 -1
@@ -5,6 +5,108 @@ const toSchemasV3_js_1 = require("../schema/toSchemasV3.js");
5
5
  const toExamplesV3_js_1 = require("../example/toExamplesV3.js");
6
6
  const MediaType_js_1 = require("./MediaType.js");
7
7
  const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
8
+ /**
9
+ * Transforms an OpenAPI v3 media type object into an internal OAS media type representation.
10
+ *
11
+ * This function processes OpenAPI v3 MediaType objects, extracting schema definitions,
12
+ * examples, encoding information, and specification extensions. It creates a structured
13
+ * internal representation that can be used by the SKMTC pipeline for code generation
14
+ * and validation.
15
+ *
16
+ * The transformation handles all standard OpenAPI v3 MediaType properties including
17
+ * schema references, inline schemas, examples, encoding specifications, and custom
18
+ * extension fields that begin with 'x-'.
19
+ *
20
+ * @param args - Transformation arguments
21
+ * @param args.mediaTypeItem - The OpenAPI v3 media type object to process
22
+ * @param args.mediaType - The media type identifier (MIME type)
23
+ * @param args.context - Parsing context for tracing and error handling
24
+ * @returns Structured OAS media type object for internal processing
25
+ *
26
+ * @example Transforming JSON media type
27
+ * ```typescript
28
+ * import { toMediaTypeItemV3 } from '@skmtc/core/oas/mediaType';
29
+ *
30
+ * const jsonMediaType = {
31
+ * schema: {
32
+ * type: 'object',
33
+ * properties: {
34
+ * name: { type: 'string' },
35
+ * email: { type: 'string', format: 'email' }
36
+ * }
37
+ * },
38
+ * example: {
39
+ * name: 'John Doe',
40
+ * email: 'john@example.com'
41
+ * }
42
+ * };
43
+ *
44
+ * const result = toMediaTypeItemV3({
45
+ * mediaTypeItem: jsonMediaType,
46
+ * mediaType: 'application/json',
47
+ * context: parseContext
48
+ * });
49
+ *
50
+ * console.log(result.mediaType); // 'application/json'
51
+ * console.log(result.schema); // Processed schema object
52
+ * ```
53
+ *
54
+ * @example Processing form data with encoding
55
+ * ```typescript
56
+ * const formMediaType = {
57
+ * schema: {
58
+ * type: 'object',
59
+ * properties: {
60
+ * file: { type: 'string', format: 'binary' },
61
+ * metadata: { type: 'string' }
62
+ * }
63
+ * },
64
+ * encoding: {
65
+ * file: {
66
+ * contentType: 'image/png',
67
+ * headers: {
68
+ * 'X-Rate-Limit': {
69
+ * schema: { type: 'integer' }
70
+ * }
71
+ * }
72
+ * }
73
+ * }
74
+ * };
75
+ *
76
+ * const result = toMediaTypeItemV3({
77
+ * mediaTypeItem: formMediaType,
78
+ * mediaType: 'multipart/form-data',
79
+ * context: parseContext
80
+ * });
81
+ *
82
+ * console.log(result.encoding); // Processed encoding configuration
83
+ * ```
84
+ *
85
+ * @example Handling multiple examples
86
+ * ```typescript
87
+ * const mediaTypeWithExamples = {
88
+ * schema: { type: 'string' },
89
+ * examples: {
90
+ * success: {
91
+ * summary: 'Successful response',
92
+ * value: 'Operation completed'
93
+ * },
94
+ * error: {
95
+ * summary: 'Error response',
96
+ * value: 'Operation failed'
97
+ * }
98
+ * }
99
+ * };
100
+ *
101
+ * const result = toMediaTypeItemV3({
102
+ * mediaTypeItem: mediaTypeWithExamples,
103
+ * mediaType: 'text/plain',
104
+ * context: parseContext
105
+ * });
106
+ *
107
+ * console.log(Object.keys(result.examples)); // ['success', 'error']
108
+ * ```
109
+ */
8
110
  const toMediaTypeItemV3 = ({ mediaTypeItem, mediaType, context }) => {
9
111
  const { schema, example, examples, encoding, ...skipped } = mediaTypeItem;
10
112
  const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
@@ -28,6 +130,89 @@ const toMediaTypeItemV3 = ({ mediaTypeItem, mediaType, context }) => {
28
130
  return new MediaType_js_1.OasMediaType(fields);
29
131
  };
30
132
  exports.toMediaTypeItemV3 = toMediaTypeItemV3;
133
+ /**
134
+ * Transforms multiple OpenAPI v3 media type objects into internal OAS representations.
135
+ *
136
+ * This function processes a complete content map from OpenAPI v3, transforming each
137
+ * media type entry into its internal OAS representation. It's commonly used to process
138
+ * the `content` property of request bodies, responses, and parameters that support
139
+ * multiple media types.
140
+ *
141
+ * The function maintains the original media type keys while transforming the values
142
+ * into structured OAS media type objects. Each transformation is traced for debugging
143
+ * and error tracking purposes.
144
+ *
145
+ * @param args - Transformation arguments
146
+ * @param args.content - Map of media types to OpenAPI MediaType objects
147
+ * @param args.context - Parsing context for tracing and error handling
148
+ * @returns Map of media type strings to processed OAS media type objects
149
+ *
150
+ * @example Processing multiple content types
151
+ * ```typescript
152
+ * import { toMediaTypeItemsV3 } from '@skmtc/core/oas/mediaType';
153
+ *
154
+ * const content = {
155
+ * 'application/json': {
156
+ * schema: {
157
+ * type: 'object',
158
+ * properties: { message: { type: 'string' } }
159
+ * }
160
+ * },
161
+ * 'application/xml': {
162
+ * schema: {
163
+ * type: 'string'
164
+ * }
165
+ * },
166
+ * 'text/plain': {
167
+ * schema: {
168
+ * type: 'string'
169
+ * },
170
+ * example: 'Plain text response'
171
+ * }
172
+ * };
173
+ *
174
+ * const result = toMediaTypeItemsV3({
175
+ * content,
176
+ * context: parseContext
177
+ * });
178
+ *
179
+ * console.log(Object.keys(result)); // ['application/json', 'application/xml', 'text/plain']
180
+ * console.log(result['application/json'].mediaType); // 'application/json'
181
+ * ```
182
+ *
183
+ * @example Processing request body content types
184
+ * ```typescript
185
+ * const requestBodyContent = {
186
+ * 'application/json': {
187
+ * schema: { $ref: '#/components/schemas/CreateUserRequest' }
188
+ * },
189
+ * 'application/x-www-form-urlencoded': {
190
+ * schema: {
191
+ * type: 'object',
192
+ * properties: {
193
+ * name: { type: 'string' },
194
+ * email: { type: 'string' }
195
+ * }
196
+ * },
197
+ * encoding: {
198
+ * email: {
199
+ * style: 'form',
200
+ * explode: false
201
+ * }
202
+ * }
203
+ * }
204
+ * };
205
+ *
206
+ * const processed = toMediaTypeItemsV3({
207
+ * content: requestBodyContent,
208
+ * context: parseContext
209
+ * });
210
+ *
211
+ * // Each media type is processed with its specific configuration
212
+ * console.log(processed['application/json'].schema); // Reference object
213
+ * console.log(processed['application/x-www-form-urlencoded'].encoding); // Form encoding config
214
+ * ```
215
+ */
31
216
  const toMediaTypeItemsV3 = ({ content, context }) => {
32
217
  return Object.fromEntries(Object.entries(content).map(([mediaType, value]) => [
33
218
  mediaType,
@@ -39,6 +224,93 @@ const toMediaTypeItemsV3 = ({ content, context }) => {
39
224
  ]));
40
225
  };
41
226
  exports.toMediaTypeItemsV3 = toMediaTypeItemsV3;
227
+ /**
228
+ * Optionally transforms OpenAPI v3 media type objects when content is provided.
229
+ *
230
+ * This function provides a safe way to process media type content that may or may not
231
+ * be present in the OpenAPI specification. It handles the common pattern where content
232
+ * properties are optional in OpenAPI objects (like responses without bodies or
233
+ * operations without request bodies).
234
+ *
235
+ * When content is undefined, the function returns undefined without processing.
236
+ * When content is provided, it delegates to `toMediaTypeItemsV3` for full processing.
237
+ *
238
+ * @param args - Transformation arguments
239
+ * @param args.content - Optional map of media types to OpenAPI MediaType objects
240
+ * @param args.context - Parsing context for tracing and error handling
241
+ * @returns Map of processed media types if content exists, undefined otherwise
242
+ *
243
+ * @example Handling optional response content
244
+ * ```typescript
245
+ * import { toOptionalMediaTypeItemsV3 } from '@skmtc/core/oas/mediaType';
246
+ *
247
+ * // Response with content
248
+ * const responseWithContent = {
249
+ * description: 'Successful response',
250
+ * content: {
251
+ * 'application/json': {
252
+ * schema: { type: 'object' }
253
+ * }
254
+ * }
255
+ * };
256
+ *
257
+ * const withContent = toOptionalMediaTypeItemsV3({
258
+ * content: responseWithContent.content,
259
+ * context: parseContext
260
+ * });
261
+ * console.log(withContent); // { 'application/json': OasMediaType }
262
+ *
263
+ * // Response without content (like 204 No Content)
264
+ * const responseNoContent = {
265
+ * description: 'No content response'
266
+ * };
267
+ *
268
+ * const noContent = toOptionalMediaTypeItemsV3({
269
+ * content: responseNoContent.content, // undefined
270
+ * context: parseContext
271
+ * });
272
+ * console.log(noContent); // undefined
273
+ * ```
274
+ *
275
+ * @example Processing operations with optional request bodies
276
+ * ```typescript
277
+ * function processOperation(operation: OpenAPIV3.OperationObject) {
278
+ * const requestBodyContent = toOptionalMediaTypeItemsV3({
279
+ * content: operation.requestBody?.content,
280
+ * context: parseContext
281
+ * });
282
+ *
283
+ * if (requestBodyContent) {
284
+ * console.log('Operation has request body with media types:');
285
+ * console.log(Object.keys(requestBodyContent));
286
+ * } else {
287
+ * console.log('Operation has no request body');
288
+ * }
289
+ * }
290
+ * ```
291
+ *
292
+ * @example Safe processing in response handlers
293
+ * ```typescript
294
+ * class ResponseProcessor {
295
+ * processResponse(response: OpenAPIV3.ResponseObject) {
296
+ * const mediaTypes = toOptionalMediaTypeItemsV3({
297
+ * content: response.content,
298
+ * context: this.context
299
+ * });
300
+ *
301
+ * // Safe to check without worrying about undefined content
302
+ * const hasJsonResponse = mediaTypes && 'application/json' in mediaTypes;
303
+ *
304
+ * if (hasJsonResponse) {
305
+ * const jsonMediaType = mediaTypes['application/json'];
306
+ * return this.generateJsonResponseHandler(jsonMediaType);
307
+ * }
308
+ *
309
+ * return this.generateEmptyResponseHandler();
310
+ * }
311
+ * }
312
+ * ```
313
+ */
42
314
  const toOptionalMediaTypeItemsV3 = ({ content, context }) => {
43
315
  if (!content) {
44
316
  return;
@@ -4,19 +4,270 @@ import { type OasParameterRefData, type OasRequestBodyRefData, type OasResponseR
4
4
  import { type OasRequestBodyData } from '../requestBody/requestBody-types.js';
5
5
  import { type OasResponseData } from '../response/response-types.js';
6
6
  import * as v from 'valibot';
7
+ /**
8
+ * Data type for OpenAPI operation objects processed by the SKMTC pipeline.
9
+ *
10
+ * This type represents a complete OpenAPI operation (API endpoint) including all
11
+ * associated metadata, parameters, request body, responses, and path information.
12
+ * It serves as the internal representation of OpenAPI operations during the
13
+ * code generation process, combining operation data with its parent path item context.
14
+ *
15
+ * ## Usage in SKMTC Pipeline
16
+ *
17
+ * This type is used by:
18
+ * - Operation parsers to validate and structure incoming OpenAPI operations
19
+ * - Code generators to access operation metadata and generate client code
20
+ * - Response processors to understand expected API responses
21
+ * - Parameter handlers to generate request validation and typing
22
+ *
23
+ * @example Basic GET operation
24
+ * ```typescript
25
+ * import type { OasOperationData } from '@skmtc/core/oas/operation';
26
+ *
27
+ * const getUserOperation: OasOperationData = {
28
+ * oasType: 'operation',
29
+ * path: '/users/{id}',
30
+ * method: 'get',
31
+ * operationId: 'getUserById',
32
+ * summary: 'Get user by ID',
33
+ * description: 'Retrieves a specific user by their unique identifier',
34
+ * tags: ['users'],
35
+ * parameters: [
36
+ * {
37
+ * name: 'id',
38
+ * in: 'path',
39
+ * required: true,
40
+ * schema: { type: 'string' }
41
+ * }
42
+ * ],
43
+ * responses: {
44
+ * '200': {
45
+ * description: 'User found',
46
+ * content: {
47
+ * 'application/json': {
48
+ * schema: { $ref: '#/components/schemas/User' }
49
+ * }
50
+ * }
51
+ * },
52
+ * '404': {
53
+ * description: 'User not found'
54
+ * }
55
+ * },
56
+ * pathItem: pathItemData
57
+ * };
58
+ * ```
59
+ *
60
+ * @example POST operation with request body
61
+ * ```typescript
62
+ * const createUserOperation: OasOperationData = {
63
+ * oasType: 'operation',
64
+ * path: '/users',
65
+ * method: 'post',
66
+ * operationId: 'createUser',
67
+ * summary: 'Create new user',
68
+ * description: 'Creates a new user account',
69
+ * tags: ['users'],
70
+ * requestBody: {
71
+ * description: 'User data',
72
+ * required: true,
73
+ * content: {
74
+ * 'application/json': {
75
+ * schema: { $ref: '#/components/schemas/CreateUserRequest' }
76
+ * }
77
+ * }
78
+ * },
79
+ * responses: {
80
+ * '201': {
81
+ * description: 'User created successfully',
82
+ * content: {
83
+ * 'application/json': {
84
+ * schema: { $ref: '#/components/schemas/User' }
85
+ * }
86
+ * }
87
+ * },
88
+ * '400': {
89
+ * description: 'Invalid request data'
90
+ * }
91
+ * },
92
+ * pathItem: pathItemData
93
+ * };
94
+ * ```
95
+ *
96
+ * @example Operation with query parameters
97
+ * ```typescript
98
+ * const listUsersOperation: OasOperationData = {
99
+ * oasType: 'operation',
100
+ * path: '/users',
101
+ * method: 'get',
102
+ * operationId: 'listUsers',
103
+ * summary: 'List users',
104
+ * description: 'Get paginated list of users',
105
+ * tags: ['users'],
106
+ * parameters: [
107
+ * {
108
+ * name: 'page',
109
+ * in: 'query',
110
+ * schema: { type: 'integer', minimum: 1, default: 1 }
111
+ * },
112
+ * {
113
+ * name: 'limit',
114
+ * in: 'query',
115
+ * schema: { type: 'integer', minimum: 1, maximum: 100, default: 20 }
116
+ * },
117
+ * {
118
+ * name: 'status',
119
+ * in: 'query',
120
+ * schema: { type: 'string', enum: ['active', 'inactive'] }
121
+ * }
122
+ * ],
123
+ * responses: {
124
+ * '200': {
125
+ * description: 'List of users',
126
+ * content: {
127
+ * 'application/json': {
128
+ * schema: {
129
+ * type: 'object',
130
+ * properties: {
131
+ * users: {
132
+ * type: 'array',
133
+ * items: { $ref: '#/components/schemas/User' }
134
+ * },
135
+ * totalCount: { type: 'integer' },
136
+ * page: { type: 'integer' },
137
+ * limit: { type: 'integer' }
138
+ * }
139
+ * }
140
+ * }
141
+ * }
142
+ * }
143
+ * },
144
+ * pathItem: pathItemData
145
+ * };
146
+ * ```
147
+ */
7
148
  export type OasOperationData = {
149
+ /** Type identifier for SKMTC internal processing */
8
150
  oasType: 'operation';
151
+ /** Parent path item containing this operation */
9
152
  pathItem: OasPathItemData;
153
+ /** The API path template (e.g., '/users/{id}') */
10
154
  path: string;
155
+ /** HTTP method for this operation */
11
156
  method: 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
157
+ /** Unique identifier for this operation (used for client method names) */
12
158
  operationId?: string;
159
+ /** Tags for grouping operations (used for code organization) */
13
160
  tags?: string[];
161
+ /** Brief summary of what the operation does */
14
162
  summary?: string;
163
+ /** Detailed description of the operation behavior */
15
164
  description?: string;
165
+ /** List of parameters (path, query, header, cookie) */
16
166
  parameters?: (OasParameterData | OasParameterRefData)[];
167
+ /** Request body specification for operations that accept data */
17
168
  requestBody?: OasRequestBodyData | OasRequestBodyRefData;
169
+ /** Map of status codes to response specifications */
18
170
  responses: Record<string, OasResponseData | OasResponseRefData>;
171
+ /** Whether this operation is deprecated */
19
172
  deprecated?: boolean;
20
173
  };
174
+ /**
175
+ * Valibot schema for validating OpenAPI operation data objects.
176
+ *
177
+ * This comprehensive schema validates OpenAPI operations according to the OpenAPI v3
178
+ * specification, including all standard properties like HTTP methods, parameters,
179
+ * request bodies, responses, and metadata. It uses lazy evaluation and unions to
180
+ * handle complex nested structures and reference objects.
181
+ *
182
+ * The schema ensures that operation data conforms to OpenAPI standards while also
183
+ * including SKMTC-specific metadata (like `oasType` and `pathItem`) needed for
184
+ * the code generation pipeline.
185
+ *
186
+ * @example Validating a GET operation
187
+ * ```typescript
188
+ * import { oasOperationData } from '@skmtc/core/oas/operation';
189
+ * import * as v from 'valibot';
190
+ *
191
+ * const operation = {
192
+ * oasType: 'operation',
193
+ * path: '/api/users/{id}',
194
+ * method: 'get',
195
+ * operationId: 'getUserById',
196
+ * summary: 'Get user by ID',
197
+ * parameters: [
198
+ * {
199
+ * name: 'id',
200
+ * in: 'path',
201
+ * required: true,
202
+ * schema: { type: 'string' }
203
+ * }
204
+ * ],
205
+ * responses: {
206
+ * '200': {
207
+ * description: 'Success',
208
+ * content: {
209
+ * 'application/json': {
210
+ * schema: { $ref: '#/components/schemas/User' }
211
+ * }
212
+ * }
213
+ * }
214
+ * },
215
+ * pathItem: validPathItem
216
+ * };
217
+ *
218
+ * const validated = v.parse(oasOperationData, operation);
219
+ * console.log(validated.operationId); // 'getUserById'
220
+ * ```
221
+ *
222
+ * @example Validating a POST operation with request body
223
+ * ```typescript
224
+ * const postOperation = {
225
+ * oasType: 'operation',
226
+ * path: '/api/users',
227
+ * method: 'post',
228
+ * operationId: 'createUser',
229
+ * requestBody: {
230
+ * description: 'User data',
231
+ * required: true,
232
+ * content: {
233
+ * 'application/json': {
234
+ * schema: { $ref: '#/components/schemas/CreateUserRequest' }
235
+ * }
236
+ * }
237
+ * },
238
+ * responses: {
239
+ * '201': {
240
+ * description: 'User created',
241
+ * content: {
242
+ * 'application/json': {
243
+ * schema: { $ref: '#/components/schemas/User' }
244
+ * }
245
+ * }
246
+ * }
247
+ * },
248
+ * pathItem: validPathItem
249
+ * };
250
+ *
251
+ * const validated = v.parse(oasOperationData, postOperation);
252
+ * console.log(validated.method); // 'post'
253
+ * ```
254
+ *
255
+ * @example Validation error handling
256
+ * ```typescript
257
+ * const invalidOperation = {
258
+ * oasType: 'operation',
259
+ * path: '/api/users',
260
+ * method: 'invalid', // Invalid HTTP method
261
+ * responses: {} // Missing required responses
262
+ * };
263
+ *
264
+ * try {
265
+ * v.parse(oasOperationData, invalidOperation);
266
+ * } catch (error) {
267
+ * console.error('Validation failed:', error.message);
268
+ * // Handle validation errors
269
+ * }
270
+ * ```
271
+ */
21
272
  export declare const oasOperationData: v.GenericSchema<OasOperationData>;
22
273
  //# sourceMappingURL=operation-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-types.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/operation-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAIxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,qCAAqC,CAAA;AACjG,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,eAAe,CAAA;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAClF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IAGpB,UAAU,CAAC,EAAE,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,EAAE,CAAA;IACvD,WAAW,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAA;IACxD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC,CAAA;IAE/D,UAAU,CAAC,EAAE,OAAO,CAAA;CAGrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CA2B7D,CAAA"}
1
+ {"version":3,"file":"operation-types.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/operation-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAIxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,qCAAqC,CAAA;AACjG,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4IG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,oDAAoD;IACpD,OAAO,EAAE,WAAW,CAAA;IACpB,iDAAiD;IACjD,QAAQ,EAAE,eAAe,CAAA;IACzB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAClF,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAA;IAGpB,uDAAuD;IACvD,UAAU,CAAC,EAAE,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,EAAE,CAAA;IACvD,iEAAiE;IACjE,WAAW,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAA;IACxD,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC,CAAA;IAE/D,2CAA2C;IAC3C,UAAU,CAAC,EAAE,OAAO,CAAA;CAGrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CA2B7D,CAAA"}
@@ -41,6 +41,104 @@ const ref_types_js_1 = require("../ref/ref-types.js");
41
41
  const requestBody_types_js_1 = require("../requestBody/requestBody-types.js");
42
42
  const response_types_js_1 = require("../response/response-types.js");
43
43
  const v = __importStar(require("valibot"));
44
+ /**
45
+ * Valibot schema for validating OpenAPI operation data objects.
46
+ *
47
+ * This comprehensive schema validates OpenAPI operations according to the OpenAPI v3
48
+ * specification, including all standard properties like HTTP methods, parameters,
49
+ * request bodies, responses, and metadata. It uses lazy evaluation and unions to
50
+ * handle complex nested structures and reference objects.
51
+ *
52
+ * The schema ensures that operation data conforms to OpenAPI standards while also
53
+ * including SKMTC-specific metadata (like `oasType` and `pathItem`) needed for
54
+ * the code generation pipeline.
55
+ *
56
+ * @example Validating a GET operation
57
+ * ```typescript
58
+ * import { oasOperationData } from '@skmtc/core/oas/operation';
59
+ * import * as v from 'valibot';
60
+ *
61
+ * const operation = {
62
+ * oasType: 'operation',
63
+ * path: '/api/users/{id}',
64
+ * method: 'get',
65
+ * operationId: 'getUserById',
66
+ * summary: 'Get user by ID',
67
+ * parameters: [
68
+ * {
69
+ * name: 'id',
70
+ * in: 'path',
71
+ * required: true,
72
+ * schema: { type: 'string' }
73
+ * }
74
+ * ],
75
+ * responses: {
76
+ * '200': {
77
+ * description: 'Success',
78
+ * content: {
79
+ * 'application/json': {
80
+ * schema: { $ref: '#/components/schemas/User' }
81
+ * }
82
+ * }
83
+ * }
84
+ * },
85
+ * pathItem: validPathItem
86
+ * };
87
+ *
88
+ * const validated = v.parse(oasOperationData, operation);
89
+ * console.log(validated.operationId); // 'getUserById'
90
+ * ```
91
+ *
92
+ * @example Validating a POST operation with request body
93
+ * ```typescript
94
+ * const postOperation = {
95
+ * oasType: 'operation',
96
+ * path: '/api/users',
97
+ * method: 'post',
98
+ * operationId: 'createUser',
99
+ * requestBody: {
100
+ * description: 'User data',
101
+ * required: true,
102
+ * content: {
103
+ * 'application/json': {
104
+ * schema: { $ref: '#/components/schemas/CreateUserRequest' }
105
+ * }
106
+ * }
107
+ * },
108
+ * responses: {
109
+ * '201': {
110
+ * description: 'User created',
111
+ * content: {
112
+ * 'application/json': {
113
+ * schema: { $ref: '#/components/schemas/User' }
114
+ * }
115
+ * }
116
+ * }
117
+ * },
118
+ * pathItem: validPathItem
119
+ * };
120
+ *
121
+ * const validated = v.parse(oasOperationData, postOperation);
122
+ * console.log(validated.method); // 'post'
123
+ * ```
124
+ *
125
+ * @example Validation error handling
126
+ * ```typescript
127
+ * const invalidOperation = {
128
+ * oasType: 'operation',
129
+ * path: '/api/users',
130
+ * method: 'invalid', // Invalid HTTP method
131
+ * responses: {} // Missing required responses
132
+ * };
133
+ *
134
+ * try {
135
+ * v.parse(oasOperationData, invalidOperation);
136
+ * } catch (error) {
137
+ * console.error('Validation failed:', error.message);
138
+ * // Handle validation errors
139
+ * }
140
+ * ```
141
+ */
44
142
  exports.oasOperationData = v.object({
45
143
  oasType: v.literal('operation'),
46
144
  pathItem: pathItem_types_js_1.oasPathItemData,