@skmtc/core 0.0.808 → 0.0.810

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 (73) hide show
  1. package/esm/context/types.d.ts +0 -8
  2. package/esm/context/types.d.ts.map +1 -1
  3. package/esm/dsl/model/toModelBase.d.ts +24 -2
  4. package/esm/dsl/model/toModelBase.d.ts.map +1 -1
  5. package/esm/dsl/model/types.d.ts +2 -2
  6. package/esm/dsl/operation/toOperationBase.d.ts +26 -3
  7. package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
  8. package/esm/dsl/operation/types.d.ts +2 -2
  9. package/esm/oas/array/array-types.d.ts +238 -25
  10. package/esm/oas/array/array-types.d.ts.map +1 -1
  11. package/esm/oas/array/array-types.js +97 -5
  12. package/esm/oas/boolean/boolean-types.d.ts +81 -9
  13. package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
  14. package/esm/oas/boolean/boolean-types.js +32 -2
  15. package/esm/oas/contact/contact-types.d.ts +176 -0
  16. package/esm/oas/contact/contact-types.d.ts.map +1 -1
  17. package/esm/oas/contact/contact-types.js +102 -0
  18. package/esm/oas/header/Header.d.ts +8 -185
  19. package/esm/oas/header/Header.d.ts.map +1 -1
  20. package/esm/oas/header/Header.js +57 -220
  21. package/esm/oas/mediaType/toMediaTypeItemV3.d.ts +288 -0
  22. package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
  23. package/esm/oas/mediaType/toMediaTypeItemV3.js +272 -0
  24. package/esm/oas/operation/operation-types.d.ts +251 -0
  25. package/esm/oas/operation/operation-types.d.ts.map +1 -1
  26. package/esm/oas/operation/operation-types.js +98 -0
  27. package/esm/oas/string/string-types.d.ts +192 -18
  28. package/esm/oas/string/string-types.d.ts.map +1 -1
  29. package/esm/oas/string/string-types.js +76 -4
  30. package/esm/types/ModuleExport.d.ts +130 -0
  31. package/esm/types/ModuleExport.d.ts.map +1 -1
  32. package/esm/types/ModuleExport.js +36 -0
  33. package/esm/typescript/List.d.ts +2 -2
  34. package/esm/typescript/List.d.ts.map +1 -1
  35. package/esm/typescript/List.js +4 -4
  36. package/esm/typescript/toPathTemplate.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/script/context/types.d.ts +0 -8
  39. package/script/context/types.d.ts.map +1 -1
  40. package/script/dsl/model/toModelBase.d.ts +24 -2
  41. package/script/dsl/model/toModelBase.d.ts.map +1 -1
  42. package/script/dsl/model/types.d.ts +2 -2
  43. package/script/dsl/operation/toOperationBase.d.ts +26 -3
  44. package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
  45. package/script/dsl/operation/types.d.ts +2 -2
  46. package/script/oas/array/array-types.d.ts +238 -25
  47. package/script/oas/array/array-types.d.ts.map +1 -1
  48. package/script/oas/array/array-types.js +97 -5
  49. package/script/oas/boolean/boolean-types.d.ts +81 -9
  50. package/script/oas/boolean/boolean-types.d.ts.map +1 -1
  51. package/script/oas/boolean/boolean-types.js +32 -2
  52. package/script/oas/contact/contact-types.d.ts +176 -0
  53. package/script/oas/contact/contact-types.d.ts.map +1 -1
  54. package/script/oas/contact/contact-types.js +102 -0
  55. package/script/oas/header/Header.d.ts +8 -185
  56. package/script/oas/header/Header.d.ts.map +1 -1
  57. package/script/oas/header/Header.js +57 -220
  58. package/script/oas/mediaType/toMediaTypeItemV3.d.ts +288 -0
  59. package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
  60. package/script/oas/mediaType/toMediaTypeItemV3.js +272 -0
  61. package/script/oas/operation/operation-types.d.ts +251 -0
  62. package/script/oas/operation/operation-types.d.ts.map +1 -1
  63. package/script/oas/operation/operation-types.js +98 -0
  64. package/script/oas/string/string-types.d.ts +192 -18
  65. package/script/oas/string/string-types.d.ts.map +1 -1
  66. package/script/oas/string/string-types.js +76 -4
  67. package/script/types/ModuleExport.d.ts +130 -0
  68. package/script/types/ModuleExport.d.ts.map +1 -1
  69. package/script/types/ModuleExport.js +36 -0
  70. package/script/typescript/List.d.ts +2 -2
  71. package/script/typescript/List.d.ts.map +1 -1
  72. package/script/typescript/List.js +4 -4
  73. package/script/typescript/toPathTemplate.d.ts.map +1 -1
