@skmtc/core 0.0.788 → 0.0.790

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 (49) hide show
  1. package/esm/context/ParseContext.d.ts +178 -0
  2. package/esm/context/ParseContext.d.ts.map +1 -1
  3. package/esm/context/ParseContext.js +108 -0
  4. package/esm/context/RenderContext.d.ts +190 -0
  5. package/esm/context/RenderContext.d.ts.map +1 -1
  6. package/esm/context/RenderContext.js +179 -0
  7. package/esm/dsl/Inserted.d.ts +240 -0
  8. package/esm/dsl/Inserted.d.ts.map +1 -1
  9. package/esm/dsl/Inserted.js +231 -0
  10. package/esm/helpers/refFns.d.ts +160 -0
  11. package/esm/helpers/refFns.d.ts.map +1 -1
  12. package/esm/helpers/refFns.js +156 -0
  13. package/esm/oas/boolean/Boolean.d.ts +142 -1
  14. package/esm/oas/boolean/Boolean.d.ts.map +1 -1
  15. package/esm/oas/boolean/Boolean.js +130 -1
  16. package/esm/oas/components/Components.d.ts +252 -2
  17. package/esm/oas/components/Components.d.ts.map +1 -1
  18. package/esm/oas/components/Components.js +241 -2
  19. package/esm/oas/parameter/Parameter.d.ts +160 -0
  20. package/esm/oas/parameter/Parameter.d.ts.map +1 -1
  21. package/esm/oas/parameter/Parameter.js +144 -0
  22. package/esm/oas/union/Union.d.ts +119 -5
  23. package/esm/oas/union/Union.d.ts.map +1 -1
  24. package/esm/oas/union/Union.js +108 -5
  25. package/package.json +1 -1
  26. package/script/context/ParseContext.d.ts +178 -0
  27. package/script/context/ParseContext.d.ts.map +1 -1
  28. package/script/context/ParseContext.js +108 -0
  29. package/script/context/RenderContext.d.ts +190 -0
  30. package/script/context/RenderContext.d.ts.map +1 -1
  31. package/script/context/RenderContext.js +179 -0
  32. package/script/dsl/Inserted.d.ts +240 -0
  33. package/script/dsl/Inserted.d.ts.map +1 -1
  34. package/script/dsl/Inserted.js +231 -0
  35. package/script/helpers/refFns.d.ts +160 -0
  36. package/script/helpers/refFns.d.ts.map +1 -1
  37. package/script/helpers/refFns.js +156 -0
  38. package/script/oas/boolean/Boolean.d.ts +142 -1
  39. package/script/oas/boolean/Boolean.d.ts.map +1 -1
  40. package/script/oas/boolean/Boolean.js +130 -1
  41. package/script/oas/components/Components.d.ts +252 -2
  42. package/script/oas/components/Components.d.ts.map +1 -1
  43. package/script/oas/components/Components.js +241 -2
  44. package/script/oas/parameter/Parameter.d.ts +160 -0
  45. package/script/oas/parameter/Parameter.d.ts.map +1 -1
  46. package/script/oas/parameter/Parameter.js +144 -0
  47. package/script/oas/union/Union.d.ts +119 -5
  48. package/script/oas/union/Union.d.ts.map +1 -1
  49. package/script/oas/union/Union.js +108 -5
@@ -12,6 +12,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _OasComponents_fields;
13
13
  import "../../_dnt.polyfills.js";
14
14
  import "../../_dnt.polyfills.js";
