@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
@@ -10,7 +10,213 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _OasHeader_fields;
13
- /** Describes a single header in the API */
13
+ /**
14
+ * Represents a Header Object in the OpenAPI Specification.
15
+ *
16
+ * The `OasHeader` class encapsulates the definition of a single HTTP header that
17
+ * can be sent with responses or expected in requests. Headers provide additional
18
+ * metadata about the HTTP message and can include authentication tokens, content
19
+ * information, pagination data, rate limiting details, and more.
20
+ *
21
+ * This class provides comprehensive support for header definitions with typed
22
+ * values, validation schemas, examples, and documentation.
23
+ *
24
+ * ## Key Features
25
+ *
26
+ * - **Schema Validation**: Typed header values through schema definitions
27
+ * - **Examples**: Multiple example values for documentation and testing
28
+ * - **Content Types**: Support for complex header values with media types
29
+ * - **Deprecation Support**: Mark headers as deprecated with proper warnings
30
+ * - **Required/Optional**: Control whether headers are mandatory
31
+ * - **Documentation**: Rich description support for API documentation
32
+ *
33
+ * @example Basic authentication header
34
+ * ```typescript
35
+ * import { OasHeader, OasString } from '@skmtc/core';
36
+ *
37
+ * const authHeader = new OasHeader({
38
+ * description: 'Bearer token for API authentication',
39
+ * required: true,
40
+ * schema: new OasString({
41
+ * pattern: '^Bearer [A-Za-z0-9+/=]+$',
42
+ * description: 'JWT bearer token'
43
+ * }),
44
+ * examples: {
45
+ * valid: new OasExample({
46
+ * summary: 'Valid bearer token',
47
+ * value: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
48
+ * })
49
+ * }
50
+ * });
51
+ * ```
52
+ *
53
+ * @example Pagination headers
54
+ * ```typescript
55
+ * const totalCountHeader = new OasHeader({
56
+ * description: 'Total number of items available',
57
+ * required: false,
58
+ * schema: new OasInteger({
59
+ * minimum: 0,
60
+ * description: 'Non-negative integer count'
61
+ * }),
62
+ * examples: {
63
+ * empty: new OasExample({ value: 0, description: 'No items' }),
64
+ * normal: new OasExample({ value: 150, description: 'Normal case' }),
65
+ * large: new OasExample({ value: 10000, description: 'Large dataset' })
66
+ * }
67
+ * });
68
+ *
69
+ * const linkHeader = new OasHeader({
70
+ * description: 'Pagination links (RFC 5988)',
71
+ * required: false,
72
+ * schema: new OasString({
73
+ * description: 'Comma-separated list of link relations'
74
+ * }),
75
+ * examples: {
76
+ * withNext: new OasExample({
77
+ * value: '</api/users?page=2>; rel="next", </api/users?page=10>; rel="last"'
78
+ * }),
79
+ * lastPage: new OasExample({
80
+ * value: '</api/users?page=9>; rel="prev", </api/users?page=1>; rel="first"'
81
+ * })
82
+ * }
83
+ * });
84
+ * ```
85
+ *
86
+ * @example Content type and encoding headers
87
+ * ```typescript
88
+ * const contentTypeHeader = new OasHeader({
89
+ * description: 'MIME type of the response content',
90
+ * required: true,
91
+ * schema: new OasString({
92
+ * enum: [
93
+ * 'application/json',
94
+ * 'application/xml',
95
+ * 'text/csv',
96
+ * 'application/pdf',
97
+ * 'application/octet-stream'
98
+ * ]
99
+ * }),
100
+ * examples: {
101
+ * json: new OasExample({ value: 'application/json' }),
102
+ * xml: new OasExample({ value: 'application/xml' }),
103
+ * csv: new OasExample({ value: 'text/csv' })
104
+ * }
105
+ * });
106
+ *
107
+ * const contentLengthHeader = new OasHeader({
108
+ * description: 'Size of the response body in bytes',
109
+ * required: false,
110
+ * schema: new OasInteger({
111
+ * minimum: 0,
112
+ * description: 'Content size in bytes'
113
+ * })
114
+ * });
115
+ * ```
116
+ *
117
+ * @example Rate limiting headers
118
+ * ```typescript
119
+ * const rateLimitHeader = new OasHeader({
120
+ * description: 'Number of requests remaining in the current window',
121
+ * required: false,
122
+ * schema: new OasInteger({
123
+ * minimum: 0,
124
+ * description: 'Remaining request count'
125
+ * }),
126
+ * examples: {
127
+ * available: new OasExample({ value: 95, description: '95 requests remaining' }),
128
+ * depleted: new OasExample({ value: 0, description: 'Rate limit reached' })
129
+ * }
130
+ * });
131
+ *
132
+ * const rateLimitResetHeader = new OasHeader({
133
+ * description: 'Unix timestamp when the rate limit window resets',
134
+ * required: false,
135
+ * schema: new OasInteger({
136
+ * minimum: 0,
137
+ * description: 'Unix timestamp in seconds'
138
+ * }),
139
+ * examples: {
140
+ * reset: new OasExample({
141
+ * value: 1634567890,
142
+ * description: 'Reset at 2021-10-18 12:31:30 UTC'
143
+ * })
144
+ * }
145
+ * });
146
+ * ```
147
+ *
148
+ * @example Custom application headers
149
+ * ```typescript
150
+ * const requestIdHeader = new OasHeader({
151
+ * description: 'Unique identifier for request tracing',
152
+ * required: false,
153
+ * schema: new OasString({
154
+ * format: 'uuid',
155
+ * description: 'UUID v4 request identifier'
156
+ * }),
157
+ * examples: {
158
+ * uuid: new OasExample({
159
+ * value: '123e4567-e89b-12d3-a456-426614174000',
160
+ * description: 'Request tracking ID'
161
+ * })
162
+ * }
163
+ * });
164
+ *
165
+ * const serverTimingHeader = new OasHeader({
166
+ * description: 'Server-side performance metrics',
167
+ * required: false,
168
+ * schema: new OasString({
169
+ * description: 'Server-Timing header format (RFC 8760)'
170
+ * }),
171
+ * examples: {
172
+ * timing: new OasExample({
173
+ * value: 'db;dur=53, app;dur=47.2',
174
+ * description: 'Database took 53ms, app logic 47.2ms'
175
+ * })
176
+ * }
177
+ * });
178
+ * ```
179
+ *
180
+ * @example Deprecated header
181
+ * ```typescript
182
+ * const deprecatedHeader = new OasHeader({
183
+ * description: 'Legacy API version header (deprecated)',
184
+ * required: false,
185
+ * deprecated: true,
186
+ * schema: new OasString({
187
+ * enum: ['v1', 'v2'],
188
+ * description: 'Use Accept or Content-Type header instead'
189
+ * }),
190
+ * examples: {
191
+ * legacy: new OasExample({
192
+ * value: 'v1',
193
+ * description: 'Legacy version (use Accept header instead)'
194
+ * })
195
+ * }
196
+ * });
197
+ * ```
198
+ *
199
+ * @example Using in response definitions
200
+ * ```typescript
201
+ * const successResponse = new OasResponse({
202
+ * description: 'Paginated user list',
203
+ * headers: {
204
+ * 'X-Total-Count': totalCountHeader,
205
+ * 'Link': linkHeader,
206
+ * 'X-Rate-Limit-Remaining': rateLimitHeader,
207
+ * 'X-Rate-Limit-Reset': rateLimitResetHeader,
208
+ * 'X-Request-ID': requestIdHeader
209
+ * },
210
+ * content: {
211
+ * 'application/json': new OasMediaType({
212
+ * schema: new OasArray({
213
+ * items: new OasRef({ $ref: '#/components/schemas/User' })
214
+ * })
215
+ * })
216
+ * }
217
+ * });
218
+ * ```
219
+ */
14
220
  export class OasHeader {
15
221
  constructor(fields) {
16
222
  Object.defineProperty(this, "oasType", {
@@ -1,15 +1,87 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  import type { OasContact } from '../contact/Contact.js';
3
3
  import type { OasLicense } from '../license/License.js';
4
+ /**
5
+ * Constructor fields for {@link OasInfo}.
6
+ */
4
7
  export type InfoFields = {
8
+ /** The title of the API */
5
9
  title: string;
10
+ /** The version of the OpenAPI document */
6
11
  version: string;
12
+ /** A description of the API */
7
13
  description?: string | undefined;
14
+ /** A URL to the Terms of Service for the API */
8
15
  termsOfService?: string | undefined;
16
+ /** The contact information for the exposed API */
9
17
  contact?: OasContact | undefined;
18
+ /** The license information for the exposed API */
10
19
  license?: OasLicense | undefined;
20
+ /** Custom extension fields (x-* properties) */
11
21
  extensionFields?: Record<string, unknown>;
12
22
  };
23
+ /**
24
+ * Represents an Info Object in the OpenAPI Specification.
25
+ *
26
+ * The `OasInfo` class encapsulates metadata about the API including its title,
27
+ * version, description, and contact information. This information is displayed
28
+ * in API documentation and helps developers understand what the API does and
29
+ * how to use it effectively.
30
+ *
31
+ * This class provides essential API metadata that appears at the top level
32
+ * of OpenAPI documents and drives documentation generation and tooling.
33
+ *
34
+ * ## Key Features
35
+ *
36
+ * - **API Identification**: Title and version information for API tracking
37
+ * - **Documentation**: Rich description support for API overview
38
+ * - **Contact Information**: Developer contact details and support resources
39
+ * - **Legal Information**: License and terms of service references
40
+ * - **Extension Support**: Custom fields for additional metadata
41
+ *
42
+ * @example Basic API information
43
+ * ```typescript
44
+ * import { OasInfo } from '@skmtc/core';
45
+ *
46
+ * const apiInfo = new OasInfo({
47
+ * title: 'Pet Store API',
48
+ * version: '1.0.0',
49
+ * description: 'A sample API that uses a petstore as an example'
50
+ * });
51
+ * ```
52
+ *
53
+ * @example Complete API metadata
54
+ * ```typescript
55
+ * const fullApiInfo = new OasInfo({
56
+ * title: 'E-Commerce Platform API',
57
+ * version: '2.1.0',
58
+ * description: 'Comprehensive e-commerce API for managing products, orders, and customers',
59
+ * termsOfService: 'https://api.example.com/terms',
60
+ * contact: new OasContact({
61
+ * name: 'API Support Team',
62
+ * url: 'https://api.example.com/support',
63
+ * email: 'api-support@example.com'
64
+ * }),
65
+ * license: new OasLicense({
66
+ * name: 'MIT',
67
+ * url: 'https://opensource.org/licenses/MIT'
68
+ * })
69
+ * });
70
+ * ```
71
+ *
72
+ * @example Versioned API with semantic versioning
73
+ * ```typescript
74
+ * const versionedInfo = new OasInfo({
75
+ * title: 'User Management Service',
76
+ * version: '3.2.1',
77
+ * description: 'RESTful API for user authentication and profile management',
78
+ * contact: new OasContact({
79
+ * name: 'Development Team',
80
+ * email: 'dev@company.com'
81
+ * })
82
+ * });
83
+ * ```
84
+ */
13
85
  export declare class OasInfo {
14
86
  #private;
15
87
  oasType: 'info';
@@ -1 +1 @@
1
- {"version":3,"file":"Info.d.ts","sourceRoot":"","sources":["../../../src/oas/info/Info.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACv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AAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAChC,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAChC,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,qBAAa,OAAO;;IAClB,OAAO,EAAE,MAAM,CAAS;gBAGZ,MAAM,EAAE,UAAU;IAI9B,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED,IAAI,OAAO,IAAI,UAAU,GAAG,SAAS,CAEpC;IAED,IAAI,OAAO,IAAI,UAAU,GAAG,SAAS,CAEpC;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,qCAAqC;IACrC,IAAI,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEzD;CACF"}
@@ -11,6 +11,68 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
11
11
  };
12
12
  var _OasInfo_fields;
13
13
  import "../../_dnt.polyfills.js";
14
+ /**
15
+ * Represents an Info Object in the OpenAPI Specification.
16
+ *
17
+ * The `OasInfo` class encapsulates metadata about the API including its title,
18
+ * version, description, and contact information. This information is displayed
19
+ * in API documentation and helps developers understand what the API does and
20
+ * how to use it effectively.
21
+ *
22
+ * This class provides essential API metadata that appears at the top level
23
+ * of OpenAPI documents and drives documentation generation and tooling.
24
+ *
25
+ * ## Key Features
26
+ *
27
+ * - **API Identification**: Title and version information for API tracking
28
+ * - **Documentation**: Rich description support for API overview
29
+ * - **Contact Information**: Developer contact details and support resources
30
+ * - **Legal Information**: License and terms of service references
31
+ * - **Extension Support**: Custom fields for additional metadata
32
+ *
33
+ * @example Basic API information
34
+ * ```typescript
35
+ * import { OasInfo } from '@skmtc/core';
36
+ *
37
+ * const apiInfo = new OasInfo({
38
+ * title: 'Pet Store API',
39
+ * version: '1.0.0',
40
+ * description: 'A sample API that uses a petstore as an example'
41
+ * });
42
+ * ```
43
+ *
44
+ * @example Complete API metadata
45
+ * ```typescript
46
+ * const fullApiInfo = new OasInfo({
47
+ * title: 'E-Commerce Platform API',
48
+ * version: '2.1.0',
49
+ * description: 'Comprehensive e-commerce API for managing products, orders, and customers',
50
+ * termsOfService: 'https://api.example.com/terms',
51
+ * contact: new OasContact({
52
+ * name: 'API Support Team',
53
+ * url: 'https://api.example.com/support',
54
+ * email: 'api-support@example.com'
55
+ * }),
56
+ * license: new OasLicense({
57
+ * name: 'MIT',
58
+ * url: 'https://opensource.org/licenses/MIT'
59
+ * })
60
+ * });
61
+ * ```
62
+ *
63
+ * @example Versioned API with semantic versioning
64
+ * ```typescript
65
+ * const versionedInfo = new OasInfo({
66
+ * title: 'User Management Service',
67
+ * version: '3.2.1',
68
+ * description: 'RESTful API for user authentication and profile management',
69
+ * contact: new OasContact({
70
+ * name: 'Development Team',
71
+ * email: 'dev@company.com'
72
+ * })
73
+ * });
74
+ * ```
75
+ */
14
76
  export class OasInfo {
15
77
  constructor(fields) {
16
78
  Object.defineProperty(this, "oasType", {
@@ -3,13 +3,98 @@ import type { OasSchema } from '../schema/Schema.js';
3
3
  import type { OasExample } from '../example/Example.js';
4
4
  import type { ToJsonSchemaOptions } from '../schema/Schema.js';
5
5
  import type { OpenAPIV3 } from 'openapi-types';
6
+ /**
7
+ * Constructor fields for {@link OasMediaType}.
8
+ */
6
9
  export type MediaTypeFields = {
10
+ /** The media type string (e.g., 'application/json', 'text/xml') */
7
11
  mediaType: string;
12
+ /** The schema defining the structure of the content */
8
13
  schema?: OasSchema | OasRef<'schema'> | undefined;
14
+ /** Example values for the media type */
9
15
  examples?: Record<string, OasExample | OasRef<'example'>> | undefined;
16
+ /** Custom extension fields (x-* properties) */
10
17
  extensionFields?: Record<string, unknown>;
18
+ /** Encoding information for multipart or form data */
11
19
  encoding?: Record<string, unknown> | undefined;
12
20
  };
21
+ /**
22
+ * Represents a Media Type Object in the OpenAPI Specification.
23
+ *
24
+ * The `OasMediaType` class encapsulates the definition of content for different
25
+ * media types in request bodies and responses. It defines the structure, format,
26
+ * and validation rules for content using schemas and provides examples for
27
+ * documentation and testing purposes.
28
+ *
29
+ * This class supports various content types including JSON, XML, form data,
30
+ * file uploads, and binary content, making it essential for describing API
31
+ * request and response payloads.
32
+ *
33
+ * ## Key Features
34
+ *
35
+ * - **Schema Validation**: Define content structure through OpenAPI schemas
36
+ * - **Multiple Examples**: Rich example support for documentation and testing
37
+ * - **Encoding Support**: Handle multipart and form data encoding
38
+ * - **Content Type Support**: JSON, XML, binary, form data, and more
39
+ * - **Reference Integration**: Work seamlessly with schema references
40
+ *
41
+ * @example JSON content type
42
+ * ```typescript
43
+ * import { OasMediaType, OasObject, OasString } from '@skmtc/core';
44
+ *
45
+ * const jsonContent = new OasMediaType({
46
+ * mediaType: 'application/json',
47
+ * schema: new OasObject({
48
+ * properties: {
49
+ * name: new OasString(),
50
+ * email: new OasString({ format: 'email' })
51
+ * }
52
+ * }),
53
+ * examples: {
54
+ * user: new OasExample({
55
+ * summary: 'Sample user',
56
+ * value: { name: 'John Doe', email: 'john@example.com' }
57
+ * })
58
+ * }
59
+ * });
60
+ * ```
61
+ *
62
+ * @example File upload with multipart form data
63
+ * ```typescript
64
+ * const fileUpload = new OasMediaType({
65
+ * mediaType: 'multipart/form-data',
66
+ * schema: new OasObject({
67
+ * properties: {
68
+ * file: new OasString({ format: 'binary' }),
69
+ * description: new OasString()
70
+ * }
71
+ * }),
72
+ * encoding: {
73
+ * file: {
74
+ * contentType: 'image/png, image/jpeg',
75
+ * style: 'form'
76
+ * }
77
+ * }
78
+ * });
79
+ * ```
80
+ *
81
+ * @example XML content with namespace
82
+ * ```typescript
83
+ * const xmlContent = new OasMediaType({
84
+ * mediaType: 'application/xml',
85
+ * schema: new OasObject({
86
+ * properties: {
87
+ * product: new OasRef({ $ref: '#/components/schemas/Product' })
88
+ * }
89
+ * }),
90
+ * examples: {
91
+ * sample: new OasExample({
92
+ * value: '<product><name>Widget</name><price>19.99</price></product>'
93
+ * })
94
+ * }
95
+ * });
96
+ * ```
97
+ */
13
98
  export declare class OasMediaType {
14
99
  oasType: 'mediaType';
15
100
  mediaType: string;
@@ -1 +1 @@
1
- {"version":3,"file":"MediaType.d.ts","sourceRoot":"","sources":["../../../src/oas/mediaType/MediaType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,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,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAC/C,CAAA;AAED,qBAAa,YAAY;IACvB,OAAO,EAAE,W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AAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAC/C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,WAAW,CAAc;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;IAChD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACpE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBAClC,MAAM,EAAE,eAAe;IAQnC,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;CAMtE"}
@@ -1,3 +1,80 @@
1
+ /**
2
+ * Represents a Media Type Object in the OpenAPI Specification.
3
+ *
4
+ * The `OasMediaType` class encapsulates the definition of content for different
5
+ * media types in request bodies and responses. It defines the structure, format,
6
+ * and validation rules for content using schemas and provides examples for
7
+ * documentation and testing purposes.
8
+ *
9
+ * This class supports various content types including JSON, XML, form data,
10
+ * file uploads, and binary content, making it essential for describing API
11
+ * request and response payloads.
12
+ *
13
+ * ## Key Features
14
+ *
15
+ * - **Schema Validation**: Define content structure through OpenAPI schemas
16
+ * - **Multiple Examples**: Rich example support for documentation and testing
17
+ * - **Encoding Support**: Handle multipart and form data encoding
18
+ * - **Content Type Support**: JSON, XML, binary, form data, and more
19
+ * - **Reference Integration**: Work seamlessly with schema references
20
+ *
21
+ * @example JSON content type
22
+ * ```typescript
23
+ * import { OasMediaType, OasObject, OasString } from '@skmtc/core';
24
+ *
25
+ * const jsonContent = new OasMediaType({
26
+ * mediaType: 'application/json',
27
+ * schema: new OasObject({
28
+ * properties: {
29
+ * name: new OasString(),
30
+ * email: new OasString({ format: 'email' })
31
+ * }
32
+ * }),
33
+ * examples: {
34
+ * user: new OasExample({
35
+ * summary: 'Sample user',
36
+ * value: { name: 'John Doe', email: 'john@example.com' }
37
+ * })
38
+ * }
39
+ * });
40
+ * ```
41
+ *
42
+ * @example File upload with multipart form data
43
+ * ```typescript
44
+ * const fileUpload = new OasMediaType({
45
+ * mediaType: 'multipart/form-data',
46
+ * schema: new OasObject({
47
+ * properties: {
48
+ * file: new OasString({ format: 'binary' }),
49
+ * description: new OasString()
50
+ * }
51
+ * }),
52
+ * encoding: {
53
+ * file: {
54
+ * contentType: 'image/png, image/jpeg',
55
+ * style: 'form'
56
+ * }
57
+ * }
58
+ * });
59
+ * ```
60
+ *
61
+ * @example XML content with namespace
62
+ * ```typescript
63
+ * const xmlContent = new OasMediaType({
64
+ * mediaType: 'application/xml',
65
+ * schema: new OasObject({
66
+ * properties: {
67
+ * product: new OasRef({ $ref: '#/components/schemas/Product' })
68
+ * }
69
+ * }),
70
+ * examples: {
71
+ * sample: new OasExample({
72
+ * value: '<product><name>Widget</name><price>19.99</price></product>'
73
+ * })
74
+ * }
75
+ * });
76
+ * ```
77
+ */
1
78
  export class OasMediaType {
2
79
  constructor(fields) {
3
80
  Object.defineProperty(this, "oasType", {
@@ -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,OAAO,EAAE,UAAU,CAAa;IAChC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,SAAS,CAAA;IAC9D,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBAExC,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