@@ -2,27 +2,99 @@ import * as v from 'valibot';
2
2
  /**
3
3
  * Valibot schema for validating OpenAPI boolean data objects.
4
4
  *
5
- * Validates boolean schemas including default values and enumeration
6
- * constraints. Boolean enums typically contain [true, false] or single values.
5
+ * This schema validates OpenAPI boolean schemas according to the OpenAPI v3 specification,
6
+ * including optional properties like default values, enumeration constraints, title,
7
+ * and description metadata. Boolean enums are commonly used to restrict values to
8
+ * specific boolean constants (e.g., [true] for always-true flags).
9
+ *
10
+ * @example Validating a basic boolean schema
11
+ * ```typescript
12
+ * import { oasBooleanData } from '@skmtc/core/oas/boolean';
13
+ * import * as v from 'valibot';
14
+ *
15
+ * const schema = {
16
+ * type: 'boolean',
17
+ * description: 'Whether the feature is enabled',
18
+ * default: false
19
+ * };
20
+ *
21
+ * const validated = v.parse(oasBooleanData, schema);
22
+ * console.log(validated.default); // false
23
+ * ```
24
+ *
25
+ * @example Validating boolean with enumeration
26
+ * ```typescript
27
+ * const constrainedBoolean = {
28
+ * type: 'boolean',
29
+ * title: 'Admin Flag',
30
+ * description: 'User admin status',
31
+ * enum: [true] // Only true values allowed
32
+ * };
33
+ *
34
+ * const result = v.parse(oasBooleanData, constrainedBoolean);
35
+ * console.log(result.enum); // [true]
36
+ * ```
7
37
  */
8
38
  export declare const oasBooleanData: v.GenericSchema<OasBooleanData>;
9
39
  /**
10
40
  * Data type for OpenAPI boolean schema objects.
11
41
  *
12
- * Represents boolean schemas with optional default values and enumeration
13
- * constraints. Used throughout the SKMTC pipeline for boolean type
14
- * processing and code generation.
42
+ * Represents the structure of OpenAPI boolean schemas as processed by the SKMTC pipeline.
43
+ * This type includes all standard OpenAPI boolean schema properties including metadata,
44
+ * default values, and enumeration constraints. It's used throughout the boolean
45
+ * processing pipeline for type-safe handling of boolean schema definitions.
46
+ *
47
+ * ## Usage in SKMTC Pipeline
48
+ *
49
+ * This type is used by:
50
+ * - Schema parsers to validate incoming boolean schema data
51
+ * - Boolean processors to transform OpenAPI schemas into OAS objects
52
+ * - Code generators to access boolean schema metadata and constraints
53
+ * - Validation systems to ensure schema compliance
54
+ *
55
+ * @example Basic boolean schema
56
+ * ```typescript
57
+ * import type { OasBooleanData } from '@skmtc/core/oas/boolean';
58
+ *
59
+ * const isActiveSchema: OasBooleanData = {
60
+ * type: 'boolean',
61
+ * title: 'Active Status',
62
+ * description: 'Whether the record is active',
63
+ * default: true
64
+ * };
65
+ * ```
66
+ *
67
+ * @example Boolean with enumeration constraints
68
+ * ```typescript
69
+ * const adminFlagSchema: OasBooleanData = {
70
+ * type: 'boolean',
71
+ * description: 'Administrative privileges flag',
72
+ * enum: [false, true], // Allow both values
73
+ * default: false
74
+ * };
75
+ * ```
76
+ *
77
+ * @example Read-only boolean flag
78
+ * ```typescript
79
+ * const systemFlagSchema: OasBooleanData = {
80
+ * type: 'boolean',
81
+ * title: 'System Generated',
82
+ * description: 'Indicates if the record was system-generated',
83
+ * enum: [true], // Always true
84
+ * default: true
85
+ * };
86
+ * ```
15
87
  */
