@skmtc/core 0.0.791 → 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 (43) 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/pathItem/PathItem.d.ts +92 -0
  17. package/esm/oas/pathItem/PathItem.d.ts.map +1 -1
  18. package/esm/oas/pathItem/PathItem.js +85 -0
  19. package/esm/oas/requestBody/RequestBody.d.ts +264 -0
  20. package/esm/oas/requestBody/RequestBody.d.ts.map +1 -1
  21. package/esm/oas/requestBody/RequestBody.js +257 -0
  22. package/package.json +1 -1
  23. package/script/helpers/naming.d.ts +65 -1
  24. package/script/helpers/naming.d.ts.map +1 -1
  25. package/script/helpers/naming.js +65 -1
  26. package/script/oas/example/Example.d.ts +81 -1
  27. package/script/oas/example/Example.d.ts.map +1 -1
  28. package/script/oas/example/Example.js +74 -1
  29. package/script/oas/header/Header.d.ts +217 -1
  30. package/script/oas/header/Header.d.ts.map +1 -1
  31. package/script/oas/header/Header.js +207 -1
  32. package/script/oas/info/Info.d.ts +72 -0
  33. package/script/oas/info/Info.d.ts.map +1 -1
  34. package/script/oas/info/Info.js +62 -0
  35. package/script/oas/mediaType/MediaType.d.ts +85 -0
  36. package/script/oas/mediaType/MediaType.d.ts.map +1 -1
  37. package/script/oas/mediaType/MediaType.js +77 -0
  38. package/script/oas/pathItem/PathItem.d.ts +92 -0
  39. package/script/oas/pathItem/PathItem.d.ts.map +1 -1
  40. package/script/oas/pathItem/PathItem.js +85 -0
  41. package/script/oas/requestBody/RequestBody.d.ts +264 -0
  42. package/script/oas/requestBody/RequestBody.d.ts.map +1 -1
  43. package/script/oas/requestBody/RequestBody.js +257 -0
