@skmtc/core 0.0.790 → 0.0.792

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 (61) hide show
  1. package/esm/helpers/naming.d.ts +65 -1
  2. package/esm/helpers/naming.d.ts.map +1 -1
  3. package/esm/helpers/naming.js +65 -1
  4. package/esm/oas/example/Example.d.ts +81 -1
  5. package/esm/oas/example/Example.d.ts.map +1 -1
  6. package/esm/oas/example/Example.js +74 -1
  7. package/esm/oas/header/Header.d.ts +217 -1
  8. package/esm/oas/header/Header.d.ts.map +1 -1
  9. package/esm/oas/header/Header.js +207 -1
  10. package/esm/oas/info/Info.d.ts +72 -0
  11. package/esm/oas/info/Info.d.ts.map +1 -1
  12. package/esm/oas/info/Info.js +62 -0
  13. package/esm/oas/mediaType/MediaType.d.ts +85 -0
  14. package/esm/oas/mediaType/MediaType.d.ts.map +1 -1
  15. package/esm/oas/mediaType/MediaType.js +77 -0
  16. package/esm/oas/number/Number.d.ts +179 -1
  17. package/esm/oas/number/Number.d.ts.map +1 -1
  18. package/esm/oas/number/Number.js +161 -1
  19. package/esm/oas/pathItem/PathItem.d.ts +92 -0
  20. package/esm/oas/pathItem/PathItem.d.ts.map +1 -1
  21. package/esm/oas/pathItem/PathItem.js +85 -0
  22. package/esm/oas/requestBody/RequestBody.d.ts +264 -0
  23. package/esm/oas/requestBody/RequestBody.d.ts.map +1 -1
  24. package/esm/oas/requestBody/RequestBody.js +257 -0
  25. package/esm/oas/response/Response.d.ts +190 -0
  26. package/esm/oas/response/Response.d.ts.map +1 -1
  27. package/esm/oas/response/Response.js +183 -0
  28. package/esm/oas/void/Void.d.ts +130 -3
  29. package/esm/oas/void/Void.d.ts.map +1 -1
  30. package/esm/oas/void/Void.js +125 -3
  31. package/package.json +1 -1
  32. package/script/helpers/naming.d.ts +65 -1
  33. package/script/helpers/naming.d.ts.map +1 -1
  34. package/script/helpers/naming.js +65 -1
  35. package/script/oas/example/Example.d.ts +81 -1
  36. package/script/oas/example/Example.d.ts.map +1 -1
  37. package/script/oas/example/Example.js +74 -1
  38. package/script/oas/header/Header.d.ts +217 -1
  39. package/script/oas/header/Header.d.ts.map +1 -1
  40. package/script/oas/header/Header.js +207 -1
  41. package/script/oas/info/Info.d.ts +72 -0
  42. package/script/oas/info/Info.d.ts.map +1 -1
  43. package/script/oas/info/Info.js +62 -0
  44. package/script/oas/mediaType/MediaType.d.ts +85 -0
  45. package/script/oas/mediaType/MediaType.d.ts.map +1 -1
  46. package/script/oas/mediaType/MediaType.js +77 -0
  47. package/script/oas/number/Number.d.ts +179 -1
  48. package/script/oas/number/Number.d.ts.map +1 -1
  49. package/script/oas/number/Number.js +161 -1
  50. package/script/oas/pathItem/PathItem.d.ts +92 -0
  51. package/script/oas/pathItem/PathItem.d.ts.map +1 -1
  52. package/script/oas/pathItem/PathItem.js +85 -0
  53. package/script/oas/requestBody/RequestBody.d.ts +264 -0
  54. package/script/oas/requestBody/RequestBody.d.ts.map +1 -1
  55. package/script/oas/requestBody/RequestBody.js +257 -0
  56. package/script/oas/response/Response.d.ts +190 -0
  57. package/script/oas/response/Response.d.ts.map +1 -1
  58. package/script/oas/response/Response.js +183 -0
  59. package/script/oas/void/Void.d.ts +130 -3
  60. package/script/oas/void/Void.d.ts.map +1 -1
  61. package/script/oas/void/Void.js +125 -3
