@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
@@ -2,23 +2,201 @@ import "../../_dnt.polyfills.js";
2
2
  import type { OasRef } from '../ref/Ref.js';
3
3
  import type { OpenAPIV3 } from 'openapi-types';
4
4
  import type { ToJsonSchemaOptions } from '../schema/Schema.js';
5
+ /**
6
+ * Constructor fields for {@link OasNumber}.
7
+ *
8
+ * @template Nullable - Whether the number can be null (affects type unions)
9
+ */
5
10
  export type NumberFields<Nullable extends boolean | undefined> = {
11
+ /** A short summary of the number schema */
6
12
  title?: string;
13
+ /** A description of the number schema */
7
14
  description?: string;
15
+ /** Whether the number value can be null */
8
16
  nullable?: Nullable;
17
+ /** Default value for the number (null allowed if Nullable is true) */
9
18
  default?: Nullable extends true ? number | null | undefined : number | undefined;
19
+ /** Custom extension fields (x-* properties) */
10
20
  extensionFields?: Record<string, unknown>;
21
+ /** Example value for the number (null allowed if Nullable is true) */
11
22
  example?: Nullable extends true ? number | null | undefined : number | undefined;
23
+ /** Array of valid enum values for the number (null allowed if Nullable is true) */
12
24
  enums?: Nullable extends true ? (number | null)[] | undefined : number[] | undefined;
25
+ /** The format of the number (float or double precision) */
13
26
  format?: 'float' | 'double';
27
+ /** Value must be a multiple of this number */
14
28
  multipleOf?: number;
29
+ /** Maximum value allowed (inclusive by default) */
15
30
  maximum?: number;
31
+ /** Whether the maximum value is exclusive */
16
32
  exclusiveMaximum?: boolean;
33
+ /** Minimum value allowed (inclusive by default) */
17
34
  minimum?: number;
35
+ /** Whether the minimum value is exclusive */
18
36
  exclusiveMinimum?: boolean;
19
37
  };