@@ -1,6 +1,91 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OasPathItem = void 0;
4
+ /**
5
+ * Represents a Path Item Object in the OpenAPI Specification.
6
+ *
7
+ * The `OasPathItem` class describes operations available on a single API path.
8
+ * It serves as a container for HTTP operations (GET, POST, PUT, DELETE, etc.)
9
+ * and can define parameters that apply to all operations on the path.
10
+ *
11
+ * This class provides path-level configuration and shared parameters that
12
+ * reduce duplication across operations on the same endpoint.
13
+ *
14
+ * ## Key Features
15
+ *
16
+ * - **Operation Container**: Groups HTTP methods for a single path
17
+ * - **Shared Parameters**: Path-level parameters for all operations
18
+ * - **Documentation**: Summary and description for the path
19
+ * - **Extension Support**: Custom fields for additional metadata
20
+ * - **Parameter Inheritance**: Parameters shared across all operations
21
+ *
22
+ * @example Basic path item with shared parameters
23
+ * ```typescript
24
+ * import { OasPathItem, OasParameter, OasString } from '@skmtc/core';
25
+ *
26
+ * const userPathItem = new OasPathItem({
27
+ * summary: 'User operations',
28
+ * description: 'Operations for managing individual users',
29
+ * parameters: [
30
+ * new OasParameter({
31
+ * name: 'userId',
32
+ * in: 'path',
33
+ * required: true,
34
+ * schema: new OasString({ format: 'uuid' }),
35
+ * description: 'Unique identifier for the user'
36
+ * })
37
+ * ]
38
+ * });
39
+ * ```
40
+ *
41
+ * @example Path with common headers
42
+ * ```typescript
43
+ * const apiPathItem = new OasPathItem({
44
+ * summary: 'API endpoint',
45
+ * description: 'Authenticated endpoint requiring API key',
46
+ * parameters: [
47
+ * new OasParameter({
48
+ * name: 'Authorization',
49
+ * in: 'header',
50
+ * required: true,
51
+ * schema: new OasString({ pattern: '^Bearer .+$' }),
52
+ * description: 'Bearer token for authentication'
53
+ * }),
54
+ * new OasParameter({
55
+ * name: 'Accept-Version',
56
+ * in: 'header',
57
+ * required: false,
58
+ * schema: new OasString({ enum: ['v1', 'v2'] }),
59
+ * description: 'API version preference'
60
+ * })
61
+ * ]
62
+ * });
63
+ * ```
64
+ *
65
+ * @example RESTful resource path
66
+ * ```typescript
67
+ * const resourcePathItem = new OasPathItem({
68
+ * summary: 'Product resource',
69
+ * description: 'CRUD operations for product management',
70
+ * parameters: [
71
+ * new OasParameter({
72
+ * name: 'productId',
73
+ * in: 'path',
74
+ * required: true,
75
+ * schema: new OasInteger({ minimum: 1 }),
76
+ * description: 'Product identifier'
77
+ * }),
78
+ * new OasParameter({
79
+ * name: 'include',
80
+ * in: 'query',
81
+ * required: false,
82
+ * schema: new OasString({ enum: ['details', 'reviews', 'images'] }),
83
+ * description: 'Additional data to include in response'
84
+ * })
85
+ * ]
86
+ * });
87
+ * ```
88
+ */
4
89
  class OasPathItem {
5
90
  constructor(fields = {}) {
6
91
  Object.defineProperty(this, "oasType", {
@@ -4,12 +4,276 @@ import type { OasRef } from '../ref/Ref.js';
4
4
  import type { OasSchema } from '../schema/Schema.js';
5
5
  import type { ToJsonSchemaOptions } from '../schema/Schema.js';
6
6
  import type { OpenAPIV3 } from 'openapi-types';
7
+ /**
8
+ * Constructor fields for {@link OasRequestBody}.
9
+ */
7
10
  export type RequestBodyFields = {
11
+ /** A description of the request body */
8
12
  description?: string | undefined;
13
+ /** Request content for different media types */
9
14
  content: Record<string, OasMediaType>;
15
+ /** Whether the request body is required */
10
16
  required?: boolean | undefined;
17
+ /** Custom extension fields (x-* properties) */
11
18
  extensionFields?: Record<string, unknown>;
12
19
  };
20
+ /**
21
+ * Represents a Request Body Object in the OpenAPI Specification.
22
+ *
23
+ * The `OasRequestBody` class encapsulates the definition of a request body that
24
+ * can be sent with HTTP operations. It supports multiple content types, schema
25
+ * validation, and can be marked as required or optional. Request bodies are
26
+ * commonly used with POST, PUT, PATCH, and sometimes DELETE operations.
27
+ *
28
+ * This class provides comprehensive support for request body definitions with
29
+ * typed content, multiple media type representations, and proper validation.
30
+ *
31
+ * ## Key Features
32
+ *
33
+ * - **Multiple Content Types**: Support for JSON, XML, form data, binary, and more
34
+ * - **Schema Validation**: Typed request bodies through schema definitions
35
+ * - **Required/Optional**: Control whether the request body is mandatory
36
+ * - **Reference Support**: Can reference reusable request body components
37
+ * - **Documentation**: Rich description support for API documentation
38
+ * - **Media Type Flexibility**: Different schemas for different content types
39
+ *
40
+ * @example Basic JSON request body
41
+ * ```typescript
42
+ * import { OasRequestBody, OasMediaType, OasObject, OasString } from '@skmtc/core';
43
+ *
44
+ * const createUserRequest = new OasRequestBody({
45
+ * description: 'User data for creating a new user account',
46
+ * required: true,
47
+ * content: {
48
+ * 'application/json': new OasMediaType({
49
+ * schema: new OasObject({
50
+ * properties: {
51
+ * name: new OasString({
52
+ * description: 'Full name',
53
+ * minLength: 1,
54
+ * maxLength: 100
55
+ * }),
56
+ * email: new OasString({
57
+ * format: 'email',
58
+ * description: 'Email address'
59
+ * }),
60
+ * password: new OasString({
61
+ * minLength: 8,
62
+ * description: 'Account password'
63
+ * })
64
+ * },
65
+ * required: ['name', 'email', 'password']
66
+ * })
67
+ * })
68
+ * }
69
+ * });
70
+ * ```
71
+ *
72
+ * @example Multiple content types
73
+ * ```typescript
74
+ * const multiFormatRequest = new OasRequestBody({
75
+ * description: 'Product data in multiple formats',
76
+ * required: true,
77
+ * content: {
78
+ * 'application/json': new OasMediaType({
79
+ * schema: new OasRef({ $ref: '#/components/schemas/Product' })
80
+ * }),
81
+ * 'application/xml': new OasMediaType({
82
+ * schema: new OasObject({
83
+ * properties: {
84
+ * product: new OasRef({ $ref: '#/components/schemas/Product' })
85
+ * }
86
+ * })
87
+ * }),
88
+ * 'application/x-www-form-urlencoded': new OasMediaType({
89
+ * schema: new OasObject({
90
+ * properties: {
91
+ * name: new OasString(),
92
+ * price: new OasNumber({ format: 'double' }),
93
+ * category_id: new OasInteger()
94
+ * }
95
+ * })
96
+ * })
97
+ * }
98
+ * });
99
+ * ```
100
+ *
101
+ * @example File upload request body
102
+ * ```typescript
103
+ * const fileUploadRequest = new OasRequestBody({
104
+ * description: 'File upload with metadata',
105
+ * required: true,
106
+ * content: {
107
+ * 'multipart/form-data': new OasMediaType({
108
+ * schema: new OasObject({
109
+ * properties: {
110
+ * file: new OasString({
111
+ * format: 'binary',
112
+ * description: 'The file to upload'
113
+ * }),
114
+ * filename: new OasString({
115
+ * description: 'Original filename'
116
+ * }),
117
+ * description: new OasString({
118
+ * description: 'File description',
119
+ * required: false
120
+ * }),
121
+ * tags: new OasArray({
122
+ * items: new OasString(),
123
+ * description: 'File tags'
124
+ * })
125
+ * },
126
+ * required: ['file', 'filename']
127
+ * })
128
+ * }),
129
+ * 'application/octet-stream': new OasMediaType({
130
+ * schema: new OasString({
131
+ * format: 'binary',
132
+ * description: 'Raw binary file content'
133
+ * })
134
+ * })
135
+ * }
136
+ * });
137
+ * ```
138
+ *
139
+ * @example Optional request body for updates
140
+ * ```typescript
141
+ * const updateUserRequest = new OasRequestBody({
142
+ * description: 'Partial user data for updates (all fields optional)',
143
+ * required: false, // Request body itself is optional
144
+ * content: {
145
+ * 'application/json': new OasMediaType({
146
+ * schema: new OasObject({
147
+ * properties: {
148
+ * name: new OasString({ description: 'Updated name' }),
149
+ * email: new OasString({
150
+ * format: 'email',
151
+ * description: 'Updated email'
152
+ * }),
153
+ * bio: new OasString({ description: 'User biography' }),
154
+ * preferences: new OasObject({
155
+ * properties: {
156
+ * notifications: new OasBoolean(),
157
+ * theme: new OasString({ enum: ['light', 'dark'] })
158
+ * }
159
+ * })
160
+ * }
161
+ * // No required fields - all updates are optional
162
+ * })
163
+ * })
164
+ * }
165
+ * });
166
+ * ```
167
+ *
168
+ * @example Complex nested data structures
169
+ * ```typescript
170
+ * const orderRequest = new OasRequestBody({
171
+ * description: 'Complete order with items and shipping',
172
+ * required: true,
173
+ * content: {
174
+ * 'application/json': new OasMediaType({
175
+ * schema: new OasObject({
176
+ * properties: {
177
+ * customer: new OasObject({
178
+ * properties: {
179
+ * id: new OasString(),
180
+ * email: new OasString({ format: 'email' })
181
+ * },
182
+ * required: ['id']
183
+ * }),
184
+ * items: new OasArray({
185
+ * items: new OasObject({
186
+ * properties: {
187
+ * productId: new OasString(),
188
+ * quantity: new OasInteger({ minimum: 1 }),
189
+ * customizations: new OasArray({
190
+ * items: new OasString()
191
+ * })
192
+ * },
193
+ * required: ['productId', 'quantity']
194
+ * }),
195
+ * minItems: 1
196
+ * }),
197
+ * shipping: new OasObject({
198
+ * properties: {
199
+ * address: new OasRef({ $ref: '#/components/schemas/Address' }),
200
+ * method: new OasString({ enum: ['standard', 'express', 'overnight'] }),
201
+ * instructions: new OasString()
202
+ * },
203
+ * required: ['address', 'method']
204
+ * }),
205
+ * couponCode: new OasString({ description: 'Optional discount code' })
206
+ * },
207
+ * required: ['customer', 'items', 'shipping']
208
+ * })
209
+ * })
210
+ * }
211
+ * });
212
+ * ```
213
+ *
214
+ * @example Form data with validation
215
+ * ```typescript
216
+ * const registrationForm = new OasRequestBody({
217
+ * description: 'User registration form data',
218
+ * required: true,
219
+ * content: {
220
+ * 'application/x-www-form-urlencoded': new OasMediaType({
221
+ * schema: new OasObject({
222
+ * properties: {
223
+ * username: new OasString({
224
+ * pattern: '^[a-zA-Z0-9_]{3,20}$',
225
+ * description: 'Alphanumeric username, 3-20 characters'
226
+ * }),
227
+ * email: new OasString({
228
+ * format: 'email',
229
+ * description: 'Valid email address'
230
+ * }),
231
+ * password: new OasString({
232
+ * minLength: 8,
233
+ * description: 'Password, minimum 8 characters'
234
+ * }),
235
+ * confirmPassword: new OasString({
236
+ * description: 'Password confirmation'
237
+ * }),
238
+ * agreeToTerms: new OasBoolean({
239
+ * enum: [true],
240
+ * description: 'Must accept terms of service'
241
+ * })
242
+ * },
243
+ * required: ['username', 'email', 'password', 'confirmPassword', 'agreeToTerms']
244
+ * })
245
+ * })
246
+ * }
247
+ * });
248
+ * ```
249
+ *
250
+ * @example Using in operation definitions
251
+ * ```typescript
252
+ * const createProductOperation = new OasOperation({
253
+ * path: '/products',
254
+ * method: 'post',
255
+ * requestBody: createUserRequest,
256
+ * responses: {
257
+ * '201': new OasResponse({
258
+ * description: 'Product created successfully',
259
+ * content: {
260
+ * 'application/json': new OasMediaType({
261
+ * schema: new OasRef({ $ref: '#/components/schemas/Product' })
262
+ * })
263
+ * }
264
+ * }),
265
+ * '400': new OasResponse({
266
+ * description: 'Invalid request data',
267
+ * content: {
268
+ * 'application/json': new OasMediaType({
269
+ * schema: new OasRef({ $ref: '#/components/schemas/ValidationError' })
270
+ * })
271
+ * }
272
+ * })
273
+ * }
274
+ * });
275
+ * ```
276
+ */
13
277
  export declare class OasRequestBody {
14
278
  oasType: 'requestBody';
15
279
  description: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/RequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,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,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,cAAc;IACzB,OAAO,EAAE,aAAa,CAAgB;IACtC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,iBAAiB;IAOrC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,aAAa,CAAC;IAItC,OAAO,IAAI,cAAc;IAIzB,WAAW,IAAI,cAAc;IAI7B,QAAQ,CAAC,SAAS,GAAE,MAA2B,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAI1F,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,iBAAiB;CAYxE"}
1
+ {"version":3,"file":"RequestBody.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/RequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,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;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgQG;AACH,qBAAa,cAAc;IACzB,OAAO,EAAE,aAAa,CAAgB;IACtC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,iBAAiB;IAOrC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,aAAa,CAAC;IAItC,OAAO,IAAI,cAAc;IAIzB,WAAW,IAAI,cAAc;IAI7B,QAAQ,CAAC,SAAS,GAAE,MAA2B,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;IAI1F,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,iBAAiB;CAYxE"}
@@ -2,6 +2,263 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OasRequestBody = void 0;
4
4
  require("../../_dnt.polyfills.js");
5
+ /**
6
+ * Represents a Request Body Object in the OpenAPI Specification.
7
+ *
8
+ * The `OasRequestBody` class encapsulates the definition of a request body that
9
+ * can be sent with HTTP operations. It supports multiple content types, schema
10
+ * validation, and can be marked as required or optional. Request bodies are
11
+ * commonly used with POST, PUT, PATCH, and sometimes DELETE operations.
12
+ *
13
+ * This class provides comprehensive support for request body definitions with
14
+ * typed content, multiple media type representations, and proper validation.
15
+ *
16
+ * ## Key Features
17
+ *
18
+ * - **Multiple Content Types**: Support for JSON, XML, form data, binary, and more
19
+ * - **Schema Validation**: Typed request bodies through schema definitions
20
+ * - **Required/Optional**: Control whether the request body is mandatory
21
+ * - **Reference Support**: Can reference reusable request body components
22
+ * - **Documentation**: Rich description support for API documentation
23
+ * - **Media Type Flexibility**: Different schemas for different content types
24
+ *
25
+ * @example Basic JSON request body
26
+ * ```typescript
27
+ * import { OasRequestBody, OasMediaType, OasObject, OasString } from '@skmtc/core';
28
+ *
29
+ * const createUserRequest = new OasRequestBody({
30
+ * description: 'User data for creating a new user account',
31
+ * required: true,
32
+ * content: {
33
+ * 'application/json': new OasMediaType({
34
+ * schema: new OasObject({
35
+ * properties: {
36
+ * name: new OasString({
37
+ * description: 'Full name',
38
+ * minLength: 1,
39
+ * maxLength: 100
40
+ * }),
41
+ * email: new OasString({
42
+ * format: 'email',
43
+ * description: 'Email address'
44
+ * }),
45
+ * password: new OasString({
46
+ * minLength: 8,
47
+ * description: 'Account password'
48
+ * })
49
+ * },
50
+ * required: ['name', 'email', 'password']
51
+ * })
52
+ * })
53
+ * }
54
+ * });
55
+ * ```
56
+ *
57
+ * @example Multiple content types
58
+ * ```typescript
59
+ * const multiFormatRequest = new OasRequestBody({
60
+ * description: 'Product data in multiple formats',
61
+ * required: true,
62
+ * content: {
63
+ * 'application/json': new OasMediaType({
64
+ * schema: new OasRef({ $ref: '#/components/schemas/Product' })
65
+ * }),
66
+ * 'application/xml': new OasMediaType({
67
+ * schema: new OasObject({
68
+ * properties: {
69
+ * product: new OasRef({ $ref: '#/components/schemas/Product' })
70
+ * }
71
+ * })
72
+ * }),
73
+ * 'application/x-www-form-urlencoded': new OasMediaType({
74
+ * schema: new OasObject({
75
+ * properties: {
76
+ * name: new OasString(),
77
+ * price: new OasNumber({ format: 'double' }),
78
+ * category_id: new OasInteger()
79
+ * }
80
+ * })
81
+ * })
82
+ * }
83
+ * });
84
+ * ```
85
+ *
86
+ * @example File upload request body
87
+ * ```typescript
88
+ * const fileUploadRequest = new OasRequestBody({
89
+ * description: 'File upload with metadata',
90
+ * required: true,
91
+ * content: {
92
+ * 'multipart/form-data': new OasMediaType({
93
+ * schema: new OasObject({
94
+ * properties: {
95
+ * file: new OasString({
96
+ * format: 'binary',
97
+ * description: 'The file to upload'
98
+ * }),
99
+ * filename: new OasString({
100
+ * description: 'Original filename'
101
+ * }),
102
+ * description: new OasString({
103
+ * description: 'File description',
104
+ * required: false
105
+ * }),
106
+ * tags: new OasArray({
107
+ * items: new OasString(),
108
+ * description: 'File tags'
109
+ * })
110
+ * },
111
+ * required: ['file', 'filename']
112
+ * })
113
+ * }),
114
+ * 'application/octet-stream': new OasMediaType({
115
+ * schema: new OasString({
116
+ * format: 'binary',
117
+ * description: 'Raw binary file content'
118
+ * })
119
+ * })
120
+ * }
121
+ * });
122
+ * ```
123
+ *
124
+ * @example Optional request body for updates
125
+ * ```typescript
126
+ * const updateUserRequest = new OasRequestBody({
127
+ * description: 'Partial user data for updates (all fields optional)',
128
+ * required: false, // Request body itself is optional
129
+ * content: {
130
+ * 'application/json': new OasMediaType({
131
+ * schema: new OasObject({
132
+ * properties: {
133
+ * name: new OasString({ description: 'Updated name' }),
134
+ * email: new OasString({
135
+ * format: 'email',
136
+ * description: 'Updated email'
137
+ * }),
138
+ * bio: new OasString({ description: 'User biography' }),
139
+ * preferences: new OasObject({
140
+ * properties: {
141
+ * notifications: new OasBoolean(),
142
+ * theme: new OasString({ enum: ['light', 'dark'] })
143
+ * }
144
+ * })
145
+ * }
146
+ * // No required fields - all updates are optional
147
+ * })
148
+ * })
149
+ * }
150
+ * });
151
+ * ```
152
+ *
153
+ * @example Complex nested data structures
154
+ * ```typescript
155
+ * const orderRequest = new OasRequestBody({
156
+ * description: 'Complete order with items and shipping',
157
+ * required: true,
158
+ * content: {
159
+ * 'application/json': new OasMediaType({
160
+ * schema: new OasObject({
161
+ * properties: {
162
+ * customer: new OasObject({
163
+ * properties: {
164
+ * id: new OasString(),
165
+ * email: new OasString({ format: 'email' })
166
+ * },
167
+ * required: ['id']
168
+ * }),
169
+ * items: new OasArray({
170
+ * items: new OasObject({
171
+ * properties: {
172
+ * productId: new OasString(),
173
+ * quantity: new OasInteger({ minimum: 1 }),
174
+ * customizations: new OasArray({
175
+ * items: new OasString()
176
+ * })
177
+ * },
178
+ * required: ['productId', 'quantity']
179
+ * }),
180
+ * minItems: 1
181
+ * }),
182
+ * shipping: new OasObject({
183
+ * properties: {
184
+ * address: new OasRef({ $ref: '#/components/schemas/Address' }),
185
+ * method: new OasString({ enum: ['standard', 'express', 'overnight'] }),
186
+ * instructions: new OasString()
187
+ * },
188
+ * required: ['address', 'method']
189
+ * }),
190
+ * couponCode: new OasString({ description: 'Optional discount code' })
191
+ * },
192
+ * required: ['customer', 'items', 'shipping']
193
+ * })
194
+ * })
195
+ * }
196
+ * });
197
+ * ```
198
+ *
199
+ * @example Form data with validation
200
+ * ```typescript
201
+ * const registrationForm = new OasRequestBody({
202
+ * description: 'User registration form data',
203
+ * required: true,
204
+ * content: {
205
+ * 'application/x-www-form-urlencoded': new OasMediaType({
206
+ * schema: new OasObject({
207
+ * properties: {
208
+ * username: new OasString({
209
+ * pattern: '^[a-zA-Z0-9_]{3,20}$',
210
+ * description: 'Alphanumeric username, 3-20 characters'
211
+ * }),
212
+ * email: new OasString({
213
+ * format: 'email',
214
+ * description: 'Valid email address'
215
+ * }),
216
+ * password: new OasString({
217
+ * minLength: 8,
218
+ * description: 'Password, minimum 8 characters'
219
+ * }),
220
+ * confirmPassword: new OasString({
221
+ * description: 'Password confirmation'
222
+ * }),
223
+ * agreeToTerms: new OasBoolean({
224
+ * enum: [true],
225
+ * description: 'Must accept terms of service'
226
+ * })
227
+ * },
228
+ * required: ['username', 'email', 'password', 'confirmPassword', 'agreeToTerms']
229
+ * })
230
+ * })
231
+ * }
232
+ * });
233
+ * ```
234
+ *
235
+ * @example Using in operation definitions
236
+ * ```typescript
237
+ * const createProductOperation = new OasOperation({
238
+ * path: '/products',
239
+ * method: 'post',
240
+ * requestBody: createUserRequest,
241
+ * responses: {
242
+ * '201': new OasResponse({
243
+ * description: 'Product created successfully',
244
+ * content: {
245
+ * 'application/json': new OasMediaType({
246
+ * schema: new OasRef({ $ref: '#/components/schemas/Product' })
247
+ * })
248
+ * }
249
+ * }),
250
+ * '400': new OasResponse({
251
+ * description: 'Invalid request data',
252
+ * content: {
253
+ * 'application/json': new OasMediaType({
254
+ * schema: new OasRef({ $ref: '#/components/schemas/ValidationError' })
255
+ * })
256
+ * }
257
+ * })
258
+ * }
259
+ * });
260
+ * ```
261
+ */
5
262
  class OasRequestBody {
6
263
  constructor(fields) {
7
264
  Object.defineProperty(this, "oasType", {