15
+ /**
16
+ * Available component types in an OpenAPI document.
17
+ */
15
18
  export const componentsKeys = [
16
19
  'schemas',
17
20
  'responses',
@@ -21,11 +24,182 @@ export const componentsKeys = [
21
24
  'headers',
22
25
  'securitySchemes'
23
26
  ];
24
- /** Container object for re-usable schema items within the API
27
+ /**
28
+ * Represents the OpenAPI Components Object in the SKMTC OAS processing system.
29
+ *
30
+ * The `OasComponents` class manages the reusable components section of an OpenAPI
31
+ * document, providing centralized access to shared schemas, responses, parameters,
32
+ * and other reusable elements that can be referenced throughout the API specification.
33
+ *
34
+ * This class serves as the central registry for all reusable components, enabling
35
+ * efficient reference resolution and reducing duplication in OpenAPI documents.
36
+ *
37
+ * ## Key Features
38
+ *
39
+ * - **Schema Management**: Central repository for reusable data schemas
40
+ * - **Response Reuse**: Common response definitions for consistent API responses
41
+ * - **Parameter Standardization**: Shared parameter definitions across operations
42
+ * - **Reference Resolution**: Support for internal references ($ref) to components
43
+ * - **Type Safety**: Strongly typed access to different component categories
44
+ * - **Extension Support**: Custom OpenAPI extension field handling
45
+ *
46
+ * @example Basic component access
47
+ * ```typescript
48
+ * import { OasComponents } from '@skmtc/core';
49
+ *
50
+ * // Typically created during document parsing
51
+ * const components = new OasComponents({
52
+ * schemas: {
53
+ * User: new OasObject({
54
+ * properties: {
55
+ * id: new OasString(),
56
+ * name: new OasString()
57
+ * }
58
+ * }),
59
+ * Product: new OasObject({
60
+ * properties: {
61
+ * id: new OasString(),
62
+ * price: new OasNumber()
63
+ * }
64
+ * })
65
+ * },
66
+ * responses: {
67
+ * NotFound: new OasResponse({
68
+ * description: '404 - Resource not found'
69
+ * })
70
+ * }
71
+ * });
72
+ *
73
+ * // Access schemas
74
+ * const userSchema = components.schemas?.['User'];
75
+ * const productSchema = components.schemas?.['Product'];
76
+ *
77
+ * // Access responses
78
+ * const notFoundResponse = components.responses?.['NotFound'];
79
+ * ```
80
+ *
81
+ * @example Schema management
82
+ * ```typescript
83
+ * // Get all schema reference names
84
+ * const schemaNames = components.toSchemasRefNames();
85
+ * console.log(schemaNames); // ['User', 'Product', 'Order']
86
+ *
87
+ * // Remove a schema (useful for processing)
88
+ * const removedSchema = components.removeSchema('ObsoleteSchema');
89
+ * console.log('Removed:', removedSchema);
90
+ *
91
+ * // Check remaining schemas
92
+ * const remainingSchemas = components.toSchemasRefNames();
93
+ * console.log('Remaining:', remainingSchemas);
94
+ * ```
95
+ *
96
+ * @example Parameter reuse
97
+ * ```typescript
98
+ * const components = new OasComponents({
99
+ * parameters: {
100
+ * PageSize: new OasParameter({
101
+ * name: 'pageSize',
102
+ * in: 'query',
103
+ * schema: new OasInteger({ minimum: 1, maximum: 100, default: 20 })
104
+ * }),
105
+ * PageNumber: new OasParameter({
106
+ * name: 'page',
107
+ * in: 'query',
108
+ * schema: new OasInteger({ minimum: 1, default: 1 })
109
+ * })
110
+ * }
111
+ * });
112
+ *
113
+ * // These parameters can be referenced in operations:
114
+ * // $ref: '#/components/parameters/PageSize'
115
+ * // $ref: '#/components/parameters/PageNumber'
116
+ * ```
117
+ *
118
+ * @example Response standardization
119
+ * ```typescript
120
+ * const components = new OasComponents({
121
+ * responses: {
122
+ * Success: new OasResponse({
123
+ * description: 'Successful operation',
124
+ * content: {
125
+ * 'application/json': {
126
+ * schema: new OasObject({
127
+ * properties: {
128
+ * success: new OasBoolean({ default: true }),
129
+ * data: new OasObject({ additionalProperties: true })
130
+ * }
131
+ * })
132
+ * }
133
+ * }
134
+ * }),
135
+ * ValidationError: new OasResponse({
136
+ * description: 'Validation failed',
137
+ * content: {
138
+ * 'application/json': {
139
+ * schema: new OasObject({
140
+ * properties: {
141
+ * error: new OasString(),
142
+ * details: new OasArray({
143
+ * items: new OasString()
144
+ * })
145
+ * }
146
+ * })
147
+ * }
148
+ * }
149
+ * })
150
+ * }
151
+ * });
152
+ *
153
+ * // Standardized responses across all operations
154
+ * ```
155
+ *
156
+ * @example Processing components in generators
157
+ * ```typescript
158
+ * class ComponentProcessor {
159
+ * processDocument(document: OasDocument) {
160
+ * const components = document.components;
161
+ * if (!components) return;
162
+ *
163
+ * // Process all schemas
164
+ * if (components.schemas) {
165
+ * Object.entries(components.schemas).forEach(([name, schema]) => {
166
+ * if (schema.isRef()) {
167
+ * console.log(`Schema ${name} is a reference to ${schema.$ref}`);
168
+ * } else {
169
+ * console.log(`Schema ${name} is a direct definition`);
170
+ * }
171
+ * });
172
+ * }
25
173
  *
26
- * Fields not yet implemented: **securitySchemes**, **links**, **callbacks**
174
+ * // Process parameters
175
+ * if (components.parameters) {
176
+ * Object.keys(components.parameters).forEach(paramName => {
177
+ * console.log(`Reusable parameter: ${paramName}`);
178
+ * });
179
+ * }
180
+ * }
181
+ * }
182
+ * ```
27
183
  */
28
184
  export class OasComponents {
185
+ /**
186
+ * Creates a new OasComponents instance.
187
+ *
188
+ * @param fields - Component definitions (defaults to empty object)
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const components = new OasComponents({
193
+ * schemas: {
194
+ * User: userSchema,
195
+ * Product: productSchema
196
+ * },
197
+ * responses: {
198
+ * NotFound: notFoundResponse
199
+ * }
200
+ * });
201
+ * ```
202
+ */
29
203
  constructor(fields = {}) {
30
204
  /** Static identifier property for OasComponents */
31
205
  Object.defineProperty(this, "oasType", {
@@ -38,6 +212,35 @@ export class OasComponents {
38
212
  _OasComponents_fields.set(this, void 0);
39
213
  __classPrivateFieldSet(this, _OasComponents_fields, fields, "f");
40
214
  }
215
+ /**
216
+ * Gets all schema reference names.
217
+ *
218
+ * This method extracts the keys from the schemas object and returns them
219
+ * as an array of RefName types. Useful for iterating over all available
220
+ * schemas or checking schema availability.
221
+ *
222
+ * @returns Array of reference names for all schemas
223
+ *
224
+ * @example
225
+ * ```typescript
226
+ * const components = new OasComponents({
227
+ * schemas: {
228
+ * User: userSchema,
229
+ * Product: productSchema,
230
+ * Order: orderSchema
231
+ * }
232
+ * });
233
+ *
234
+ * const schemaNames = components.toSchemasRefNames();
235
+ * console.log(schemaNames); // ['User', 'Product', 'Order']
236
+ *
237
+ * // Use for processing
238
+ * schemaNames.forEach(name => {
239
+ * const schema = components.schemas?.[name];
240
+ * console.log(`Processing schema: ${name}`);
241
+ * });
242
+ * ```
243
+ */
41
244
  toSchemasRefNames() {
42
245
  return Object.keys(__classPrivateFieldGet(this, _OasComponents_fields, "f").schemas ?? {});
43
246
  }
@@ -45,6 +248,42 @@ export class OasComponents {
45
248
  get schemas() {
46
249
  return __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas;
47
250
  }
251
+ /**
252
+ * Removes a schema from the components and returns it.
253
+ *
254
+ * This method permanently removes a schema from the components object
255
+ * and returns the removed schema. This is useful during processing when
256
+ * you need to extract and handle specific schemas separately.
257
+ *
258
+ * @param refName - The reference name of the schema to remove
259
+ * @returns The removed schema object or reference
260
+ *
261
+ * @throws {Error} When the schema doesn't exist or schemas object is undefined
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * const components = new OasComponents({
266
+ * schemas: {
267
+ * User: userSchema,
268
+ * Product: productSchema,
269
+ * Internal: internalSchema
270
+ * }
271
+ * });
272
+ *
273
+ * // Remove internal schema that shouldn't be exposed
274
+ * const internalSchema = components.removeSchema('Internal');
275
+ * console.log('Removed internal schema');
276
+ *
277
+ * // Check remaining schemas
278
+ * const remainingSchemas = components.toSchemasRefNames();
279
+ * console.log(remainingSchemas); // ['User', 'Product']
280
+ *
281
+ * // Process removed schema separately
282
+ * if (!internalSchema.isRef()) {
283
+ * console.log('Processing internal schema privately');
284
+ * }
285
+ * ```
286
+ */
48
287
  removeSchema(refName) {
49
288
  const { [refName]: removed, ...rest } = __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas;
50
289
  __classPrivateFieldGet(this, _OasComponents_fields, "f").schemas = rest;
@@ -6,21 +6,181 @@ import type { OasExample } from '../example/Example.js';
6
6
  import type { OasSchema } from '../schema/Schema.js';
7
7
  import type { ToJsonSchemaOptions } from '../schema/Schema.js';
8
8
  import type { OpenAPIV3 } from 'openapi-types';
9
+ /**
10
+ * Constructor fields for {@link OasParameter}.
11
+ */
9
12
  export type ParameterFields = {
13
+ /** The name of the parameter */
10
14
  name: string;
15
+ /** The location of the parameter (path, query, header, cookie) */
11
16
  location: OasParameterLocation;
17
+ /** A brief description of the parameter */
12
18
  description?: string | undefined;
19
+ /** Determines whether this parameter is mandatory */
13
20
  required?: boolean | undefined;
21
+ /** Specifies that the parameter is deprecated */
14
22
  deprecated?: boolean | undefined;
23
+ /** Whether to allow empty values for the parameter */
15
24
  allowEmptyValue?: boolean | undefined;
25
+ /** Whether reserved characters are allowed in the parameter value */
16
26
  allowReserved?: boolean | undefined;
27
+ /** The schema defining the parameter's data type */
17
28
  schema?: OasSchema | OasRef<'schema'> | undefined;
29
+ /** Example values for the parameter */
18
30
  examples?: Record<string, OasExample | OasRef<'example'>> | undefined;
31
+ /** Media type definitions for the parameter content */
19
32
  content?: Record<string, OasMediaType> | undefined;
33
+ /** The serialization style for the parameter */
20
34
  style: OasParameterStyle;
35
+ /** Whether to explode parameter values */
21
36
  explode: boolean;
37
+ /** Custom extension fields (x-* properties) */
22
38
  extensionFields?: Record<string, unknown>;
23
39
  };
40
+ /**
41
+ * Represents a Parameter Object in the OpenAPI Specification.
42
+ *
43
+ * The `OasParameter` class encapsulates the definition of a single operation parameter,
44
+ * including its location, data type, validation rules, and serialization behavior.
45
+ * Parameters can be located in the path, query string, headers, or cookies.
46
+ *
47
+ * This class provides comprehensive support for parameter validation, serialization
48
+ * styles, and complex data types through schema definitions or content specifications.
49
+ *
50
+ * ## Key Features
51
+ *
52
+ * - **Location Support**: Path, query, header, and cookie parameters
53
+ * - **Schema Validation**: Comprehensive data type validation through schemas
54
+ * - **Serialization Styles**: Various parameter serialization formats
55
+ * - **Content Types**: Support for complex parameter content with media types
56
+ * - **Examples & Documentation**: Parameter examples and descriptive documentation
57
+ * - **Advanced Options**: Empty values, reserved characters, and explode behavior
58
+ *
59
+ * @example Basic path parameter
60
+ * ```typescript
61
+ * import { OasParameter, OasString } from '@skmtc/core';
62
+ *
63
+ * const userIdParam = new OasParameter({
64
+ * name: 'userId',
65
+ * location: 'path',
66
+ * description: 'Unique identifier for the user',
67
+ * required: true,
68
+ * schema: new OasString({
69
+ * pattern: '^[0-9a-f]{24}$',
70
+ * example: '507f1f77bcf86cd799439011'
71
+ * }),
72
+ * style: 'simple',
73
+ * explode: false
74
+ * });
75
+ *
76
+ * // Used in path: /users/{userId}
77
+ * ```
78
+ *
79
+ * @example Query parameter with validation
80
+ * ```typescript
81
+ * const pageSizeParam = new OasParameter({
82
+ * name: 'pageSize',
83
+ * location: 'query',
84
+ * description: 'Number of items to return per page',
85
+ * required: false,
86
+ * schema: new OasInteger({
87
+ * minimum: 1,
88
+ * maximum: 100,
89
+ * default: 20
90
+ * }),
91
+ * style: 'form',
92
+ * explode: true,
93
+ * examples: {
94
+ * small: new OasExample({ value: 10 }),
95
+ * medium: new OasExample({ value: 25 }),
96
+ * large: new OasExample({ value: 50 })
97
+ * }
98
+ * });
99
+ *
100
+ * // Used in query: ?pageSize=20
101
+ * ```
102
+ *
103
+ * @example Header parameter
104
+ * ```typescript
105
+ * const authHeaderParam = new OasParameter({
106
+ * name: 'Authorization',
107
+ * location: 'header',
108
+ * description: 'Bearer token for authentication',
109
+ * required: true,
110
+ * schema: new OasString({
111
+ * pattern: '^Bearer [A-Za-z0-9+/=]+$',
112
+ * example: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
113
+ * }),
114
+ * style: 'simple',
115
+ * explode: false
116
+ * });
117
+ * ```
118
+ *
119
+ * @example Complex parameter with content
120
+ * ```typescript
121
+ * const filterParam = new OasParameter({
122
+ * name: 'filter',
123
+ * location: 'query',
124
+ * description: 'Complex filter object',
125
+ * required: false,
126
+ * content: {
127
+ * 'application/json': new OasMediaType({
128
+ * schema: new OasObject({
129
+ * properties: {
130
+ * category: new OasString(),
131
+ * priceRange: new OasObject({
132
+ * properties: {
133
+ * min: new OasNumber(),
134
+ * max: new OasNumber()
135
+ * }
136
+ * })
137
+ * }
138
+ * })
139
+ * })
140
+ * },
141
+ * style: 'deepObject',
142
+ * explode: true
143
+ * });
144
+ *
145
+ * // Used as: ?filter[category]=electronics&filter[priceRange][min]=100
146
+ * ```
147
+ *
148
+ * @example Array parameter with explode
149
+ * ```typescript
150
+ * const tagsParam = new OasParameter({
151
+ * name: 'tags',
152
+ * location: 'query',
153
+ * description: 'Filter by multiple tags',
154
+ * required: false,
155
+ * schema: new OasArray({
156
+ * items: new OasString(),
157
+ * minItems: 1,
158
+ * maxItems: 10
159
+ * }),
160
+ * style: 'form',
161
+ * explode: true // Results in: ?tags=tech&tags=api&tags=rest
162
+ * });
163
+ *
164
+ * // Without explode: ?tags=tech,api,rest
165
+ * // With explode: ?tags=tech&tags=api&tags=rest
166
+ * ```
167
+ *
168
+ * @example Cookie parameter
169
+ * ```typescript
170
+ * const sessionParam = new OasParameter({
171
+ * name: 'sessionId',
172
+ * location: 'cookie',
173
+ * description: 'Session identifier cookie',
174
+ * required: false,
175
+ * schema: new OasString({
176
+ * minLength: 32,
177
+ * maxLength: 128
178
+ * }),
179
+ * style: 'form',
180
+ * explode: false
181
+ * });
182
+ * ```
183
+ */
24
184
  export declare class OasParameter {
25
185
  oasType: 'parameter';
26
186
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/Parameter.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,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;AAK9C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG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CAAC;IAIpC,OAAO,IAAI,YAAY;IAIvB,WAAW,IAAI,YAAY;IAI3B,QAAQ,CAAC,SAAS,GAAE,MAA2B,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAc9E,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;CAuBtE"}
@@ -1,4 +1,148 @@
1
1
  import "../../_dnt.polyfills.js";
2
+ /**
3
+ * Represents a Parameter Object in the OpenAPI Specification.
4
+ *
5
+ * The `OasParameter` class encapsulates the definition of a single operation parameter,
6
+ * including its location, data type, validation rules, and serialization behavior.
7
+ * Parameters can be located in the path, query string, headers, or cookies.
8
+ *
9
+ * This class provides comprehensive support for parameter validation, serialization
10
+ * styles, and complex data types through schema definitions or content specifications.
11
+ *
12
+ * ## Key Features
13
+ *
14
+ * - **Location Support**: Path, query, header, and cookie parameters
15
+ * - **Schema Validation**: Comprehensive data type validation through schemas
16
+ * - **Serialization Styles**: Various parameter serialization formats
17
+ * - **Content Types**: Support for complex parameter content with media types
18
+ * - **Examples & Documentation**: Parameter examples and descriptive documentation
19
+ * - **Advanced Options**: Empty values, reserved characters, and explode behavior
20
+ *
21
+ * @example Basic path parameter
22
+ * ```typescript
23
+ * import { OasParameter, OasString } from '@skmtc/core';
24
+ *
25
+ * const userIdParam = new OasParameter({
26
+ * name: 'userId',
27
+ * location: 'path',
28
+ * description: 'Unique identifier for the user',
29
+ * required: true,
30
+ * schema: new OasString({
31
+ * pattern: '^[0-9a-f]{24}$',
32
+ * example: '507f1f77bcf86cd799439011'
33
+ * }),
34
+ * style: 'simple',
35
+ * explode: false
36
+ * });
37
+ *
38
+ * // Used in path: /users/{userId}
39
+ * ```
40
+ *
41
+ * @example Query parameter with validation
42
+ * ```typescript
43
+ * const pageSizeParam = new OasParameter({
44
+ * name: 'pageSize',
45
+ * location: 'query',
46
+ * description: 'Number of items to return per page',
47
+ * required: false,
48
+ * schema: new OasInteger({
49
+ * minimum: 1,
50
+ * maximum: 100,
51
+ * default: 20
52
+ * }),
53
+ * style: 'form',
54
+ * explode: true,
55
+ * examples: {
56
+ * small: new OasExample({ value: 10 }),
57
+ * medium: new OasExample({ value: 25 }),
58
+ * large: new OasExample({ value: 50 })
59
+ * }
60
+ * });
61
+ *
62
+ * // Used in query: ?pageSize=20
63
+ * ```
64
+ *
65
+ * @example Header parameter
66
+ * ```typescript
67
+ * const authHeaderParam = new OasParameter({
68
+ * name: 'Authorization',
69
+ * location: 'header',
70
+ * description: 'Bearer token for authentication',
71
+ * required: true,
72
+ * schema: new OasString({
73
+ * pattern: '^Bearer [A-Za-z0-9+/=]+$',
74
+ * example: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
75
+ * }),
76
+ * style: 'simple',
77
+ * explode: false
78
+ * });
79
+ * ```
80
+ *
81
+ * @example Complex parameter with content
82
+ * ```typescript
83
+ * const filterParam = new OasParameter({
84
+ * name: 'filter',
85
+ * location: 'query',
86
+ * description: 'Complex filter object',
87
+ * required: false,
88
+ * content: {
89
+ * 'application/json': new OasMediaType({
90
+ * schema: new OasObject({
91
+ * properties: {
92
+ * category: new OasString(),
93
+ * priceRange: new OasObject({
94
+ * properties: {
95
+ * min: new OasNumber(),
96
+ * max: new OasNumber()
97
+ * }
98
+ * })
99
+ * }
100
+ * })
101
+ * })
102
+ * },
103
+ * style: 'deepObject',
104
+ * explode: true
105
+ * });
106
+ *
107
+ * // Used as: ?filter[category]=electronics&filter[priceRange][min]=100
108
+ * ```
109
+ *
110
+ * @example Array parameter with explode
111
+ * ```typescript
112
+ * const tagsParam = new OasParameter({
113
+ * name: 'tags',
114
+ * location: 'query',
115
+ * description: 'Filter by multiple tags',
116
+ * required: false,
117
+ * schema: new OasArray({
118
+ * items: new OasString(),
119
+ * minItems: 1,
120
+ * maxItems: 10
121
+ * }),
122
+ * style: 'form',
123
+ * explode: true // Results in: ?tags=tech&tags=api&tags=rest
124
+ * });
125
+ *
126
+ * // Without explode: ?tags=tech,api,rest
127
+ * // With explode: ?tags=tech&tags=api&tags=rest
128
+ * ```
129
+ *
130
+ * @example Cookie parameter
131
+ * ```typescript
132
+ * const sessionParam = new OasParameter({
133
+ * name: 'sessionId',
134
+ * location: 'cookie',
135
+ * description: 'Session identifier cookie',
136
+ * required: false,
137
+ * schema: new OasString({
138
+ * minLength: 32,
139
+ * maxLength: 128
140
+ * }),
141
+ * style: 'form',
142
+ * explode: false
143
+ * });
144
+ * ```
145
+ */
2
146
  export class OasParameter {
3
147
  constructor(fields) {
4
148
  Object.defineProperty(this, "oasType", {