20
38
  /**
21
- * Object representing a number in the OpenAPI Specification.
39
+ * Represents a number schema in the OpenAPI Specification.
40
+ *
41
+ * The `OasNumber` class handles floating-point numeric data types in OpenAPI schemas,
42
+ * supporting comprehensive validation constraints including ranges, precision formats,
43
+ * and mathematical constraints. This class provides type-safe number handling with
44
+ * optional null value support and extensive validation capabilities.
45
+ *
46
+ * ## Key Features
47
+ *
48
+ * - **Range Validation**: Minimum and maximum constraints with exclusive/inclusive options
49
+ * - **Precision Control**: Float and double format support for different precision needs
50
+ * - **Mathematical Constraints**: Multiple-of validation for specific numeric patterns
51
+ * - **Type Safety**: Generic nullable type support with proper TypeScript inference
52
+ * - **Enum Support**: Constrain numbers to specific allowed values
53
+ * - **Null Handling**: Optional null value support for nullable number types
54
+ *
55
+ * @template Nullable - Whether the number value itself can be null
56
+ *
57
+ * @example Basic number schema with range
58
+ * ```typescript
59
+ * import { OasNumber } from '@skmtc/core';
60
+ *
61
+ * const ageSchema = new OasNumber({
62
+ * title: 'Age',
63
+ * description: 'Person age in years',
64
+ * minimum: 0,
65
+ * maximum: 150,
66
+ * example: 25,
67
+ * default: 18
68
+ * });
69
+ *
70
+ * // This represents: number (0 <= value <= 150)
71
+ * ```
72
+ *
73
+ * @example Price with precision and constraints
74
+ * ```typescript
75
+ * const priceSchema = new OasNumber({
76
+ * title: 'Product Price',
77
+ * description: 'Price in USD with cent precision',
78
+ * format: 'double',
79
+ * minimum: 0,
80
+ * exclusiveMinimum: true, // Must be > 0, not >= 0
81
+ * multipleOf: 0.01, // Must be in cents (e.g., 19.99, 10.50)
82
+ * example: 29.99
83
+ * });
84
+ *
85
+ * // This represents: number > 0, in multiples of 0.01
86
+ * ```
87
+ *
88
+ * @example Percentage with strict bounds
89
+ * ```typescript
90
+ * const percentageSchema = new OasNumber({
91
+ * title: 'Completion Percentage',
92
+ * description: 'Task completion as a percentage',
93
+ * minimum: 0,
94
+ * maximum: 100,
95
+ * multipleOf: 0.1, // One decimal place precision
96
+ * example: 75.5,
97
+ * default: 0
98
+ * });
99
+ *
100
+ * // This represents: 0 <= value <= 100, in increments of 0.1
101
+ * ```
102
+ *
103
+ * @example Nullable rating system
104
+ * ```typescript
105
+ * const ratingSchema = new OasNumber<true>({
106
+ * title: 'User Rating',
107
+ * description: 'Product rating from 1-5 stars, null if not rated',
108
+ * nullable: true,
109
+ * minimum: 1,
110
+ * maximum: 5,
111
+ * multipleOf: 0.5, // Allow half-star ratings
112
+ * enums: [1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, null],
113
+ * example: 4.5,
114
+ * default: null
115
+ * });
116
+ *
117
+ * // This represents: (1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5) | null
118
+ * ```
119
+ *
120
+ * @example Scientific measurement with high precision
121
+ * ```typescript
122
+ * const temperatureSchema = new OasNumber({
123
+ * title: 'Temperature',
124
+ * description: 'Temperature in Celsius with high precision',
125
+ * format: 'double',
126
+ * minimum: -273.15, // Absolute zero
127
+ * maximum: 1000,
128
+ * multipleOf: 0.001, // Millikelvin precision
129
+ * example: 23.456
130
+ * });
131
+ *
132
+ * // For scientific applications requiring high precision
133
+ * ```
134
+ *
135
+ * @example Currency with regional constraints
136
+ * ```typescript
137
+ * const currencySchema = new OasNumber({
138
+ * title: 'Amount',
139
+ * description: 'Transaction amount in major currency units',
140
+ * format: 'double',
141
+ * minimum: 0,
142
+ * maximum: 999999.99,
143
+ * multipleOf: 0.01,
144
+ * example: 1234.56
145
+ * });
146
+ *
147
+ * // Used in financial applications
148
+ * const transaction = new OasObject({
149
+ * properties: {
150
+ * amount: currencySchema,
151
+ * currency: new OasString({ enum: ['USD', 'EUR', 'GBP'] })
152
+ * }
153
+ * });
154
+ * ```
155
+ *
156
+ * @example Coordinate system
157
+ * ```typescript
158
+ * const latitudeSchema = new OasNumber({
159
+ * title: 'Latitude',
160
+ * description: 'Geographic latitude coordinate',
161
+ * format: 'double',
162
+ * minimum: -90,
163
+ * maximum: 90,
164
+ * example: 40.7128
165
+ * });
166
+ *
167
+ * const longitudeSchema = new OasNumber({
168
+ * title: 'Longitude',
169
+ * description: 'Geographic longitude coordinate',
170
+ * format: 'double',
171
+ * minimum: -180,
172
+ * maximum: 180,
173
+ * example: -74.0060
174
+ * });
175
+ *
176
+ * // Used for location data
177
+ * ```
178
+ *
179
+ * @example Probability and statistics
180
+ * ```typescript
181
+ * const probabilitySchema = new OasNumber({
182
+ * title: 'Probability',
183
+ * description: 'Statistical probability value',
184
+ * minimum: 0,
185
+ * maximum: 1,
186
+ * exclusiveMaximum: false, // Can be exactly 1
187
+ * example: 0.75,
188
+ * default: 0.5
189
+ * });
190
+ *
191
+ * const confidenceSchema = new OasNumber({
192
+ * title: 'Confidence Level',
193
+ * description: 'Statistical confidence level as percentage',
194
+ * minimum: 0,
195
+ * maximum: 100,
196
+ * enums: [90, 95, 99], // Common confidence levels
197
+ * example: 95
198
+ * });
199
+ * ```
22
200
  */