16
88
  export type OasBooleanData = {
17
89
  /** Type identifier (always 'boolean') */
18
90
  type: 'boolean';
19
- /** Human-readable title for the boolean */
91
+ /** Human-readable title for the boolean schema */
20
92
  title?: string;
21
- /** Detailed description of the boolean's purpose */
93
+ /** Detailed description explaining the boolean's purpose and usage */
22
94
  description?: string;
23
- /** Default value for the boolean */
95
+ /** Default value used when no explicit value is provided */
24
96
  default?: boolean;
25
- /** Array of valid boolean values (typically [true], [false], or [true, false]) */
97
+ /** Array of valid boolean values for enumeration constraints */
26
98
  enum?: boolean[];
27
99
  };
28
100
  //# sourceMappingURL=boolean-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"boolean-types.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/boolean-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAMzD,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB,CAAA"}
1
+ {"version":3,"file":"boolean-types.d.ts","sourceRoot":"","sources":["../../../src/oas/boolean/boolean-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAMzD,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,SAAS,CAAA;IACf,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gEAAgE;IAChE,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB,CAAA"}
@@ -38,8 +38,38 @@ const v = __importStar(require("valibot"));
38
38
  /**
39
39
  * Valibot schema for validating OpenAPI boolean data objects.
40
40
  *
41
- * Validates boolean schemas including default values and enumeration
42
- * constraints. Boolean enums typically contain [true, false] or single values.
41
+ * This schema validates OpenAPI boolean schemas according to the OpenAPI v3 specification,
42
+ * including optional properties like default values, enumeration constraints, title,
43
+ * and description metadata. Boolean enums are commonly used to restrict values to
44
+ * specific boolean constants (e.g., [true] for always-true flags).
45
+ *
46
+ * @example Validating a basic boolean schema
47
+ * ```typescript
48
+ * import { oasBooleanData } from '@skmtc/core/oas/boolean';
49
+ * import * as v from 'valibot';
50
+ *
51
+ * const schema = {
52
+ * type: 'boolean',
53
+ * description: 'Whether the feature is enabled',
54
+ * default: false
55
+ * };
56
+ *
57
+ * const validated = v.parse(oasBooleanData, schema);
58
+ * console.log(validated.default); // false
59
+ * ```
60
+ *
61
+ * @example Validating boolean with enumeration
62
+ * ```typescript
63
+ * const constrainedBoolean = {
64
+ * type: 'boolean',
65
+ * title: 'Admin Flag',
66
+ * description: 'User admin status',
67
+ * enum: [true] // Only true values allowed
68
+ * };
69
+ *
70
+ * const result = v.parse(oasBooleanData, constrainedBoolean);
71
+ * console.log(result.enum); // [true]
72
+ * ```
43
73
  */
44
74
  exports.oasBooleanData = v.object({
45
75
  type: v.literal('boolean'),
@@ -1,9 +1,185 @@
1
1
  import * as v from 'valibot';
2
+ /**
3
+ * Data type for OpenAPI contact information objects.
4
+ *
5
+ * This type represents contact information as specified in the OpenAPI v3 specification's
6
+ * Info Object. Contact information provides details about the person or organization
7
+ * responsible for the API, including optional name, website URL, and email address.
8
+ *
9
+ * The contact information is typically displayed in API documentation and used by
10
+ * developers to reach out for support, questions, or feedback about the API.
11
+ *
12
+ * ## Usage in SKMTC Pipeline
13
+ *
14
+ * This type is used by:
15
+ * - Info processors to validate and structure contact information
16
+ * - Documentation generators to display API maintainer information
17
+ * - Client generators to embed support contact details in generated code
18
+ * - Validation systems to ensure contact information completeness
19
+ *
20
+ * @example Basic contact information
21
+ * ```typescript
22
+ * import type { OasContactData } from '@skmtc/core/oas/contact';
23
+ *
24
+ * const apiContact: OasContactData = {
25
+ * oasType: 'contact',
26
+ * name: 'API Support Team',
27
+ * url: 'https://company.com/support',
28
+ * email: 'api-support@company.com'
29
+ * };
30
+ * ```
31
+ *
32
+ * @example Minimal contact with only email
33
+ * ```typescript
34
+ * const minimalContact: OasContactData = {
35
+ * oasType: 'contact',
36
+ * email: 'support@api-company.com'
37
+ * };
38
+ * ```
39
+ *
40
+ * @example Contact with name and URL
41
+ * ```typescript
42
+ * const teamContact: OasContactData = {
43
+ * oasType: 'contact',
44
+ * name: 'Development Team',
45
+ * url: 'https://github.com/company/api-repo'
46
+ * };
47
+ * ```
48
+ *
49
+ * @example Integration in OpenAPI Info object
50
+ * ```typescript
51
+ * const apiInfo = {
52
+ * title: 'My API',
53
+ * version: '1.0.0',
54
+ * description: 'A comprehensive API for managing resources',
55
+ * contact: {
56
+ * oasType: 'contact',
57
+ * name: 'Jane Doe',
58
+ * url: 'https://janedoe.dev',
59
+ * email: 'jane@company.com'
60
+ * }
61
+ * };
62
+ * ```
63
+ *
64
+ * @example Empty contact (valid but not recommended)
65
+ * ```typescript
66
+ * const emptyContact: OasContactData = {
67
+ * oasType: 'contact'
68
+ * // All fields are optional, but at least one should be provided
69
+ * };
70
+ * ```
71
+ */
2
72
  export type OasContactData = {
73
+ /** Type identifier for SKMTC internal processing */
3
74
  oasType: 'contact';
75
+ /** The identifying name of the contact person or organization */
4
76
  name?: string;
77
+ /** The URL pointing to the contact information (website, GitHub, etc.) */
5
78
  url?: string;
79
+ /** The email address of the contact person or organization */
6
80
  email?: string;
7
81
  };
82
+ /**
83
+ * Valibot schema for validating OpenAPI contact data objects.
84
+ *
85
+ * This schema validates OpenAPI contact information according to the OpenAPI v3
86
+ * specification. All contact fields are optional, allowing for flexible contact
87
+ * information configurations. The schema ensures proper string formatting for
88
+ * name, URL, and email fields while maintaining the required `oasType` identifier.
89
+ *
90
+ * Note that while all fields are optional according to the OpenAPI specification,
91
+ * it's recommended to provide at least one contact method for practical API usage.
92
+ *
93
+ * @example Validating complete contact information
94
+ * ```typescript
95
+ * import { oasContactData } from '@skmtc/core/oas/contact';
96
+ * import * as v from 'valibot';
97
+ *
98
+ * const contact = {
99
+ * oasType: 'contact',
100
+ * name: 'API Support',
101
+ * url: 'https://api.company.com/support',
102
+ * email: 'support@company.com'
103
+ * };
104
+ *
105
+ * const validated = v.parse(oasContactData, contact);
106
+ * console.log(validated.name); // 'API Support'
107
+ * console.log(validated.email); // 'support@company.com'
108
+ * ```
109
+ *
110
+ * @example Validating partial contact information
111
+ * ```typescript
112
+ * const partialContact = {
113
+ * oasType: 'contact',
114
+ * email: 'help@api.com'
115
+ * // name and url are optional and omitted
116
+ * };
117
+ *
118
+ * const result = v.parse(oasContactData, partialContact);
119
+ * console.log(result.email); // 'help@api.com'
120
+ * console.log(result.name); // undefined
121
+ * console.log(result.url); // undefined
122
+ * ```
123
+ *
124
+ * @example Validation error handling
125
+ * ```typescript
126
+ * const invalidContact = {
127
+ * oasType: 'contact',
128
+ * name: 123, // Invalid: should be string
129
+ * email: 'valid@email.com'
130
+ * };
131
+ *
132
+ * try {
133
+ * v.parse(oasContactData, invalidContact);
134
+ * } catch (error) {
135
+ * console.error('Contact validation failed:', error.message);
136
+ * // Handle validation errors appropriately
137
+ * }
138
+ * ```
139
+ *
140
+ * @example Usage in OpenAPI document processing
141
+ * ```typescript
142
+ * function processApiInfo(infoObject: unknown) {
143
+ * // Validate the info object structure
144
+ * const info = parseInfoObject(infoObject);
145
+ *
146
+ * // If contact information exists, validate it
147
+ * if (info.contact) {
148
+ * const validatedContact = v.parse(oasContactData, {
149
+ * oasType: 'contact',
150
+ * ...info.contact
151
+ * });
152
+ *
153
+ * console.log(`API maintained by: ${validatedContact.name || 'Unknown'}`);
154
+ * console.log(`Support: ${validatedContact.email || 'No email provided'}`);
155
+ * }
156
+ * }
157
+ * ```
158
+ *
159
+ * @example Integration with documentation generators
160
+ * ```typescript
161
+ * class DocumentationGenerator {
162
+ * generateContactSection(contactData: OasContactData): string {
163
+ * const validated = v.parse(oasContactData, contactData);
164
+ *
165
+ * let contactSection = '## Contact Information\n\n';
166
+ *
167
+ * if (validated.name) {
168
+ * contactSection += `**Maintainer:** ${validated.name}\n\n`;
169
+ * }
170
+ *
171
+ * if (validated.email) {
172
+ * contactSection += `**Email:** [${validated.email}](mailto:${validated.email})\n\n`;
173
+ * }
174
+ *
175
+ * if (validated.url) {
176
+ * contactSection += `**Website:** [${validated.url}](${validated.url})\n\n`;
177
+ * }
178
+ *
179
+ * return contactSection;
180
+ * }
181
+ * }
182
+ * ```
183
+ */
8
184
  export declare const oasContactData: v.GenericSchema<OasContactData>;
9
185
  //# sourceMappingURL=contact-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contact-types.d.ts","sourceRoot":"","sources":["../../../src/oas/contact/contact-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA"}
1
+ {"version":3,"file":"contact-types.d.ts","sourceRoot":"","sources":["../../../src/oas/contact/contact-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,oDAAoD;IACpD,OAAO,EAAE,SAAS,CAAA;IAClB,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,cAAc,CAKzD,CAAA"}
@@ -35,6 +35,108 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.oasContactData = void 0;
37
37
  const v = __importStar(require("valibot"));
38
+ /**
39
+ * Valibot schema for validating OpenAPI contact data objects.
40
+ *
41
+ * This schema validates OpenAPI contact information according to the OpenAPI v3
42
+ * specification. All contact fields are optional, allowing for flexible contact
43
+ * information configurations. The schema ensures proper string formatting for
44
+ * name, URL, and email fields while maintaining the required `oasType` identifier.
45
+ *
46
+ * Note that while all fields are optional according to the OpenAPI specification,
47
+ * it's recommended to provide at least one contact method for practical API usage.
48
+ *
49
+ * @example Validating complete contact information
50
+ * ```typescript
51
+ * import { oasContactData } from '@skmtc/core/oas/contact';
52
+ * import * as v from 'valibot';
53
+ *
54
+ * const contact = {
55
+ * oasType: 'contact',
56
+ * name: 'API Support',
57
+ * url: 'https://api.company.com/support',
58
+ * email: 'support@company.com'
59
+ * };
60
+ *
61
+ * const validated = v.parse(oasContactData, contact);
62
+ * console.log(validated.name); // 'API Support'
63
+ * console.log(validated.email); // 'support@company.com'
64
+ * ```
65
+ *
66
+ * @example Validating partial contact information
67
+ * ```typescript
68
+ * const partialContact = {
69
+ * oasType: 'contact',
70
+ * email: 'help@api.com'
71
+ * // name and url are optional and omitted
72
+ * };
73
+ *
74
+ * const result = v.parse(oasContactData, partialContact);
75
+ * console.log(result.email); // 'help@api.com'
76
+ * console.log(result.name); // undefined
77
+ * console.log(result.url); // undefined
78
+ * ```
79
+ *
80
+ * @example Validation error handling
81
+ * ```typescript
82
+ * const invalidContact = {
83
+ * oasType: 'contact',
84
+ * name: 123, // Invalid: should be string
85
+ * email: 'valid@email.com'
86
+ * };
87
+ *
88
+ * try {
89
+ * v.parse(oasContactData, invalidContact);
90
+ * } catch (error) {
91
+ * console.error('Contact validation failed:', error.message);
92
+ * // Handle validation errors appropriately
93
+ * }
94
+ * ```
95
+ *
96
+ * @example Usage in OpenAPI document processing
97
+ * ```typescript
98
+ * function processApiInfo(infoObject: unknown) {
99
+ * // Validate the info object structure
100
+ * const info = parseInfoObject(infoObject);
101
+ *
102
+ * // If contact information exists, validate it
103
+ * if (info.contact) {
104
+ * const validatedContact = v.parse(oasContactData, {
105
+ * oasType: 'contact',
106
+ * ...info.contact
107
+ * });
108
+ *
109
+ * console.log(`API maintained by: ${validatedContact.name || 'Unknown'}`);
110
+ * console.log(`Support: ${validatedContact.email || 'No email provided'}`);
111
+ * }
112
+ * }
113
+ * ```
114
+ *
115
+ * @example Integration with documentation generators
116
+ * ```typescript
117
+ * class DocumentationGenerator {
118
+ * generateContactSection(contactData: OasContactData): string {
119
+ * const validated = v.parse(oasContactData, contactData);
120
+ *
121
+ * let contactSection = '## Contact Information\n\n';
122
+ *
123
+ * if (validated.name) {
124
+ * contactSection += `**Maintainer:** ${validated.name}\n\n`;
125
+ * }
126
+ *
127
+ * if (validated.email) {
128
+ * contactSection += `**Email:** [${validated.email}](mailto:${validated.email})\n\n`;
129
+ * }
130
+ *
131
+ * if (validated.url) {
132
+ * contactSection += `**Website:** [${validated.url}](${validated.url})\n\n`;
133
+ * }
134
+ *
135
+ * return contactSection;
136
+ * }
137
+ * }
138
+ * ```
139
+ */
38
140
  exports.oasContactData = v.object({
39
141
  oasType: v.literal('contact'),
40
142
  name: v.optional(v.string()),
@@ -34,15 +34,6 @@ export type HeaderFields = {
34
34
  * This class provides comprehensive support for header definitions with typed
35
35
  * values, validation schemas, examples, and documentation.
36
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
37
  * @example Basic authentication header
47
38
  * ```typescript
48
39
  * import { OasHeader, OasString } from '@skmtc/core';
@@ -62,192 +53,24 @@ export type HeaderFields = {
62
53
  * }
63
54
  * });
64
55
  * ```
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
56
  */
233
57
  export declare class OasHeader {
234
- #private;
235
58
  oasType: 'header';
236
- constructor(fields: HeaderFields);
237
59
  /** Brief description of header */
238
- get description(): string | undefined;
60
+ description: string | undefined;
239
61
  /** Indicates if header is mandatory. Default value is `false` */
240
- get required(): boolean | undefined;
62
+ required: boolean | undefined;
241
63
  /** Indicates if header is deprecated and should no longer be used. Default value is false */
242
- get deprecated(): boolean | undefined;
64
+ deprecated: boolean | undefined;
243
65
  /** Schema for the header */
244
- get schema(): OasSchema | OasRef<'schema'> | undefined;
66
+ schema: OasSchema | OasRef<'schema'> | undefined;
245
67
  /** Examples of the header */
246
- get examples(): Record<string, OasExample | OasRef<'example'>> | undefined;
68
+ examples: Record<string, OasExample | OasRef<'example'>> | undefined;
247
69
  /** Content of the header */
248
- get content(): Record<string, OasMediaType> | undefined;
70
+ content: Record<string, OasMediaType> | undefined;
249
71
  /** Specification Extension fields */
250
- get extensionFields(): Record<string, unknown> | undefined;
72
+ extensionFields: Record<string, unknown> | undefined;
73
+ constructor(fields: HeaderFields);
251
74
  /** Returns true if object is a reference */
252
75
  isRef(): this is OasRef<'header'>;
253
76
  /** Returns itself */
@@ -1 +1 @@
1
- {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../src/oas/header/Header.ts"],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