@@ -5,12 +5,202 @@ import type { OasRef } from '../ref/Ref.js';
5
5
  import type { OasSchema } from '../schema/Schema.js';
6
6
  import type { ToJsonSchemaOptions } from '../schema/Schema.js';
7
7
  import type { OpenAPIV3 } from 'openapi-types';
8
+ /**
9
+ * Constructor fields for {@link OasResponse}.
10
+ */
8
11
  export type ResponseFields = {
12
+ /** A description of the response */
9
13
  description?: string | undefined;
14
+ /** Response headers that can be sent */
10
15
  headers?: Record<string, OasHeader | OasRef<'header'>> | undefined;
16
+ /** Response content for different media types */
11
17
  content?: Record<string, OasMediaType> | undefined;
18
+ /** Custom extension fields (x-* properties) */
12
19
  extensionFields?: Record<string, unknown>;
13
20
  };
21
+ /**
22
+ * Represents a Response Object in the OpenAPI Specification.
23
+ *
24
+ * The `OasResponse` class encapsulates the definition of a single HTTP response,
25
+ * including its description, headers, and content for different media types.
26
+ * Responses describe the possible outcomes of API operations and can include
27
+ * both successful and error scenarios.
28
+ *
29
+ * This class provides comprehensive support for response definitions with typed
30
+ * content, custom headers, and multiple media type representations.
31
+ *
32
+ * ## Key Features
33
+ *
34
+ * - **Content Types**: Support for multiple media types (JSON, XML, HTML, etc.)
35
+ * - **Header Definitions**: Custom response headers with validation
36
+ * - **Schema Integration**: Typed response bodies through schema definitions
37
+ * - **Reference Support**: Can reference reusable response components
38
+ * - **Documentation**: Rich description support for API documentation
39
+ * - **JSON Schema**: Converts to standard JSON Schema format for validation
40
+ *
41
+ * @example Basic JSON response
42
+ * ```typescript
43
+ * import { OasResponse, OasMediaType, OasObject, OasString } from '@skmtc/core';
44
+ *
45
+ * const successResponse = new OasResponse({
46
+ * description: 'User retrieved successfully',
47
+ * content: {
48
+ * 'application/json': new OasMediaType({
49
+ * schema: new OasObject({
50
+ * properties: {
51
+ * id: new OasString(),
52
+ * name: new OasString(),
53
+ * email: new OasString({ format: 'email' })
54
+ * }
55
+ * })
56
+ * })
57
+ * }
58
+ * });
59
+ * ```
60
+ *
61
+ * @example Response with custom headers
62
+ * ```typescript
63
+ * const paginatedResponse = new OasResponse({
64
+ * description: 'Paginated list of items',
65
+ * headers: {
66
+ * 'X-Total-Count': new OasHeader({
67
+ * description: 'Total number of items',
68
+ * schema: new OasInteger({ minimum: 0 })
69
+ * }),
70
+ * 'X-Page-Number': new OasHeader({
71
+ * description: 'Current page number',
72
+ * schema: new OasInteger({ minimum: 1 })
73
+ * }),
74
+ * 'Link': new OasHeader({
75
+ * description: 'Pagination links',
76
+ * schema: new OasString()
77
+ * })
78
+ * },
79
+ * content: {
80
+ * 'application/json': new OasMediaType({
81
+ * schema: new OasArray({
82
+ * items: new OasRef({ $ref: '#/components/schemas/Item' })
83
+ * })
84
+ * })
85
+ * }
86
+ * });
87
+ * ```
88
+ *
89
+ * @example Multiple content types
90
+ * ```typescript
91
+ * const multiFormatResponse = new OasResponse({
92
+ * description: 'User data in multiple formats',
93
+ * content: {
94
+ * 'application/json': new OasMediaType({
95
+ * schema: new OasRef({ $ref: '#/components/schemas/User' })
96
+ * }),
97
+ * 'application/xml': new OasMediaType({
98
+ * schema: new OasObject({
99
+ * // XML-specific schema definition
100
+ * properties: {
101
+ * user: new OasRef({ $ref: '#/components/schemas/User' })
102
+ * }
103
+ * })
104
+ * }),
105
+ * 'text/csv': new OasMediaType({
106
+ * schema: new OasString({
107
+ * description: 'User data in CSV format'
108
+ * })
109
+ * })
110
+ * }
111
+ * });
112
+ * ```
113
+ *
114
+ * @example Error responses
115
+ * ```typescript
116
+ * const errorResponse = new OasResponse({
117
+ * description: 'Validation error occurred',
118
+ * content: {
119
+ * 'application/json': new OasMediaType({
120
+ * schema: new OasObject({
121
+ * properties: {
122
+ * error: new OasString({ description: 'Error message' }),
123
+ * code: new OasString({ description: 'Error code' }),
124
+ * details: new OasArray({
125
+ * items: new OasObject({
126
+ * properties: {
127
+ * field: new OasString(),
128
+ * message: new OasString()
129
+ * }
130
+ * })
131
+ * })
132
+ * },
133
+ * required: ['error', 'code']
134
+ * })
135
+ * })
136
+ * }
137
+ * });
138
+ * ```
139
+ *
140
+ * @example File download response
141
+ * ```typescript
142
+ * const fileDownloadResponse = new OasResponse({
143
+ * description: 'File download',
144
+ * headers: {
145
+ * 'Content-Disposition': new OasHeader({
146
+ * description: 'Attachment filename',
147
+ * schema: new OasString({ example: 'attachment; filename="report.pdf"' })
148
+ * }),
149
+ * 'Content-Length': new OasHeader({
150
+ * description: 'File size in bytes',
151
+ * schema: new OasInteger({ minimum: 0 })
152
+ * })
153
+ * },
154
+ * content: {
155
+ * 'application/pdf': new OasMediaType({
156
+ * schema: new OasString({
157
+ * format: 'binary',
158
+ * description: 'PDF file content'
159
+ * })
160
+ * }),
161
+ * 'application/octet-stream': new OasMediaType({
162
+ * schema: new OasString({
163
+ * format: 'binary',
164
+ * description: 'Generic binary content'
165
+ * })
166
+ * })
167
+ * }
168
+ * });
169
+ * ```
170
+ *
171
+ * @example No content response
172
+ * ```typescript
173
+ * const noContentResponse = new OasResponse({
174
+ * description: 'Operation completed successfully, no content returned'
175
+ * // No content or headers - represents HTTP 204 No Content
176
+ * });
177
+ * ```
178
+ *
179
+ * @example Using in operation definitions
180
+ * ```typescript
181
+ * const getUserOperation = new OasOperation({
182
+ * path: '/users/{id}',
183
+ * method: 'get',
184
+ * responses: {
185
+ * '200': successResponse,
186
+ * '404': new OasResponse({
187
+ * description: 'User not found',
188
+ * content: {
189
+ * 'application/json': new OasMediaType({
190
+ * schema: new OasObject({
191
+ * properties: {
192
+ * error: new OasString({ example: 'User not found' }),
193
+ * code: new OasString({ example: 'USER_NOT_FOUND' })
194
+ * }
195
+ * })
196
+ * })
197
+ * }
198
+ * }),
199
+ * '500': new OasRef({ $ref: '#/components/responses/InternalServerError' })
200
+ * }
201
+ * });
202
+ * ```
203
+ */
14
204
  export declare class OasResponse {
15
205
  oasType: 'response';
16
206
  description: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Response.d.ts","sourceRoot":"","sources":["../../../src/oas/response/Response.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,CAAC,E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AAW;IAItB,WAAW,IAAI,WAAW;IAI1B,QAAQ,CAAC,SAAS,GAAE,MAA2B,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAI1F,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,cAAc;CAqBrE"}
@@ -1,4 +1,187 @@
1
1
  import "../../_dnt.polyfills.js";
2
+ /**
3
+ * Represents a Response Object in the OpenAPI Specification.
4
+ *
5
+ * The `OasResponse` class encapsulates the definition of a single HTTP response,
6
+ * including its description, headers, and content for different media types.
7
+ * Responses describe the possible outcomes of API operations and can include
8
+ * both successful and error scenarios.
9
+ *
10
+ * This class provides comprehensive support for response definitions with typed
11
+ * content, custom headers, and multiple media type representations.
12
+ *
13
+ * ## Key Features
14
+ *
15
+ * - **Content Types**: Support for multiple media types (JSON, XML, HTML, etc.)
16
+ * - **Header Definitions**: Custom response headers with validation
17
+ * - **Schema Integration**: Typed response bodies through schema definitions
18
+ * - **Reference Support**: Can reference reusable response components
19
+ * - **Documentation**: Rich description support for API documentation
20
+ * - **JSON Schema**: Converts to standard JSON Schema format for validation
21
+ *
22
+ * @example Basic JSON response
23
+ * ```typescript
24
+ * import { OasResponse, OasMediaType, OasObject, OasString } from '@skmtc/core';
25
+ *
26
+ * const successResponse = new OasResponse({
27
+ * description: 'User retrieved successfully',
28
+ * content: {
29
+ * 'application/json': new OasMediaType({
30
+ * schema: new OasObject({
31
+ * properties: {
32
+ * id: new OasString(),
33
+ * name: new OasString(),
34
+ * email: new OasString({ format: 'email' })
35
+ * }
36
+ * })
37
+ * })
38
+ * }
39
+ * });
40
+ * ```
41
+ *
42
+ * @example Response with custom headers
43
+ * ```typescript
44
+ * const paginatedResponse = new OasResponse({
45
+ * description: 'Paginated list of items',
46
+ * headers: {
47
+ * 'X-Total-Count': new OasHeader({
48
+ * description: 'Total number of items',
49
+ * schema: new OasInteger({ minimum: 0 })
50
+ * }),
51
+ * 'X-Page-Number': new OasHeader({
52
+ * description: 'Current page number',
53
+ * schema: new OasInteger({ minimum: 1 })
54
+ * }),
55
+ * 'Link': new OasHeader({
56
+ * description: 'Pagination links',
57
+ * schema: new OasString()
58
+ * })
59
+ * },
60
+ * content: {
61
+ * 'application/json': new OasMediaType({
62
+ * schema: new OasArray({
63
+ * items: new OasRef({ $ref: '#/components/schemas/Item' })
64
+ * })
65
+ * })
66
+ * }
67
+ * });
68
+ * ```
69
+ *
70
+ * @example Multiple content types
71
+ * ```typescript
72
+ * const multiFormatResponse = new OasResponse({
73
+ * description: 'User data in multiple formats',
74
+ * content: {
75
+ * 'application/json': new OasMediaType({
76
+ * schema: new OasRef({ $ref: '#/components/schemas/User' })
77
+ * }),
78
+ * 'application/xml': new OasMediaType({
79
+ * schema: new OasObject({
80
+ * // XML-specific schema definition
81
+ * properties: {
82
+ * user: new OasRef({ $ref: '#/components/schemas/User' })
83
+ * }
84
+ * })
85
+ * }),
86
+ * 'text/csv': new OasMediaType({
87
+ * schema: new OasString({
88
+ * description: 'User data in CSV format'
89
+ * })
90
+ * })
91
+ * }
92
+ * });
93
+ * ```
94
+ *
95
+ * @example Error responses
96
+ * ```typescript
97
+ * const errorResponse = new OasResponse({
98
+ * description: 'Validation error occurred',
99
+ * content: {
100
+ * 'application/json': new OasMediaType({
101
+ * schema: new OasObject({
102
+ * properties: {
103
+ * error: new OasString({ description: 'Error message' }),
104
+ * code: new OasString({ description: 'Error code' }),
105
+ * details: new OasArray({
106
+ * items: new OasObject({
107
+ * properties: {
108
+ * field: new OasString(),
109
+ * message: new OasString()
110
+ * }
111
+ * })
112
+ * })
113
+ * },
114
+ * required: ['error', 'code']
115
+ * })
116
+ * })
117
+ * }
118
+ * });
119
+ * ```
120
+ *
121
+ * @example File download response
122
+ * ```typescript
123
+ * const fileDownloadResponse = new OasResponse({
124
+ * description: 'File download',
125
+ * headers: {
126
+ * 'Content-Disposition': new OasHeader({
127
+ * description: 'Attachment filename',
128
+ * schema: new OasString({ example: 'attachment; filename="report.pdf"' })
129
+ * }),
130
+ * 'Content-Length': new OasHeader({
131
+ * description: 'File size in bytes',
132
+ * schema: new OasInteger({ minimum: 0 })
133
+ * })
134
+ * },
135
+ * content: {
136
+ * 'application/pdf': new OasMediaType({
137
+ * schema: new OasString({
138
+ * format: 'binary',
139
+ * description: 'PDF file content'
140
+ * })
141
+ * }),
142
+ * 'application/octet-stream': new OasMediaType({
143
+ * schema: new OasString({
144
+ * format: 'binary',
145
+ * description: 'Generic binary content'
146
+ * })
147
+ * })
148
+ * }
149
+ * });
150
+ * ```
151
+ *
152
+ * @example No content response
153
+ * ```typescript
154
+ * const noContentResponse = new OasResponse({
155
+ * description: 'Operation completed successfully, no content returned'
156
+ * // No content or headers - represents HTTP 204 No Content
157
+ * });
158
+ * ```
159
+ *
160
+ * @example Using in operation definitions
161
+ * ```typescript
162
+ * const getUserOperation = new OasOperation({
163
+ * path: '/users/{id}',
164
+ * method: 'get',
165
+ * responses: {
166
+ * '200': successResponse,
167
+ * '404': new OasResponse({
168
+ * description: 'User not found',
169
+ * content: {
170
+ * 'application/json': new OasMediaType({
171
+ * schema: new OasObject({
172
+ * properties: {
173
+ * error: new OasString({ example: 'User not found' }),
174
+ * code: new OasString({ example: 'USER_NOT_FOUND' })
175
+ * }
176
+ * })
177
+ * })
178
+ * }
179
+ * }),
180
+ * '500': new OasRef({ $ref: '#/components/responses/InternalServerError' })
181
+ * }
182
+ * });
183
+ * ```
184
+ */
2
185
  export class OasResponse {
3
186
  constructor(fields) {
4
187
  Object.defineProperty(this, "oasType", {
@@ -1,13 +1,140 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  import type { OasRef } from '../ref/Ref.js';
3
+ /**
4
+ * Constructor fields for {@link OasVoid}.
5
+ */
3
6
  export type VoidFields = {
7
+ /** A short summary of the void schema */
4
8
  title?: string;
9
+ /** A description of what the void represents */
5
10
  description?: string;
6
11
  };
7
12
  /**
8
- * Object representing a void type in the OpenAPI Specification.
9
- * It is used to describe an absence of a value such as when no
10
- * content is returned by an operation.
13
+ * Represents a void (empty) schema in the OpenAPI Specification.
14
+ *
15
+ * The `OasVoid` class represents the absence of a value or content, commonly used
16
+ * in scenarios where operations don't return any content (like HTTP 204 No Content
17
+ * responses), optional properties that might not be present, or fallback cases
18
+ * in schema processing where no specific type is defined.
19
+ *
20
+ * This class serves as a type-safe representation of "nothing" in the OpenAPI
21
+ * type system, enabling proper handling of void responses and empty schemas
22
+ * throughout the SKMTC pipeline.
23
+ *
24
+ * ## Key Features
25
+ *
26
+ * - **Empty Content Representation**: Models operations that return no content
27
+ * - **Type Safety**: Provides a concrete type for void/empty scenarios
28
+ * - **Schema Processing**: Handles missing or undefined schema definitions
29
+ * - **Factory Pattern**: Convenient `empty()` static method for common usage
30
+ * - **Pipeline Integration**: Works seamlessly with the SKMTC processing pipeline
31
+ *
32
+ * @example Basic void schema for empty responses
33
+ * ```typescript
34
+ * import { OasVoid } from '@skmtc/core';
35
+ *
36
+ * const emptyResponse = new OasVoid({
37
+ * title: 'No Content',
38
+ * description: 'Operation completed successfully with no response body'
39
+ * });
40
+ *
41
+ * // Used for HTTP 204 No Content responses
42
+ * ```
43
+ *
44
+ * @example Using the empty factory method
45
+ * ```typescript
46
+ * const voidSchema = OasVoid.empty();
47
+ *
48
+ * // Equivalent to new OasVoid({})
49
+ * // Commonly used as a fallback or placeholder
50
+ * ```
51
+ *
52
+ * @example In operation responses
53
+ * ```typescript
54
+ * const deleteOperation = new OasOperation({
55
+ * path: '/users/{id}',
56
+ * method: 'delete',
57
+ * responses: {
58
+ * '204': new OasResponse({
59
+ * description: 'User deleted successfully',
60
+ * content: {
61
+ * // No content for successful deletion
62
+ * }
63
+ * }),
64
+ * '404': new OasResponse({
65
+ * description: 'User not found'
66
+ * })
67
+ * }
68
+ * });
69
+ *
70
+ * // The void response indicates successful deletion with no return value
71
+ * ```
72
+ *
73
+ * @example As a schema fallback
74
+ * ```typescript
75
+ * function processSchema(schema: OasSchema | undefined): OasSchema {
76
+ * if (!schema) {
77
+ * return OasVoid.empty(); // Fallback for missing schemas
78
+ * }
79
+ * return schema;
80
+ * }
81
+ *
82
+ * // Ensures type safety even when schemas are missing
83
+ * ```
84
+ *
85
+ * @example In optional object properties
86
+ * ```typescript
87
+ * const userProfile = new OasObject({
88
+ * properties: {
89
+ * name: new OasString({ description: 'User name' }),
90
+ * avatar: new OasString({
91
+ * description: 'Avatar URL',
92
+ * nullable: true
93
+ * }),
94
+ * // Some properties might be processed as void if not defined
95
+ * metadata: processOptionalSchema(rawSchema.metadata) // might return OasVoid
96
+ * }
97
+ * });
98
+ * ```
99
+ *
100
+ * @example HTTP operations with void responses
101
+ * ```typescript
102
+ * // Common HTTP operations that return void/empty content:
103
+ *
104
+ * // DELETE - Resource removal
105
+ * const deleteResponse = new OasVoid({
106
+ * title: 'Deletion Successful',
107
+ * description: 'Resource was successfully deleted'
108
+ * });
109
+ *
110
+ * // PUT - Update with no response body
111
+ * const updateResponse = new OasVoid({
112
+ * title: 'Update Successful',
113
+ * description: 'Resource was successfully updated'
114
+ * });
115
+ *
116
+ * // POST - Action with no return value
117
+ * const actionResponse = new OasVoid({
118
+ * title: 'Action Completed',
119
+ * description: 'Action was successfully performed'
120
+ * });
121
+ * ```
122
+ *
123
+ * @example In code generation
124
+ * ```typescript
125
+ * class TypeScriptGenerator extends ModelBase {
126
+ * generateType(schema: OasSchema): string {
127
+ * if (schema.type === 'void') {
128
+ * return 'void'; // TypeScript void type
129
+ * }
130
+ * // Handle other types...
131
+ * return 'unknown';
132
+ * }
133
+ * }
134
+ *
135
+ * // Generates:
136
+ * // async function deleteUser(id: string): Promise<void>
137
+ * ```
11
138
  */
12
139
  export declare class OasVoid {
13
140
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Void.d.ts","sourceRoot":"","sources":["../../../src/oas/void/Void.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM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,CAAC,KAAK,IAAI,OAAO;IAIvB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,OAAO;IAIlB,WAAW,IAAI,OAAO;CAGvB"}
@@ -1,8 +1,130 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  /**
3
- * Object representing a void type in the OpenAPI Specification.
4
- * It is used to describe an absence of a value such as when no
5
- * content is returned by an operation.
3
+ * Represents a void (empty) schema in the OpenAPI Specification.
4
+ *
5
+ * The `OasVoid` class represents the absence of a value or content, commonly used
6
+ * in scenarios where operations don't return any content (like HTTP 204 No Content
7
+ * responses), optional properties that might not be present, or fallback cases
8
+ * in schema processing where no specific type is defined.
9
+ *
10
+ * This class serves as a type-safe representation of "nothing" in the OpenAPI
11
+ * type system, enabling proper handling of void responses and empty schemas
12
+ * throughout the SKMTC pipeline.
13
+ *
14
+ * ## Key Features
15
+ *
16
+ * - **Empty Content Representation**: Models operations that return no content
17
+ * - **Type Safety**: Provides a concrete type for void/empty scenarios
18
+ * - **Schema Processing**: Handles missing or undefined schema definitions
19
+ * - **Factory Pattern**: Convenient `empty()` static method for common usage
20
+ * - **Pipeline Integration**: Works seamlessly with the SKMTC processing pipeline
21
+ *
22
+ * @example Basic void schema for empty responses
23
+ * ```typescript
24
+ * import { OasVoid } from '@skmtc/core';
25
+ *
26
+ * const emptyResponse = new OasVoid({
27
+ * title: 'No Content',
28
+ * description: 'Operation completed successfully with no response body'
29
+ * });
30
+ *
31
+ * // Used for HTTP 204 No Content responses
32
+ * ```
33
+ *
34
+ * @example Using the empty factory method
35
+ * ```typescript
36
+ * const voidSchema = OasVoid.empty();
37
+ *
38
+ * // Equivalent to new OasVoid({})
39
+ * // Commonly used as a fallback or placeholder
40
+ * ```
41
+ *
42
+ * @example In operation responses
43
+ * ```typescript
44
+ * const deleteOperation = new OasOperation({
45
+ * path: '/users/{id}',
46
+ * method: 'delete',
47
+ * responses: {
48
+ * '204': new OasResponse({
49
+ * description: 'User deleted successfully',
50
+ * content: {
51
+ * // No content for successful deletion
52
+ * }
53
+ * }),
54
+ * '404': new OasResponse({
55
+ * description: 'User not found'
56
+ * })
57
+ * }
58
+ * });
59
+ *
60
+ * // The void response indicates successful deletion with no return value
61
+ * ```
62
+ *
63
+ * @example As a schema fallback
64
+ * ```typescript
65
+ * function processSchema(schema: OasSchema | undefined): OasSchema {
66
+ * if (!schema) {
67
+ * return OasVoid.empty(); // Fallback for missing schemas
68
+ * }
69
+ * return schema;
70
+ * }
71
+ *
72
+ * // Ensures type safety even when schemas are missing
73
+ * ```
74
+ *
75
+ * @example In optional object properties
76
+ * ```typescript
77
+ * const userProfile = new OasObject({
78
+ * properties: {
79
+ * name: new OasString({ description: 'User name' }),
80
+ * avatar: new OasString({
81
+ * description: 'Avatar URL',
82
+ * nullable: true
83
+ * }),
84
+ * // Some properties might be processed as void if not defined
85
+ * metadata: processOptionalSchema(rawSchema.metadata) // might return OasVoid
86
+ * }
87
+ * });
88
+ * ```
89
+ *
90
+ * @example HTTP operations with void responses
91
+ * ```typescript
92
+ * // Common HTTP operations that return void/empty content:
93
+ *
94
+ * // DELETE - Resource removal
95
+ * const deleteResponse = new OasVoid({
96
+ * title: 'Deletion Successful',
97
+ * description: 'Resource was successfully deleted'
98
+ * });
99
+ *
100
+ * // PUT - Update with no response body
101
+ * const updateResponse = new OasVoid({
102
+ * title: 'Update Successful',
103
+ * description: 'Resource was successfully updated'
104
+ * });
105
+ *
106
+ * // POST - Action with no return value
107
+ * const actionResponse = new OasVoid({
108
+ * title: 'Action Completed',
109
+ * description: 'Action was successfully performed'
110
+ * });
111
+ * ```
112
+ *
113
+ * @example In code generation
114
+ * ```typescript
115
+ * class TypeScriptGenerator extends ModelBase {
116
+ * generateType(schema: OasSchema): string {
117
+ * if (schema.type === 'void') {
118
+ * return 'void'; // TypeScript void type
119
+ * }
120
+ * // Handle other types...
121
+ * return 'unknown';
122
+ * }
123
+ * }
124
+ *
125
+ * // Generates:
126
+ * // async function deleteUser(id: string): Promise<void>
127
+ * ```
6
128
  */
7
129
  export class OasVoid {
8
130
  constructor(fields = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.790",
3
+ "version": "0.0.792",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/skmtc/skmtc.git"