23
201
  export declare class OasNumber<Nullable extends boolean | undefined = boolean | undefined> {
24
202
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../../../src/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AE,MAAM,GAAG,SAAS,CAAA;IAC9B;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B;;OAEG;IACH,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B;;OAEG;IACH,gBAAgB,EAAE,OAAO,GAAG,SAAS,CAAA;gBACzB,MAAM,GAAE,YAAY,CAAC,QAAQ,CAAM;IAgB/C,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS,CAAC,QAAQ,CAAC;IAI9B,WAAW,IAAI,SAAS,CAAC,QAAQ,CAAC;IAKlC,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC,oBAAoB;CAgB5E"}
@@ -1,6 +1,166 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  /**
3
- * Object representing a number in the OpenAPI Specification.
3
+ * Represents a number schema in the OpenAPI Specification.
4
+ *
5
+ * The `OasNumber` class handles floating-point numeric data types in OpenAPI schemas,
6
+ * supporting comprehensive validation constraints including ranges, precision formats,
7
+ * and mathematical constraints. This class provides type-safe number handling with
8
+ * optional null value support and extensive validation capabilities.
9
+ *
10
+ * ## Key Features
11
+ *
12
+ * - **Range Validation**: Minimum and maximum constraints with exclusive/inclusive options
13
+ * - **Precision Control**: Float and double format support for different precision needs
14
+ * - **Mathematical Constraints**: Multiple-of validation for specific numeric patterns
15
+ * - **Type Safety**: Generic nullable type support with proper TypeScript inference
16
+ * - **Enum Support**: Constrain numbers to specific allowed values
17
+ * - **Null Handling**: Optional null value support for nullable number types
18
+ *
19
+ * @template Nullable - Whether the number value itself can be null
20
+ *
21
+ * @example Basic number schema with range
22
+ * ```typescript
23
+ * import { OasNumber } from '@skmtc/core';
24
+ *
25
+ * const ageSchema = new OasNumber({
26
+ * title: 'Age',
27
+ * description: 'Person age in years',
28
+ * minimum: 0,
29
+ * maximum: 150,
30
+ * example: 25,
31
+ * default: 18
32
+ * });
33
+ *
34
+ * // This represents: number (0 <= value <= 150)
35
+ * ```
36
+ *
37
+ * @example Price with precision and constraints
38
+ * ```typescript
39
+ * const priceSchema = new OasNumber({
40
+ * title: 'Product Price',
41
+ * description: 'Price in USD with cent precision',
42
+ * format: 'double',
43
+ * minimum: 0,
44
+ * exclusiveMinimum: true, // Must be > 0, not >= 0
45
+ * multipleOf: 0.01, // Must be in cents (e.g., 19.99, 10.50)
46
+ * example: 29.99
47
+ * });
48
+ *
49
+ * // This represents: number > 0, in multiples of 0.01
50
+ * ```
51
+ *
52
+ * @example Percentage with strict bounds
53
+ * ```typescript
54
+ * const percentageSchema = new OasNumber({
55
+ * title: 'Completion Percentage',
56
+ * description: 'Task completion as a percentage',
57
+ * minimum: 0,
58
+ * maximum: 100,
59
+ * multipleOf: 0.1, // One decimal place precision
60
+ * example: 75.5,
61
+ * default: 0
62
+ * });
63
+ *
64
+ * // This represents: 0 <= value <= 100, in increments of 0.1
65
+ * ```
66
+ *
67
+ * @example Nullable rating system
68
+ * ```typescript
69
+ * const ratingSchema = new OasNumber<true>({
70
+ * title: 'User Rating',
71
+ * description: 'Product rating from 1-5 stars, null if not rated',
72
+ * nullable: true,
73
+ * minimum: 1,
74
+ * maximum: 5,
75
+ * multipleOf: 0.5, // Allow half-star ratings
76
+ * enums: [1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, null],
77
+ * example: 4.5,
78
+ * default: null
79
+ * });
80
+ *
81
+ * // This represents: (1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5) | null
82
+ * ```
83
+ *
84
+ * @example Scientific measurement with high precision
85
+ * ```typescript
86
+ * const temperatureSchema = new OasNumber({
87
+ * title: 'Temperature',
88
+ * description: 'Temperature in Celsius with high precision',
89
+ * format: 'double',
90
+ * minimum: -273.15, // Absolute zero
91
+ * maximum: 1000,
92
+ * multipleOf: 0.001, // Millikelvin precision
93
+ * example: 23.456
94
+ * });
95
+ *
96
+ * // For scientific applications requiring high precision
97
+ * ```
98
+ *
99
+ * @example Currency with regional constraints
100
+ * ```typescript
101
+ * const currencySchema = new OasNumber({
102
+ * title: 'Amount',
103
+ * description: 'Transaction amount in major currency units',
104
+ * format: 'double',
105
+ * minimum: 0,
106
+ * maximum: 999999.99,
107
+ * multipleOf: 0.01,
108
+ * example: 1234.56
109
+ * });
110
+ *
111
+ * // Used in financial applications
112
+ * const transaction = new OasObject({
113
+ * properties: {
114
+ * amount: currencySchema,
115
+ * currency: new OasString({ enum: ['USD', 'EUR', 'GBP'] })
116
+ * }
117
+ * });
118
+ * ```
119
+ *
120
+ * @example Coordinate system
121
+ * ```typescript
122
+ * const latitudeSchema = new OasNumber({
123
+ * title: 'Latitude',
124
+ * description: 'Geographic latitude coordinate',
125
+ * format: 'double',
126
+ * minimum: -90,
127
+ * maximum: 90,
128
+ * example: 40.7128
129
+ * });
130
+ *
131
+ * const longitudeSchema = new OasNumber({
132
+ * title: 'Longitude',
133
+ * description: 'Geographic longitude coordinate',
134
+ * format: 'double',
135
+ * minimum: -180,
136
+ * maximum: 180,
137
+ * example: -74.0060
138
+ * });
139
+ *
140
+ * // Used for location data
141
+ * ```
142
+ *
143
+ * @example Probability and statistics
144
+ * ```typescript
145
+ * const probabilitySchema = new OasNumber({
146
+ * title: 'Probability',
147
+ * description: 'Statistical probability value',
148
+ * minimum: 0,
149
+ * maximum: 1,
150
+ * exclusiveMaximum: false, // Can be exactly 1
151
+ * example: 0.75,
152
+ * default: 0.5
153
+ * });
154
+ *
155
+ * const confidenceSchema = new OasNumber({
156
+ * title: 'Confidence Level',
157
+ * description: 'Statistical confidence level as percentage',
158
+ * minimum: 0,
159
+ * maximum: 100,
160
+ * enums: [90, 95, 99], // Common confidence levels
161
+ * example: 95
162
+ * });
163
+ * ```
4
164
  */
5
165
  export class OasNumber {
6
166
  constructor(fields = {}) {
@@ -1,11 +1,103 @@
1
1
  import type { OasParameter } from '../parameter/Parameter.js';
2
2
  import type { OasRef } from '../ref/Ref.js';
3
+ /**
4
+ * Constructor fields for {@link OasPathItem}.
5
+ */
3
6
  export type PathItemFields = {
7
+ /** Optional summary for the path item */
4
8
  summary?: string | undefined;
9
+ /** Optional description for the path item */
5
10
  description?: string | undefined;
11
+ /** Parameters that are applicable for all operations on this path */
6
12
  parameters?: (OasParameter | OasRef<'parameter'>)[] | undefined;
13
+ /** Custom extension fields (x-* properties) */
7
14
  extensionFields?: Record<string, unknown>;
8
15
  };
16
+ /**
17
+ * Represents a Path Item Object in the OpenAPI Specification.
18
+ *
19
+ * The `OasPathItem` class describes operations available on a single API path.
20
+ * It serves as a container for HTTP operations (GET, POST, PUT, DELETE, etc.)
21
+ * and can define parameters that apply to all operations on the path.
22
+ *
23
+ * This class provides path-level configuration and shared parameters that
24
+ * reduce duplication across operations on the same endpoint.
25
+ *
26
+ * ## Key Features
27
+ *
28
+ * - **Operation Container**: Groups HTTP methods for a single path
29
+ * - **Shared Parameters**: Path-level parameters for all operations
30
+ * - **Documentation**: Summary and description for the path
31
+ * - **Extension Support**: Custom fields for additional metadata
32
+ * - **Parameter Inheritance**: Parameters shared across all operations
33
+ *
34
+ * @example Basic path item with shared parameters
35
+ * ```typescript
36
+ * import { OasPathItem, OasParameter, OasString } from '@skmtc/core';
37
+ *
38
+ * const userPathItem = new OasPathItem({
39
+ * summary: 'User operations',
40
+ * description: 'Operations for managing individual users',
41
+ * parameters: [
42
+ * new OasParameter({
43
+ * name: 'userId',
44
+ * in: 'path',
45
+ * required: true,
46
+ * schema: new OasString({ format: 'uuid' }),
47
+ * description: 'Unique identifier for the user'
48
+ * })
49
+ * ]
50
+ * });
51
+ * ```
52
+ *
53
+ * @example Path with common headers
54
+ * ```typescript
55
+ * const apiPathItem = new OasPathItem({
56
+ * summary: 'API endpoint',
57
+ * description: 'Authenticated endpoint requiring API key',
58
+ * parameters: [
59
+ * new OasParameter({
60
+ * name: 'Authorization',
61
+ * in: 'header',
62
+ * required: true,
63
+ * schema: new OasString({ pattern: '^Bearer .+$' }),
64
+ * description: 'Bearer token for authentication'
65
+ * }),
66
+ * new OasParameter({
67
+ * name: 'Accept-Version',
68
+ * in: 'header',
69
+ * required: false,
70
+ * schema: new OasString({ enum: ['v1', 'v2'] }),
71
+ * description: 'API version preference'
72
+ * })
73
+ * ]
74
+ * });
75
+ * ```
76
+ *
77
+ * @example RESTful resource path
78
+ * ```typescript
79
+ * const resourcePathItem = new OasPathItem({
80
+ * summary: 'Product resource',
81
+ * description: 'CRUD operations for product management',
82
+ * parameters: [
83
+ * new OasParameter({
84
+ * name: 'productId',
85
+ * in: 'path',
86
+ * required: true,
87
+ * schema: new OasInteger({ minimum: 1 }),
88
+ * description: 'Product identifier'
89
+ * }),
90
+ * new OasParameter({
91
+ * name: 'include',
92
+ * in: 'query',
93
+ * required: false,
94
+ * schema: new OasString({ enum: ['details', 'reviews', 'images'] }),
95
+ * description: 'Additional data to include in response'
96
+ * })
97
+ * ]
98
+ * });
99
+ * ```
100
+ */
9
101
  export declare class OasPathItem {
10
102
  oasType: 'pathItem';
11
103
  summary: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"PathItem.d.ts","sourceRoot":"","sources":["../../../src/oas/pathItem/PathItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,SAAS,CAAA;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,WAAW;IACtB,O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e,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBAExC,MAAM,GAAE,cAAmB;CAMxC"}
@@ -1,3 +1,88 @@
1
+ /**
2
+ * Represents a Path Item Object in the OpenAPI Specification.
3
+ *
4
+ * The `OasPathItem` class describes operations available on a single API path.
5
+ * It serves as a container for HTTP operations (GET, POST, PUT, DELETE, etc.)
6
+ * and can define parameters that apply to all operations on the path.
7
+ *
8
+ * This class provides path-level configuration and shared parameters that
9
+ * reduce duplication across operations on the same endpoint.
10
+ *
11
+ * ## Key Features
12
+ *
13
+ * - **Operation Container**: Groups HTTP methods for a single path
14
+ * - **Shared Parameters**: Path-level parameters for all operations
15
+ * - **Documentation**: Summary and description for the path
16
+ * - **Extension Support**: Custom fields for additional metadata
17
+ * - **Parameter Inheritance**: Parameters shared across all operations
18
+ *
19
+ * @example Basic path item with shared parameters
20
+ * ```typescript
21
+ * import { OasPathItem, OasParameter, OasString } from '@skmtc/core';
22
+ *
23
+ * const userPathItem = new OasPathItem({
24
+ * summary: 'User operations',
25
+ * description: 'Operations for managing individual users',
26
+ * parameters: [
27
+ * new OasParameter({
28
+ * name: 'userId',
29
+ * in: 'path',
30
+ * required: true,
31
+ * schema: new OasString({ format: 'uuid' }),
32
+ * description: 'Unique identifier for the user'
33
+ * })
34
+ * ]
35
+ * });
36
+ * ```
37
+ *
38
+ * @example Path with common headers
39
+ * ```typescript
40
+ * const apiPathItem = new OasPathItem({
41
+ * summary: 'API endpoint',
42
+ * description: 'Authenticated endpoint requiring API key',
43
+ * parameters: [
44
+ * new OasParameter({
45
+ * name: 'Authorization',
46
+ * in: 'header',
47
+ * required: true,
48
+ * schema: new OasString({ pattern: '^Bearer .+$' }),
49
+ * description: 'Bearer token for authentication'
50
+ * }),
51
+ * new OasParameter({
52
+ * name: 'Accept-Version',
53
+ * in: 'header',
54
+ * required: false,
55
+ * schema: new OasString({ enum: ['v1', 'v2'] }),
56
+ * description: 'API version preference'
57
+ * })
58
+ * ]
59
+ * });
60
+ * ```
61
+ *
62
+ * @example RESTful resource path
63
+ * ```typescript
64
+ * const resourcePathItem = new OasPathItem({
65
+ * summary: 'Product resource',
66
+ * description: 'CRUD operations for product management',
67
+ * parameters: [
68
+ * new OasParameter({
69
+ * name: 'productId',
70
+ * in: 'path',
71
+ * required: true,
72
+ * schema: new OasInteger({ minimum: 1 }),
73
+ * description: 'Product identifier'
74
+ * }),
75
+ * new OasParameter({
76
+ * name: 'include',
77
+ * in: 'query',
78
+ * required: false,
79
+ * schema: new OasString({ enum: ['details', 'reviews', 'images'] }),
80
+ * description: 'Additional data to include in response'
81
+ * })
82
+ * ]
83
+ * });
84
+ * ```
85
+ */
1
86
  export class OasPathItem {
2
87
  constructor(fields = {}) {
3
88
  Object.defineProperty(this, "oasType", {