@skmtc/core 0.0.791 → 0.0.793

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 (113) hide show
  1. package/esm/dsl/GeneratedValueList.d.ts +158 -0
  2. package/esm/dsl/GeneratedValueList.d.ts.map +1 -1
  3. package/esm/dsl/GeneratedValueList.js +158 -0
  4. package/esm/dsl/Stringable.d.ts +76 -0
  5. package/esm/dsl/Stringable.d.ts.map +1 -1
  6. package/esm/dsl/Stringable.js +75 -0
  7. package/esm/helpers/collateExamples.d.ts +150 -0
  8. package/esm/helpers/collateExamples.d.ts.map +1 -1
  9. package/esm/helpers/collateExamples.js +145 -0
  10. package/esm/helpers/formatNumber.d.ts +95 -0
  11. package/esm/helpers/formatNumber.d.ts.map +1 -1
  12. package/esm/helpers/formatNumber.js +95 -0
  13. package/esm/helpers/generationStats.d.ts +287 -1
  14. package/esm/helpers/generationStats.d.ts.map +1 -1
  15. package/esm/helpers/generationStats.js +266 -0
  16. package/esm/helpers/isEmpty.d.ts +62 -0
  17. package/esm/helpers/isEmpty.d.ts.map +1 -1
  18. package/esm/helpers/isEmpty.js +62 -0
  19. package/esm/helpers/isImported.d.ts +80 -0
  20. package/esm/helpers/isImported.d.ts.map +1 -1
  21. package/esm/helpers/isImported.js +80 -0
  22. package/esm/helpers/naming.d.ts +65 -1
  23. package/esm/helpers/naming.d.ts.map +1 -1
  24. package/esm/helpers/naming.js +65 -1
  25. package/esm/helpers/parseModuleName.d.ts +175 -0
  26. package/esm/helpers/parseModuleName.d.ts.map +1 -1
  27. package/esm/helpers/parseModuleName.js +153 -0
  28. package/esm/helpers/toResolvedArtifactPath.d.ts +145 -0
  29. package/esm/helpers/toResolvedArtifactPath.d.ts.map +1 -1
  30. package/esm/helpers/toResolvedArtifactPath.js +140 -0
  31. package/esm/oas/example/Example.d.ts +81 -1
  32. package/esm/oas/example/Example.d.ts.map +1 -1
  33. package/esm/oas/example/Example.js +74 -1
  34. package/esm/oas/header/Header.d.ts +217 -1
  35. package/esm/oas/header/Header.d.ts.map +1 -1
  36. package/esm/oas/header/Header.js +207 -1
  37. package/esm/oas/info/Info.d.ts +72 -0
  38. package/esm/oas/info/Info.d.ts.map +1 -1
  39. package/esm/oas/info/Info.js +62 -0
  40. package/esm/oas/mediaType/MediaType.d.ts +85 -0
  41. package/esm/oas/mediaType/MediaType.d.ts.map +1 -1
  42. package/esm/oas/mediaType/MediaType.js +77 -0
  43. package/esm/oas/pathItem/PathItem.d.ts +92 -0
  44. package/esm/oas/pathItem/PathItem.d.ts.map +1 -1
  45. package/esm/oas/pathItem/PathItem.js +85 -0
  46. package/esm/oas/requestBody/RequestBody.d.ts +264 -0
  47. package/esm/oas/requestBody/RequestBody.d.ts.map +1 -1
  48. package/esm/oas/requestBody/RequestBody.js +257 -0
  49. package/esm/oas/schema/Schema.d.ts +117 -0
  50. package/esm/oas/schema/Schema.d.ts.map +1 -1
  51. package/esm/typescript/identifiers.d.ts +159 -0
  52. package/esm/typescript/identifiers.d.ts.map +1 -1
  53. package/esm/typescript/identifiers.js +159 -0
  54. package/esm/typescript/withDescription.d.ts +119 -0
  55. package/esm/typescript/withDescription.d.ts.map +1 -1
  56. package/esm/typescript/withDescription.js +119 -0
  57. package/package.json +1 -1
  58. package/script/dsl/GeneratedValueList.d.ts +158 -0
  59. package/script/dsl/GeneratedValueList.d.ts.map +1 -1
  60. package/script/dsl/GeneratedValueList.js +158 -0
  61. package/script/dsl/Stringable.d.ts +76 -0
  62. package/script/dsl/Stringable.d.ts.map +1 -1
  63. package/script/dsl/Stringable.js +75 -0
  64. package/script/helpers/collateExamples.d.ts +150 -0
  65. package/script/helpers/collateExamples.d.ts.map +1 -1
  66. package/script/helpers/collateExamples.js +145 -0
  67. package/script/helpers/formatNumber.d.ts +95 -0
  68. package/script/helpers/formatNumber.d.ts.map +1 -1
  69. package/script/helpers/formatNumber.js +95 -0
  70. package/script/helpers/generationStats.d.ts +287 -1
  71. package/script/helpers/generationStats.d.ts.map +1 -1
  72. package/script/helpers/generationStats.js +266 -0
  73. package/script/helpers/isEmpty.d.ts +62 -0
  74. package/script/helpers/isEmpty.d.ts.map +1 -1
  75. package/script/helpers/isEmpty.js +62 -0
  76. package/script/helpers/isImported.d.ts +80 -0
  77. package/script/helpers/isImported.d.ts.map +1 -1
  78. package/script/helpers/isImported.js +80 -0
  79. package/script/helpers/naming.d.ts +65 -1
  80. package/script/helpers/naming.d.ts.map +1 -1
  81. package/script/helpers/naming.js +65 -1
  82. package/script/helpers/parseModuleName.d.ts +175 -0
  83. package/script/helpers/parseModuleName.d.ts.map +1 -1
  84. package/script/helpers/parseModuleName.js +153 -0
  85. package/script/helpers/toResolvedArtifactPath.d.ts +145 -0
  86. package/script/helpers/toResolvedArtifactPath.d.ts.map +1 -1
  87. package/script/helpers/toResolvedArtifactPath.js +140 -0
  88. package/script/oas/example/Example.d.ts +81 -1
  89. package/script/oas/example/Example.d.ts.map +1 -1
  90. package/script/oas/example/Example.js +74 -1
  91. package/script/oas/header/Header.d.ts +217 -1
  92. package/script/oas/header/Header.d.ts.map +1 -1
  93. package/script/oas/header/Header.js +207 -1
  94. package/script/oas/info/Info.d.ts +72 -0
  95. package/script/oas/info/Info.d.ts.map +1 -1
  96. package/script/oas/info/Info.js +62 -0
  97. package/script/oas/mediaType/MediaType.d.ts +85 -0
  98. package/script/oas/mediaType/MediaType.d.ts.map +1 -1
  99. package/script/oas/mediaType/MediaType.js +77 -0
  100. package/script/oas/pathItem/PathItem.d.ts +92 -0
  101. package/script/oas/pathItem/PathItem.d.ts.map +1 -1
  102. package/script/oas/pathItem/PathItem.js +85 -0
  103. package/script/oas/requestBody/RequestBody.d.ts +264 -0
  104. package/script/oas/requestBody/RequestBody.d.ts.map +1 -1
  105. package/script/oas/requestBody/RequestBody.js +257 -0
  106. package/script/oas/schema/Schema.d.ts +117 -0
  107. package/script/oas/schema/Schema.d.ts.map +1 -1
  108. package/script/typescript/identifiers.d.ts +159 -0
  109. package/script/typescript/identifiers.d.ts.map +1 -1
  110. package/script/typescript/identifiers.js +159 -0
  111. package/script/typescript/withDescription.d.ts +119 -0
  112. package/script/typescript/withDescription.d.ts.map +1 -1
  113. package/script/typescript/withDescription.js +119 -0
