@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
@@ -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,G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* Represents a Media Type Object in the OpenAPI Specification.
6
+ *
7
+ * The `OasMediaType` class encapsulates the definition of content for different
8
+ * media types in request bodies and responses. It defines the structure, format,
9
+ * and validation rules for content using schemas and provides examples for
10
+ * documentation and testing purposes.
11
+ *
12
+ * This class supports various content types including JSON, XML, form data,
13
+ * file uploads, and binary content, making it essential for describing API
14
+ * request and response payloads.
15
+ *
16
+ * ## Key Features
17
+ *
18
+ * - **Schema Validation**: Define content structure through OpenAPI schemas
19
+ * - **Multiple Examples**: Rich example support for documentation and testing
20
+ * - **Encoding Support**: Handle multipart and form data encoding
21
+ * - **Content Type Support**: JSON, XML, binary, form data, and more
22
+ * - **Reference Integration**: Work seamlessly with schema references
23
+ *
24
+ * @example JSON content type
25
+ * ```typescript
26
+ * import { OasMediaType, OasObject, OasString } from '@skmtc/core';
27
+ *
28
+ * const jsonContent = new OasMediaType({
29
+ * mediaType: 'application/json',
30
+ * schema: new OasObject({
31
+ * properties: {
32
+ * name: new OasString(),
33
+ * email: new OasString({ format: 'email' })
34
+ * }
35
+ * }),
36
+ * examples: {
37
+ * user: new OasExample({
38
+ * summary: 'Sample user',
39
+ * value: { name: 'John Doe', email: 'john@example.com' }
40
+ * })
41
+ * }
42
+ * });
43
+ * ```
44
+ *
45
+ * @example File upload with multipart form data
46
+ * ```typescript
47
+ * const fileUpload = new OasMediaType({
48
+ * mediaType: 'multipart/form-data',
49
+ * schema: new OasObject({
50
+ * properties: {
51
+ * file: new OasString({ format: 'binary' }),
52
+ * description: new OasString()
53
+ * }
54
+ * }),
55
+ * encoding: {
56
+ * file: {
57
+ * contentType: 'image/png, image/jpeg',
58
+ * style: 'form'
59
+ * }
60
+ * }
61
+ * });
62
+ * ```
63
+ *
64
+ * @example XML content with namespace
65
+ * ```typescript
66
+ * const xmlContent = new OasMediaType({
67
+ * mediaType: 'application/xml',
68
+ * schema: new OasObject({
69
+ * properties: {
70
+ * product: new OasRef({ $ref: '#/components/schemas/Product' })
71
+ * }
72
+ * }),
73
+ * examples: {
74
+ * sample: new OasExample({
75
+ * value: '<product><name>Widget</name><price>19.99</price></product>'
76
+ * })
77
+ * }
78
+ * });
79
+ * ```
80
+ */
4
81
  class OasMediaType {
5
82
  constructor(fields) {
6
83
  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,SA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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,MAAM,GAAE,cAAmB;CAMxC"}
@@ -1,6 +1,91 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OasPathItem = void 0;
4
+ /**
5
+ * Represents a Path Item Object in the OpenAPI Specification.
6
+ *
7
+ * The `OasPathItem` class describes operations available on a single API path.
8
+ * It serves as a container for HTTP operations (GET, POST, PUT, DELETE, etc.)
9
+ * and can define parameters that apply to all operations on the path.
10
+ *
11
+ * This class provides path-level configuration and shared parameters that
12
+ * reduce duplication across operations on the same endpoint.
13
+ *
14
+ * ## Key Features
15
+ *
16
+ * - **Operation Container**: Groups HTTP methods for a single path
17
+ * - **Shared Parameters**: Path-level parameters for all operations
18
+ * - **Documentation**: Summary and description for the path
19
+ * - **Extension Support**: Custom fields for additional metadata
20
+ * - **Parameter Inheritance**: Parameters shared across all operations
21
+ *
22
+ * @example Basic path item with shared parameters
23
+ * ```typescript
24
+ * import { OasPathItem, OasParameter, OasString } from '@skmtc/core';
25
+ *
26
+ * const userPathItem = new OasPathItem({
27
+ * summary: 'User operations',
28
+ * description: 'Operations for managing individual users',
29
+ * parameters: [
30
+ * new OasParameter({
31
+ * name: 'userId',
32
+ * in: 'path',
33
+ * required: true,
34
+ * schema: new OasString({ format: 'uuid' }),
35
+ * description: 'Unique identifier for the user'
36
+ * })
37
+ * ]
38
+ * });
39
+ * ```
40
+ *
41
+ * @example Path with common headers
42
+ * ```typescript
43
+ * const apiPathItem = new OasPathItem({
44
+ * summary: 'API endpoint',
45
+ * description: 'Authenticated endpoint requiring API key',
46
+ * parameters: [
47
+ * new OasParameter({
48
+ * name: 'Authorization',
49
+ * in: 'header',
50
+ * required: true,
51
+ * schema: new OasString({ pattern: '^Bearer .+$' }),
52
+ * description: 'Bearer token for authentication'
53
+ * }),
54
+ * new OasParameter({
55
+ * name: 'Accept-Version',
56
+ * in: 'header',
57
+ * required: false,
58
+ * schema: new OasString({ enum: ['v1', 'v2'] }),
59
+ * description: 'API version preference'
60
+ * })
61
+ * ]
62
+ * });
63
+ * ```
64
+ *
65
+ * @example RESTful resource path
66
+ * ```typescript
67
+ * const resourcePathItem = new OasPathItem({
68
+ * summary: 'Product resource',
69
+ * description: 'CRUD operations for product management',
70
+ * parameters: [
71
+ * new OasParameter({
72
+ * name: 'productId',
73
+ * in: 'path',
74
+ * required: true,
75
+ * schema: new OasInteger({ minimum: 1 }),
76
+ * description: 'Product identifier'
77
+ * }),
78
+ * new OasParameter({
79
+ * name: 'include',
80
+ * in: 'query',
81
+ * required: false,
82
+ * schema: new OasString({ enum: ['details', 'reviews', 'images'] }),
83
+ * description: 'Additional data to include in response'
84
+ * })
85
+ * ]
86
+ * });
87
+ * ```
88
+ */
4
89
  class OasPathItem {
5
90
  constructor(fields = {}) {
6
91
  Object.defineProperty(this, "oasType", {
@@ -4,12 +4,276 @@ import type { OasRef } from '../ref/Ref.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 OasRequestBody}.
9
+ */
7
10
  export type RequestBodyFields = {
11
+ /** A description of the request body */
8
12
  description?: string | undefined;
13
+ /** Request content for different media types */
9
14
  content: Record<string, OasMediaType>;
15
+ /** Whether the request body is required */
10
16
  required?: boolean | undefined;
17
+ /** Custom extension fields (x-* properties) */
11
18
  extensionFields?: Record<string, unknown>;
12
19
  };
20
+ /**
21
+ * Represents a Request Body Object in the OpenAPI Specification.
22
+ *
23
+ * The `OasRequestBody` class encapsulates the definition of a request body that
24
+ * can be sent with HTTP operations. It supports multiple content types, schema
25
+ * validation, and can be marked as required or optional. Request bodies are
26
+ * commonly used with POST, PUT, PATCH, and sometimes DELETE operations.
27
+ *
28
+ * This class provides comprehensive support for request body definitions with
29
+ * typed content, multiple media type representations, and proper validation.
30
+ *
31
+ * ## Key Features
32
+ *
33
+ * - **Multiple Content Types**: Support for JSON, XML, form data, binary, and more
34
+ * - **Schema Validation**: Typed request bodies through schema definitions
35
+ * - **Required/Optional**: Control whether the request body is mandatory
36
+ * - **Reference Support**: Can reference reusable request body components
37
+ * - **Documentation**: Rich description support for API documentation
38
+ * - **Media Type Flexibility**: Different schemas for different content types
39
+ *
40
+ * @example Basic JSON request body
41
+ * ```typescript
42
+ * import { OasRequestBody, OasMediaType, OasObject, OasString } from '@skmtc/core';
43
+ *
44
+ * const createUserRequest = new OasRequestBody({
45
+ * description: 'User data for creating a new user account',
46
+ * required: true,
47
+ * content: {
48
+ * 'application/json': new OasMediaType({
49
+ * schema: new OasObject({
50
+ * properties: {
51
+ * name: new OasString({
52
+ * description: 'Full name',
53
+ * minLength: 1,
54
+ * maxLength: 100
55
+ * }),
56
+ * email: new OasString({
57
+ * format: 'email',
58
+ * description: 'Email address'
59
+ * }),
60
+ * password: new OasString({
61
+ * minLength: 8,
62
+ * description: 'Account password'
63
+ * })
64
+ * },
65
+ * required: ['name', 'email', 'password']
66
+ * })
67
+ * })
68
+ * }
69
+ * });
70
+ * ```
71
+ *
72
+ * @example Multiple content types
73
+ * ```typescript
74
+ * const multiFormatRequest = new OasRequestBody({
75
+ * description: 'Product data in multiple formats',
76
+ * required: true,
77
+ * content: {
78
+ * 'application/json': new OasMediaType({
79
+ * schema: new OasRef({ $ref: '#/components/schemas/Product' })
80
+ * }),
81
+ * 'application/xml': new OasMediaType({
82
+ * schema: new OasObject({
83
+ * properties: {
84
+ * product: new OasRef({ $ref: '#/components/schemas/Product' })
85
+ * }
86
+ * })
87
+ * }),
88
+ * 'application/x-www-form-urlencoded': new OasMediaType({
89
+ * schema: new OasObject({
90
+ * properties: {
91
+ * name: new OasString(),
92
+ * price: new OasNumber({ format: 'double' }),
93
+ * category_id: new OasInteger()
94
+ * }
95
+ * })
96
+ * })
97
+ * }
98
+ * });
99
+ * ```
100
+ *
101
+ * @example File upload request body
102
+ * ```typescript
103
+ * const fileUploadRequest = new OasRequestBody({
104
+ * description: 'File upload with metadata',
105
+ * required: true,
106
+ * content: {
107
+ * 'multipart/form-data': new OasMediaType({
108
+ * schema: new OasObject({
109
+ * properties: {
110
+ * file: new OasString({
111
+ * format: 'binary',
112
+ * description: 'The file to upload'
113
+ * }),
114
+ * filename: new OasString({
115
+ * description: 'Original filename'
116
+ * }),
117
+ * description: new OasString({
118
+ * description: 'File description',
119
+ * required: false
120
+ * }),
121
+ * tags: new OasArray({
122
+ * items: new OasString(),
123
+ * description: 'File tags'
124
+ * })
125
+ * },
126
+ * required: ['file', 'filename']
127
+ * })
128
+ * }),
129
+ * 'application/octet-stream': new OasMediaType({
130
+ * schema: new OasString({
131
+ * format: 'binary',
132
+ * description: 'Raw binary file content'
133
+ * })
134
+ * })
135
+ * }
136
+ * });
137
+ * ```
138
+ *
139
+ * @example Optional request body for updates
140
+ * ```typescript
141
+ * const updateUserRequest = new OasRequestBody({
142
+ * description: 'Partial user data for updates (all fields optional)',
143
+ * required: false, // Request body itself is optional
144
+ * content: {
145
+ * 'application/json': new OasMediaType({
146
+ * schema: new OasObject({
147
+ * properties: {
148
+ * name: new OasString({ description: 'Updated name' }),
149
+ * email: new OasString({
150
+ * format: 'email',
151
+ * description: 'Updated email'
152
+ * }),
153
+ * bio: new OasString({ description: 'User biography' }),
154
+ * preferences: new OasObject({
155
+ * properties: {
156
+ * notifications: new OasBoolean(),
157
+ * theme: new OasString({ enum: ['light', 'dark'] })
158
+ * }
159
+ * })
160
+ * }
161
+ * // No required fields - all updates are optional
162
+ * })
163
+ * })
164
+ * }
165
+ * });
166
+ * ```
167
+ *
168
+ * @example Complex nested data structures
169
+ * ```typescript
170
+ * const orderRequest = new OasRequestBody({
171
+ * description: 'Complete order with items and shipping',
172
+ * required: true,
173
+ * content: {
174
+ * 'application/json': new OasMediaType({
175
+ * schema: new OasObject({
176
+ * properties: {
177
+ * customer: new OasObject({
178
+ * properties: {
179
+ * id: new OasString(),
180
+ * email: new OasString({ format: 'email' })
181
+ * },
182
+ * required: ['id']
183
+ * }),
184
+ * items: new OasArray({
185
+ * items: new OasObject({
186
+ * properties: {
187
+ * productId: new OasString(),
188
+ * quantity: new OasInteger({ minimum: 1 }),
189
+ * customizations: new OasArray({
190
+ * items: new OasString()
191
+ * })
192
+ * },
193
+ * required: ['productId', 'quantity']
194
+ * }),
195
+ * minItems: 1
196
+ * }),
197
+ * shipping: new OasObject({
198
+ * properties: {
199
+ * address: new OasRef({ $ref: '#/components/schemas/Address' }),
200
+ * method: new OasString({ enum: ['standard', 'express', 'overnight'] }),
201
+ * instructions: new OasString()
202
+ * },
203
+ * required: ['address', 'method']
204
+ * }),
205
+ * couponCode: new OasString({ description: 'Optional discount code' })
206
+ * },
207
+ * required: ['customer', 'items', 'shipping']
208
+ * })
209
+ * })
210
+ * }
211
+ * });
212
+ * ```
213
+ *
214
+ * @example Form data with validation
215
+ * ```typescript
216
+ * const registrationForm = new OasRequestBody({
217
+ * description: 'User registration form data',
218
+ * required: true,
219
+ * content: {
220
+ * 'application/x-www-form-urlencoded': new OasMediaType({
221
+ * schema: new OasObject({
222
+ * properties: {
223
+ * username: new OasString({
224
+ * pattern: '^[a-zA-Z0-9_]{3,20}$',
225
+ * description: 'Alphanumeric username, 3-20 characters'
226
+ * }),
227
+ * email: new OasString({
228
+ * format: 'email',
229
+ * description: 'Valid email address'
230
+ * }),
231
+ * password: new OasString({
232
+ * minLength: 8,
233
+ * description: 'Password, minimum 8 characters'
234
+ * }),
235
+ * confirmPassword: new OasString({
236
+ * description: 'Password confirmation'
237
+ * }),
238
+ * agreeToTerms: new OasBoolean({
239
+ * enum: [true],
240
+ * description: 'Must accept terms of service'
241
+ * })
242
+ * },
243
+ * required: ['username', 'email', 'password', 'confirmPassword', 'agreeToTerms']
244
+ * })
245
+ * })
246
+ * }
247
+ * });
248
+ * ```
249
+ *
250
+ * @example Using in operation definitions
251
+ * ```typescript
252
+ * const createProductOperation = new OasOperation({
253
+ * path: '/products',
254
+ * method: 'post',
255
+ * requestBody: createUserRequest,
256
+ * responses: {
257
+ * '201': new OasResponse({
258
+ * description: 'Product created successfully',
259
+ * content: {
260
+ * 'application/json': new OasMediaType({
261
+ * schema: new OasRef({ $ref: '#/components/schemas/Product' })
262
+ * })
263
+ * }
264
+ * }),
265
+ * '400': new OasResponse({
266
+ * description: 'Invalid request data',
267
+ * content: {
268
+ * 'application/json': new OasMediaType({
269
+ * schema: new OasRef({ $ref: '#/components/schemas/ValidationError' })
270
+ * })
271
+ * }
272
+ * })
273
+ * }
274
+ * });
275
+ * ```
276
+ */
13
277
  export declare class OasRequestBody {
14
278
  oasType: 'requestBody';
15
279
  description: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/RequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,QAAQ,CAAC,EAAE,OA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