@@ -4,16 +4,232 @@ import type { OasExample } from '../example/Example.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 OasHeader}.
9
+ */
7
10
  export type HeaderFields = {
11
+ /** A brief description of the header */
8
12
  description: string | undefined;
13
+ /** Whether the header is required */
9
14
  required: boolean | undefined;
15
+ /** Whether the header is deprecated */
10
16
  deprecated: boolean | undefined;
17
+ /** Schema defining the header's data type */
11
18
  schema: OasSchema | OasRef<'schema'> | undefined;
19
+ /** Example values for the header */
12
20
  examples: Record<string, OasExample | OasRef<'example'>> | undefined;
21
+ /** Content definitions for complex header values */
13
22
  content: Record<string, OasMediaType> | undefined;
23
+ /** Custom extension fields (x-* properties) */
14
24
  extensionFields?: Record<string, unknown>;
15
25
  };
16
- /** Describes a single header in the API */
26
+ /**
27
+ * Represents a Header Object in the OpenAPI Specification.
28
+ *
29
+ * The `OasHeader` class encapsulates the definition of a single HTTP header that
30
+ * can be sent with responses or expected in requests. Headers provide additional
31
+ * metadata about the HTTP message and can include authentication tokens, content
32
+ * information, pagination data, rate limiting details, and more.
33
+ *
34
+ * This class provides comprehensive support for header definitions with typed
35
+ * values, validation schemas, examples, and documentation.
36
+ *
37
+ * ## Key Features
38
+ *
39
+ * - **Schema Validation**: Typed header values through schema definitions
40
+ * - **Examples**: Multiple example values for documentation and testing
41
+ * - **Content Types**: Support for complex header values with media types
42
+ * - **Deprecation Support**: Mark headers as deprecated with proper warnings
43
+ * - **Required/Optional**: Control whether headers are mandatory
44
+ * - **Documentation**: Rich description support for API documentation
45
+ *
46
+ * @example Basic authentication header
47
+ * ```typescript
48
+ * import { OasHeader, OasString } from '@skmtc/core';
49
+ *
50
+ * const authHeader = new OasHeader({
51
+ * description: 'Bearer token for API authentication',
52
+ * required: true,
53
+ * schema: new OasString({
54
+ * pattern: '^Bearer [A-Za-z0-9+/=]+$',
55
+ * description: 'JWT bearer token'
56
+ * }),
57
+ * examples: {
58
+ * valid: new OasExample({
59
+ * summary: 'Valid bearer token',
60
+ * value: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
61
+ * })
62
+ * }
63
+ * });
64
+ * ```
65
+ *
66
+ * @example Pagination headers
67
+ * ```typescript
68
+ * const totalCountHeader = new OasHeader({
69
+ * description: 'Total number of items available',
70
+ * required: false,
71
+ * schema: new OasInteger({
72
+ * minimum: 0,
73
+ * description: 'Non-negative integer count'
74
+ * }),
75
+ * examples: {
76
+ * empty: new OasExample({ value: 0, description: 'No items' }),
77
+ * normal: new OasExample({ value: 150, description: 'Normal case' }),
78
+ * large: new OasExample({ value: 10000, description: 'Large dataset' })
79
+ * }
80
+ * });
81
+ *
82
+ * const linkHeader = new OasHeader({
83
+ * description: 'Pagination links (RFC 5988)',
84
+ * required: false,
85
+ * schema: new OasString({
86
+ * description: 'Comma-separated list of link relations'
87
+ * }),
88
+ * examples: {
89
+ * withNext: new OasExample({
90
+ * value: '</api/users?page=2>; rel="next", </api/users?page=10>; rel="last"'
91
+ * }),
92
+ * lastPage: new OasExample({
93
+ * value: '</api/users?page=9>; rel="prev", </api/users?page=1>; rel="first"'
94
+ * })
95
+ * }
96
+ * });
97
+ * ```
98
+ *
99
+ * @example Content type and encoding headers
100
+ * ```typescript
101
+ * const contentTypeHeader = new OasHeader({
102
+ * description: 'MIME type of the response content',
103
+ * required: true,
104
+ * schema: new OasString({
105
+ * enum: [
106
+ * 'application/json',
107
+ * 'application/xml',
108
+ * 'text/csv',
109
+ * 'application/pdf',
110
+ * 'application/octet-stream'
111
+ * ]
112
+ * }),
113
+ * examples: {
114
+ * json: new OasExample({ value: 'application/json' }),
115
+ * xml: new OasExample({ value: 'application/xml' }),
116
+ * csv: new OasExample({ value: 'text/csv' })
117
+ * }
118
+ * });
119
+ *
120
+ * const contentLengthHeader = new OasHeader({
121
+ * description: 'Size of the response body in bytes',
122
+ * required: false,
123
+ * schema: new OasInteger({
124
+ * minimum: 0,
125
+ * description: 'Content size in bytes'
126
+ * })
127
+ * });
128
+ * ```
129
+ *
130
+ * @example Rate limiting headers
131
+ * ```typescript
132
+ * const rateLimitHeader = new OasHeader({
133
+ * description: 'Number of requests remaining in the current window',
134
+ * required: false,
135
+ * schema: new OasInteger({
136
+ * minimum: 0,
137
+ * description: 'Remaining request count'
138
+ * }),
139
+ * examples: {
140
+ * available: new OasExample({ value: 95, description: '95 requests remaining' }),
141
+ * depleted: new OasExample({ value: 0, description: 'Rate limit reached' })
142
+ * }
143
+ * });
144
+ *
145
+ * const rateLimitResetHeader = new OasHeader({
146
+ * description: 'Unix timestamp when the rate limit window resets',
147
+ * required: false,
148
+ * schema: new OasInteger({
149
+ * minimum: 0,
150
+ * description: 'Unix timestamp in seconds'
151
+ * }),
152
+ * examples: {
153
+ * reset: new OasExample({
154
+ * value: 1634567890,
155
+ * description: 'Reset at 2021-10-18 12:31:30 UTC'
156
+ * })
157
+ * }
158
+ * });
159
+ * ```
160
+ *
161
+ * @example Custom application headers
162
+ * ```typescript
163
+ * const requestIdHeader = new OasHeader({
164
+ * description: 'Unique identifier for request tracing',
165
+ * required: false,
166
+ * schema: new OasString({
167
+ * format: 'uuid',
168
+ * description: 'UUID v4 request identifier'
169
+ * }),
170
+ * examples: {
171
+ * uuid: new OasExample({
172
+ * value: '123e4567-e89b-12d3-a456-426614174000',
173
+ * description: 'Request tracking ID'
174
+ * })
175
+ * }
176
+ * });
177
+ *
178
+ * const serverTimingHeader = new OasHeader({
179
+ * description: 'Server-side performance metrics',
180
+ * required: false,
181
+ * schema: new OasString({
182
+ * description: 'Server-Timing header format (RFC 8760)'
183
+ * }),
184
+ * examples: {
185
+ * timing: new OasExample({
186
+ * value: 'db;dur=53, app;dur=47.2',
187
+ * description: 'Database took 53ms, app logic 47.2ms'
188
+ * })
189
+ * }
190
+ * });
191
+ * ```
192
+ *
193
+ * @example Deprecated header
194
+ * ```typescript
195
+ * const deprecatedHeader = new OasHeader({
196
+ * description: 'Legacy API version header (deprecated)',
197
+ * required: false,
198
+ * deprecated: true,
199
+ * schema: new OasString({
200
+ * enum: ['v1', 'v2'],
201
+ * description: 'Use Accept or Content-Type header instead'
202
+ * }),
203
+ * examples: {
204
+ * legacy: new OasExample({
205
+ * value: 'v1',
206
+ * description: 'Legacy version (use Accept header instead)'
207
+ * })
208
+ * }
209
+ * });
210
+ * ```
211
+ *
212
+ * @example Using in response definitions
213
+ * ```typescript
214
+ * const successResponse = new OasResponse({
215
+ * description: 'Paginated user list',
216
+ * headers: {
217
+ * 'X-Total-Count': totalCountHeader,
218
+ * 'Link': linkHeader,
219
+ * 'X-Rate-Limit-Remaining': rateLimitHeader,
220
+ * 'X-Rate-Limit-Reset': rateLimitResetHeader,
221
+ * 'X-Request-ID': requestIdHeader
222
+ * },
223
+ * content: {
224
+ * 'application/json': new OasMediaType({
225
+ * schema: new OasArray({
226
+ * items: new OasRef({ $ref: '#/components/schemas/User' })
227
+ * })
228
+ * })
229
+ * }
230
+ * });
231
+ * ```
232
+ */
17
233
  export declare class OasHeader {
18
234
  #private;
19
235
  oasType: 'header';
@@ -1 +1 @@
1
- {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/oas/header/Header.ts"],"names":[],"mappings":"AAAA,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,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SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAc9E,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,YAAY;CASnE"}
@@ -13,7 +13,213 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _OasHeader_fields;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.OasHeader = void 0;
16
- /** Describes a single header in the API */
16
+ /**
17
+ * Represents a Header Object in the OpenAPI Specification.
18
+ *
19
+ * The `OasHeader` class encapsulates the definition of a single HTTP header that
20
+ * can be sent with responses or expected in requests. Headers provide additional
21
+ * metadata about the HTTP message and can include authentication tokens, content
22
+ * information, pagination data, rate limiting details, and more.
23
+ *
24
+ * This class provides comprehensive support for header definitions with typed
25
+ * values, validation schemas, examples, and documentation.
26
+ *
27
+ * ## Key Features
28
+ *
29
+ * - **Schema Validation**: Typed header values through schema definitions
30
+ * - **Examples**: Multiple example values for documentation and testing
31
+ * - **Content Types**: Support for complex header values with media types
32
+ * - **Deprecation Support**: Mark headers as deprecated with proper warnings
33
+ * - **Required/Optional**: Control whether headers are mandatory
34
+ * - **Documentation**: Rich description support for API documentation
35
+ *
36
+ * @example Basic authentication header
37
+ * ```typescript
38
+ * import { OasHeader, OasString } from '@skmtc/core';
39
+ *
40
+ * const authHeader = new OasHeader({
41
+ * description: 'Bearer token for API authentication',
42
+ * required: true,
43
+ * schema: new OasString({
44
+ * pattern: '^Bearer [A-Za-z0-9+/=]+$',
45
+ * description: 'JWT bearer token'
46
+ * }),
47
+ * examples: {
48
+ * valid: new OasExample({
49
+ * summary: 'Valid bearer token',
50
+ * value: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
51
+ * })
52
+ * }
53
+ * });
54
+ * ```
55
+ *
56
+ * @example Pagination headers
57
+ * ```typescript
58
+ * const totalCountHeader = new OasHeader({
59
+ * description: 'Total number of items available',
60
+ * required: false,
61
+ * schema: new OasInteger({
62
+ * minimum: 0,
63
+ * description: 'Non-negative integer count'
64
+ * }),
65
+ * examples: {
66
+ * empty: new OasExample({ value: 0, description: 'No items' }),
67
+ * normal: new OasExample({ value: 150, description: 'Normal case' }),
68
+ * large: new OasExample({ value: 10000, description: 'Large dataset' })
69
+ * }
70
+ * });
71
+ *
72
+ * const linkHeader = new OasHeader({
73
+ * description: 'Pagination links (RFC 5988)',
74
+ * required: false,
75
+ * schema: new OasString({
76
+ * description: 'Comma-separated list of link relations'
77
+ * }),
78
+ * examples: {
79
+ * withNext: new OasExample({
80
+ * value: '</api/users?page=2>; rel="next", </api/users?page=10>; rel="last"'
81
+ * }),
82
+ * lastPage: new OasExample({
83
+ * value: '</api/users?page=9>; rel="prev", </api/users?page=1>; rel="first"'
84
+ * })
85
+ * }
86
+ * });
87
+ * ```
88
+ *
89
+ * @example Content type and encoding headers
90
+ * ```typescript
91
+ * const contentTypeHeader = new OasHeader({
92
+ * description: 'MIME type of the response content',
93
+ * required: true,
94
+ * schema: new OasString({
95
+ * enum: [
96
+ * 'application/json',
97
+ * 'application/xml',
98
+ * 'text/csv',
99
+ * 'application/pdf',
100
+ * 'application/octet-stream'
101
+ * ]
102
+ * }),
103
+ * examples: {
104
+ * json: new OasExample({ value: 'application/json' }),
105
+ * xml: new OasExample({ value: 'application/xml' }),
106
+ * csv: new OasExample({ value: 'text/csv' })
107
+ * }
108
+ * });
109
+ *
110
+ * const contentLengthHeader = new OasHeader({
111
+ * description: 'Size of the response body in bytes',
112
+ * required: false,
113
+ * schema: new OasInteger({
114
+ * minimum: 0,
115
+ * description: 'Content size in bytes'
116
+ * })
117
+ * });
118
+ * ```
119
+ *
120
+ * @example Rate limiting headers
121
+ * ```typescript
122
+ * const rateLimitHeader = new OasHeader({
123
+ * description: 'Number of requests remaining in the current window',
124
+ * required: false,
125
+ * schema: new OasInteger({
126
+ * minimum: 0,
127
+ * description: 'Remaining request count'
128
+ * }),
129
+ * examples: {
130
+ * available: new OasExample({ value: 95, description: '95 requests remaining' }),
131
+ * depleted: new OasExample({ value: 0, description: 'Rate limit reached' })
132
+ * }
133
+ * });
134
+ *
135
+ * const rateLimitResetHeader = new OasHeader({
136
+ * description: 'Unix timestamp when the rate limit window resets',
137
+ * required: false,
138
+ * schema: new OasInteger({
139
+ * minimum: 0,
140
+ * description: 'Unix timestamp in seconds'
141
+ * }),
142
+ * examples: {
143
+ * reset: new OasExample({
144
+ * value: 1634567890,
145
+ * description: 'Reset at 2021-10-18 12:31:30 UTC'
146
+ * })
147
+ * }
148
+ * });
149
+ * ```
150
+ *
151
+ * @example Custom application headers
152
+ * ```typescript
153
+ * const requestIdHeader = new OasHeader({
154
+ * description: 'Unique identifier for request tracing',
155
+ * required: false,
156
+ * schema: new OasString({
157
+ * format: 'uuid',
158
+ * description: 'UUID v4 request identifier'
159
+ * }),
160
+ * examples: {
161
+ * uuid: new OasExample({
162
+ * value: '123e4567-e89b-12d3-a456-426614174000',
163
+ * description: 'Request tracking ID'
164
+ * })
165
+ * }
166
+ * });
167
+ *
168
+ * const serverTimingHeader = new OasHeader({
169
+ * description: 'Server-side performance metrics',
170
+ * required: false,
171
+ * schema: new OasString({
172
+ * description: 'Server-Timing header format (RFC 8760)'
173
+ * }),
174
+ * examples: {
175
+ * timing: new OasExample({
176
+ * value: 'db;dur=53, app;dur=47.2',
177
+ * description: 'Database took 53ms, app logic 47.2ms'
178
+ * })
179
+ * }
180
+ * });
181
+ * ```
182
+ *
183
+ * @example Deprecated header
184
+ * ```typescript
185
+ * const deprecatedHeader = new OasHeader({
186
+ * description: 'Legacy API version header (deprecated)',
187
+ * required: false,
188
+ * deprecated: true,
189
+ * schema: new OasString({
190
+ * enum: ['v1', 'v2'],
191
+ * description: 'Use Accept or Content-Type header instead'
192
+ * }),
193
+ * examples: {
194
+ * legacy: new OasExample({
195
+ * value: 'v1',
196
+ * description: 'Legacy version (use Accept header instead)'
197
+ * })
198
+ * }
199
+ * });
200
+ * ```
201
+ *
202
+ * @example Using in response definitions
203
+ * ```typescript
204
+ * const successResponse = new OasResponse({
205
+ * description: 'Paginated user list',
206
+ * headers: {
207
+ * 'X-Total-Count': totalCountHeader,
208
+ * 'Link': linkHeader,
209
+ * 'X-Rate-Limit-Remaining': rateLimitHeader,
210
+ * 'X-Rate-Limit-Reset': rateLimitResetHeader,
211
+ * 'X-Request-ID': requestIdHeader
212
+ * },
213
+ * content: {
214
+ * 'application/json': new OasMediaType({
215
+ * schema: new OasArray({
216
+ * items: new OasRef({ $ref: '#/components/schemas/User' })
217
+ * })
218
+ * })
219
+ * }
220
+ * });
221
+ * ```
222
+ */
17
223
  class OasHeader {
18
224
  constructor(fields) {
19
225
  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;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA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AC,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"}
@@ -14,6 +14,68 @@ var _OasInfo_fields;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.OasInfo = void 0;
16
16
  require("../../_dnt.polyfills.js");
17
+ /**
18
+ * Represents an Info Object in the OpenAPI Specification.
19
+ *
20
+ * The `OasInfo` class encapsulates metadata about the API including its title,
21
+ * version, description, and contact information. This information is displayed
22
+ * in API documentation and helps developers understand what the API does and
23
+ * how to use it effectively.
24
+ *
25
+ * This class provides essential API metadata that appears at the top level
26
+ * of OpenAPI documents and drives documentation generation and tooling.
27
+ *
28
+ * ## Key Features
29
+ *
30
+ * - **API Identification**: Title and version information for API tracking
31
+ * - **Documentation**: Rich description support for API overview
32
+ * - **Contact Information**: Developer contact details and support resources
33
+ * - **Legal Information**: License and terms of service references
34
+ * - **Extension Support**: Custom fields for additional metadata
35
+ *
36
+ * @example Basic API information
37
+ * ```typescript
38
+ * import { OasInfo } from '@skmtc/core';
39
+ *
40
+ * const apiInfo = new OasInfo({
41
+ * title: 'Pet Store API',
42
+ * version: '1.0.0',
43
+ * description: 'A sample API that uses a petstore as an example'
44
+ * });
45
+ * ```
46
+ *
47
+ * @example Complete API metadata
48
+ * ```typescript
49
+ * const fullApiInfo = new OasInfo({
50
+ * title: 'E-Commerce Platform API',
51
+ * version: '2.1.0',
52
+ * description: 'Comprehensive e-commerce API for managing products, orders, and customers',
53
+ * termsOfService: 'https://api.example.com/terms',
54
+ * contact: new OasContact({
55
+ * name: 'API Support Team',
56
+ * url: 'https://api.example.com/support',
57
+ * email: 'api-support@example.com'
58
+ * }),
59
+ * license: new OasLicense({
60
+ * name: 'MIT',
61
+ * url: 'https://opensource.org/licenses/MIT'
62
+ * })
63
+ * });
64
+ * ```
65
+ *
66
+ * @example Versioned API with semantic versioning
67
+ * ```typescript
68
+ * const versionedInfo = new OasInfo({
69
+ * title: 'User Management Service',
70
+ * version: '3.2.1',
71
+ * description: 'RESTful API for user authentication and profile management',
72
+ * contact: new OasContact({
73
+ * name: 'Development Team',
74
+ * email: 'dev@company.com'
75
+ * })
76
+ * });
77
+ * ```
78
+ */
17
79
  class OasInfo {
18
80
  constructor(fields) {
19
81
  Object.defineProperty(this, "oasType", {