@skmtc/core 0.0.786 → 0.0.788

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 (71) hide show
  1. package/esm/context/GenerateContext.d.ts +95 -0
  2. package/esm/context/GenerateContext.d.ts.map +1 -1
  3. package/esm/context/GenerateContext.js +95 -0
  4. package/esm/dsl/ContentSettings.d.ts +164 -0
  5. package/esm/dsl/ContentSettings.d.ts.map +1 -1
  6. package/esm/dsl/ContentSettings.js +151 -0
  7. package/esm/dsl/Definition.d.ts +199 -0
  8. package/esm/dsl/Definition.d.ts.map +1 -1
  9. package/esm/dsl/Definition.js +189 -0
  10. package/esm/dsl/EntityType.d.ts +83 -0
  11. package/esm/dsl/EntityType.d.ts.map +1 -1
  12. package/esm/dsl/EntityType.js +83 -0
  13. package/esm/dsl/JsonFile.d.ts +162 -0
  14. package/esm/dsl/JsonFile.d.ts.map +1 -1
  15. package/esm/dsl/JsonFile.js +157 -0
  16. package/esm/oas/array/Array.d.ts +109 -1
  17. package/esm/oas/array/Array.d.ts.map +1 -1
  18. package/esm/oas/array/Array.js +93 -1
  19. package/esm/oas/integer/Integer.d.ts +98 -0
  20. package/esm/oas/integer/Integer.d.ts.map +1 -1
  21. package/esm/oas/integer/Integer.js +80 -0
  22. package/esm/oas/operation/Operation.d.ts +107 -1
  23. package/esm/oas/operation/Operation.d.ts.map +1 -1
  24. package/esm/oas/operation/Operation.js +107 -1
  25. package/esm/oas/ref/Ref.d.ts +86 -0
  26. package/esm/oas/ref/Ref.d.ts.map +1 -1
  27. package/esm/oas/ref/Ref.js +86 -0
  28. package/esm/oas/string/String.d.ts +103 -1
  29. package/esm/oas/string/String.d.ts.map +1 -1
  30. package/esm/oas/string/String.js +87 -1
  31. package/esm/types/Brand.d.ts +74 -0
  32. package/esm/types/Brand.d.ts.map +1 -1
  33. package/esm/types/Brand.js +9 -0
  34. package/esm/types/RefName.d.ts +61 -0
  35. package/esm/types/RefName.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/script/context/GenerateContext.d.ts +95 -0
  38. package/script/context/GenerateContext.d.ts.map +1 -1
  39. package/script/context/GenerateContext.js +95 -0
  40. package/script/dsl/ContentSettings.d.ts +164 -0
  41. package/script/dsl/ContentSettings.d.ts.map +1 -1
  42. package/script/dsl/ContentSettings.js +151 -0
  43. package/script/dsl/Definition.d.ts +199 -0
  44. package/script/dsl/Definition.d.ts.map +1 -1
  45. package/script/dsl/Definition.js +189 -0
  46. package/script/dsl/EntityType.d.ts +83 -0
  47. package/script/dsl/EntityType.d.ts.map +1 -1
  48. package/script/dsl/EntityType.js +83 -0
  49. package/script/dsl/JsonFile.d.ts +162 -0
  50. package/script/dsl/JsonFile.d.ts.map +1 -1
  51. package/script/dsl/JsonFile.js +157 -0
  52. package/script/oas/array/Array.d.ts +109 -1
  53. package/script/oas/array/Array.d.ts.map +1 -1
  54. package/script/oas/array/Array.js +93 -1
  55. package/script/oas/integer/Integer.d.ts +98 -0
  56. package/script/oas/integer/Integer.d.ts.map +1 -1
  57. package/script/oas/integer/Integer.js +80 -0
  58. package/script/oas/operation/Operation.d.ts +107 -1
  59. package/script/oas/operation/Operation.d.ts.map +1 -1
  60. package/script/oas/operation/Operation.js +107 -1
  61. package/script/oas/ref/Ref.d.ts +86 -0
  62. package/script/oas/ref/Ref.d.ts.map +1 -1
  63. package/script/oas/ref/Ref.js +86 -0
  64. package/script/oas/string/String.d.ts +103 -1
  65. package/script/oas/string/String.d.ts.map +1 -1
  66. package/script/oas/string/String.js +87 -1
  67. package/script/types/Brand.d.ts +74 -0
  68. package/script/types/Brand.d.ts.map +1 -1
  69. package/script/types/Brand.js +9 -0
  70. package/script/types/RefName.d.ts +61 -0
  71. package/script/types/RefName.d.ts.map +1 -1
@@ -30,7 +30,113 @@ type ToRequestBodyMapArgs = {
30
30
  schema: OasSchema | OasRef<'schema'>;
31
31
  requestBody: OasRequestBody;
32
32
  };
33
- /** Operation represents a resource path and a method that can be enacted against it */
33
+ /**
34
+ * Represents an OpenAPI Operation Object in the SKMTC OAS processing system.
35
+ *
36
+ * The `OasOperation` class encapsulates a single API operation (path + method combination)
37
+ * with all its associated metadata, parameters, request/response specifications, and
38
+ * security requirements. It provides utilities for extracting common operation data
39
+ * like success responses and request bodies.
40
+ *
41
+ * ## Key Features
42
+ *
43
+ * - **Path and Method**: Unique combination identifying the operation
44
+ * - **Metadata Access**: Operation ID, summary, description, tags, and deprecation status
45
+ * - **Parameter Handling**: Query, path, header, and cookie parameters
46
+ * - **Request/Response Specs**: Type-safe access to request body and response definitions
47
+ * - **Security Context**: Operation-specific security requirements
48
+ * - **Success Response Utils**: Helper methods to identify and extract successful responses
49
+ *
50
+ * @example Basic operation properties
51
+ * ```typescript
52
+ * import { OasOperation } from '@skmtc/core';
53
+ *
54
+ * // Typically created during document parsing
55
+ * const getUserOp = new OasOperation({
56
+ * path: '/users/{id}',
57
+ * method: 'get',
58
+ * operationId: 'getUserById',
59
+ * summary: 'Get user by ID',
60
+ * description: 'Retrieves a single user by their unique identifier',
61
+ * parameters: [
62
+ * // Path parameter for user ID
63
+ * { name: 'id', in: 'path', required: true, schema: { type: 'string' } }
64
+ * ],
65
+ * responses: {
66
+ * '200': { description: 'User found', content: { ... } },
67
+ * '404': { description: 'User not found' }
68
+ * }
69
+ * });
70
+ *
71
+ * console.log(getUserOp.path); // '/users/{id}'
72
+ * console.log(getUserOp.method); // 'get'
73
+ * console.log(getUserOp.operationId); // 'getUserById'
74
+ * ```
75
+ *
76
+ * @example Working with success responses
77
+ * ```typescript
78
+ * // Find the primary success response
79
+ * const successResponse = operation.toSuccessResponse();
80
+ * if (successResponse) {
81
+ * const resolved = successResponse.resolve();
82
+ * console.log('Success response:', resolved.description);
83
+ * }
84
+ *
85
+ * // Get the HTTP status code for success
86
+ * const successCode = operation.toSuccessResponseCode();
87
+ * console.log('Success status:', successCode); // '200', '201', 'default', etc.
88
+ * ```
89
+ *
90
+ * @example Extracting request body data
91
+ * ```typescript
92
+ * // Extract request body with custom transformation
93
+ * const requestData = operation.toRequestBody(({ schema, requestBody }) => {
94
+ * return {
95
+ * schema: schema,
96
+ * contentType: 'application/json',
97
+ * required: requestBody.required ?? false,
98
+ * description: requestBody.description
99
+ * };
100
+ * });
101
+ *
102
+ * if (requestData) {
103
+ * console.log('Request schema:', requestData.schema);
104
+ * console.log('Required:', requestData.required);
105
+ * }
106
+ * ```
107
+ *
108
+ * @example Parameter processing
109
+ * ```typescript
110
+ * // Process operation parameters by location
111
+ * const pathParams = operation.parameters?.filter(param => {
112
+ * const resolved = param.resolve();
113
+ * return resolved.in === 'path';
114
+ * });
115
+ *
116
+ * const queryParams = operation.parameters?.filter(param => {
117
+ * const resolved = param.resolve();
118
+ * return resolved.in === 'query';
119
+ * });
120
+ *
121
+ * console.log('Path parameters:', pathParams?.length);
122
+ * console.log('Query parameters:', queryParams?.length);
123
+ * ```
124
+ *
125
+ * @example Security requirements
126
+ * ```typescript
127
+ * if (operation.security) {
128
+ * console.log('Operation has specific security requirements');
129
+ * for (const requirement of operation.security) {
130
+ * // Process security schemes for this operation
131
+ * Object.keys(requirement.schemes).forEach(scheme => {
132
+ * console.log(`Security scheme: ${scheme}`);
133
+ * });
134
+ * }
135
+ * } else {
136
+ * console.log('Operation uses default document security');
137
+ * }
138
+ * ```
139
+ */
34
140
  export declare class OasOperation {
35
141
  oasType: 'operation';
36
142
  path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,E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CAAA;IAC9D,WAAW,EAAE,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,SAAS,CAAA;IAC/D,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IAC3D,QAAQ,EAAE,sBAAsB,EAAE,GAAG,SAAS,CAAA;IAC9C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBAExC,MAAM,EAAE,eAAe;IAgBnC,iBAAiB,IAAI,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,SAAS;IAMjE,qBAAqB,IAAI,MAAM,GAAG,SAAS;IAiB3C,aAAa,CAAC,CAAC,EACb,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,oBAAoB,KAAK,CAAC,EACzD,SAAS,SAAqB,GAC7B,CAAC,GAAG,SAAS;IAOhB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,YAAY,EAAE;IAQzD,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS;IAY9D,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;IAiBrE,MAAM,IAAI,MAAM;CAcjB"}
@@ -3,7 +3,113 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OasOperation = void 0;
4
4
  require("../../_dnt.polyfills.js");
5
5
  const Object_js_1 = require("../object/Object.js");
6
- /** Operation represents a resource path and a method that can be enacted against it */
6
+ /**
7
+ * Represents an OpenAPI Operation Object in the SKMTC OAS processing system.
8
+ *
9
+ * The `OasOperation` class encapsulates a single API operation (path + method combination)
10
+ * with all its associated metadata, parameters, request/response specifications, and
11
+ * security requirements. It provides utilities for extracting common operation data
12
+ * like success responses and request bodies.
13
+ *
14
+ * ## Key Features
15
+ *
16
+ * - **Path and Method**: Unique combination identifying the operation
17
+ * - **Metadata Access**: Operation ID, summary, description, tags, and deprecation status
18
+ * - **Parameter Handling**: Query, path, header, and cookie parameters
19
+ * - **Request/Response Specs**: Type-safe access to request body and response definitions
20
+ * - **Security Context**: Operation-specific security requirements
21
+ * - **Success Response Utils**: Helper methods to identify and extract successful responses
22
+ *
23
+ * @example Basic operation properties
24
+ * ```typescript
25
+ * import { OasOperation } from '@skmtc/core';
26
+ *
27
+ * // Typically created during document parsing
28
+ * const getUserOp = new OasOperation({
29
+ * path: '/users/{id}',
30
+ * method: 'get',
31
+ * operationId: 'getUserById',
32
+ * summary: 'Get user by ID',
33
+ * description: 'Retrieves a single user by their unique identifier',
34
+ * parameters: [
35
+ * // Path parameter for user ID
36
+ * { name: 'id', in: 'path', required: true, schema: { type: 'string' } }
37
+ * ],
38
+ * responses: {
39
+ * '200': { description: 'User found', content: { ... } },
40
+ * '404': { description: 'User not found' }
41
+ * }
42
+ * });
43
+ *
44
+ * console.log(getUserOp.path); // '/users/{id}'
45
+ * console.log(getUserOp.method); // 'get'
46
+ * console.log(getUserOp.operationId); // 'getUserById'
47
+ * ```
48
+ *
49
+ * @example Working with success responses
50
+ * ```typescript
51
+ * // Find the primary success response
52
+ * const successResponse = operation.toSuccessResponse();
53
+ * if (successResponse) {
54
+ * const resolved = successResponse.resolve();
55
+ * console.log('Success response:', resolved.description);
56
+ * }
57
+ *
58
+ * // Get the HTTP status code for success
59
+ * const successCode = operation.toSuccessResponseCode();
60
+ * console.log('Success status:', successCode); // '200', '201', 'default', etc.
61
+ * ```
62
+ *
63
+ * @example Extracting request body data
64
+ * ```typescript
65
+ * // Extract request body with custom transformation
66
+ * const requestData = operation.toRequestBody(({ schema, requestBody }) => {
67
+ * return {
68
+ * schema: schema,
69
+ * contentType: 'application/json',
70
+ * required: requestBody.required ?? false,
71
+ * description: requestBody.description
72
+ * };
73
+ * });
74
+ *
75
+ * if (requestData) {
76
+ * console.log('Request schema:', requestData.schema);
77
+ * console.log('Required:', requestData.required);
78
+ * }
79
+ * ```
80
+ *
81
+ * @example Parameter processing
82
+ * ```typescript
83
+ * // Process operation parameters by location
84
+ * const pathParams = operation.parameters?.filter(param => {
85
+ * const resolved = param.resolve();
86
+ * return resolved.in === 'path';
87
+ * });
88
+ *
89
+ * const queryParams = operation.parameters?.filter(param => {
90
+ * const resolved = param.resolve();
91
+ * return resolved.in === 'query';
92
+ * });
93
+ *
94
+ * console.log('Path parameters:', pathParams?.length);
95
+ * console.log('Query parameters:', queryParams?.length);
96
+ * ```
97
+ *
98
+ * @example Security requirements
99
+ * ```typescript
100
+ * if (operation.security) {
101
+ * console.log('Operation has specific security requirements');
102
+ * for (const requirement of operation.security) {
103
+ * // Process security schemes for this operation
104
+ * Object.keys(requirement.schemes).forEach(scheme => {
105
+ * console.log(`Security scheme: ${scheme}`);
106
+ * });
107
+ * }
108
+ * } else {
109
+ * console.log('Operation uses default document security');
110
+ * }
111
+ * ```
112
+ */
7
113
  class OasOperation {
8
114
  constructor(fields) {
9
115
  Object.defineProperty(this, "oasType", {
@@ -14,6 +14,92 @@ export type RefFields<T extends OasRefData['refType']> = {
14
14
  refType: T;
15
15
  $ref: string;
16
16
  };
17
+ /**
18
+ * Represents an OpenAPI reference ($ref) in the SKMTC OAS processing system.
19
+ *
20
+ * The `OasRef` class handles OpenAPI JSON Reference Objects that point to reusable
21
+ * components within the same document. It provides type-safe reference resolution
22
+ * with support for chained references and circular reference detection.
23
+ *
24
+ * ## Key Features
25
+ *
26
+ * - **Type Safety**: Generic parameter ensures resolved types match the reference type
27
+ * - **Lazy Resolution**: References are resolved on-demand, not during construction
28
+ * - **Chain Resolution**: Handles references that point to other references
29
+ * - **Circular Detection**: Prevents infinite loops with maximum lookup limits
30
+ * - **Type Validation**: Ensures resolved objects match expected reference types
31
+ *
32
+ * @template T - The type of component this reference points to
33
+ *
34
+ * @example Basic reference resolution
35
+ * ```typescript
36
+ * import { OasRef } from '@skmtc/core';
37
+ *
38
+ * // Reference to a schema component
39
+ * const userRef = new OasRef<'schema'>({
40
+ * refType: 'schema',
41
+ * $ref: '#/components/schemas/User'
42
+ * }, document);
43
+ *
44
+ * // Resolve the reference
45
+ * const userSchema = userRef.resolve();
46
+ * console.log(userSchema.properties); // Access resolved schema properties
47
+ * ```
48
+ *
49
+ * @example Working with different reference types
50
+ * ```typescript
51
+ * // Schema reference
52
+ * const schemaRef = new OasRef<'schema'>({
53
+ * refType: 'schema',
54
+ * $ref: '#/components/schemas/Product'
55
+ * }, document);
56
+ *
57
+ * // Response reference
58
+ * const responseRef = new OasRef<'response'>({
59
+ * refType: 'response',
60
+ * $ref: '#/components/responses/ErrorResponse'
61
+ * }, document);
62
+ *
63
+ * // Parameter reference
64
+ * const paramRef = new OasRef<'parameter'>({
65
+ * refType: 'parameter',
66
+ * $ref: '#/components/parameters/PageSize'
67
+ * }, document);
68
+ * ```
69
+ *
70
+ * @example Reference checking and conditional resolution
71
+ * ```typescript
72
+ * function processSchemaOrRef(schema: OasSchema | OasRef<'schema'>) {
73
+ * if (schema.isRef()) {
74
+ * // Handle reference
75
+ * const refName = schema.toRefName();
76
+ * console.log(`Processing reference: ${refName}`);
77
+ *
78
+ * // Resolve only when needed
79
+ * const resolved = schema.resolve();
80
+ * return processed(resolved);
81
+ * } else {
82
+ * // Handle direct schema
83
+ * return process(schema);
84
+ * }
85
+ * }
86
+ * ```
87
+ *
88
+ * @example Chained reference handling
89
+ * ```typescript
90
+ * // References can point to other references
91
+ * const chainedRef = new OasRef<'schema'>({
92
+ * refType: 'schema',
93
+ * $ref: '#/components/schemas/AliasToUser'
94
+ * }, document);
95
+ *
96
+ * // resolve() automatically follows the chain
97
+ * const finalSchema = chainedRef.resolve(); // Follows chain to final schema
98
+ *
99
+ * // resolveOnce() resolves only one step
100
+ * const oneStep = chainedRef.resolveOnce(); // May still be a reference
101
+ * ```
102
+ */
17
103
  export declare class OasRef<T extends OasRefData['refType']> {
18
104
  #private;
19
105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AmB,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,UAAU,CACpE,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAC/B,CAAA;AAED,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,WAAW,GACX,YAAY,GACZ,UAAU,GACV,cAAc,GACd,SAAS,GACT,iBAAiB,CAAA;AAErB,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,gBAAgB,EAAE;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA"}
@@ -17,6 +17,92 @@ require("../../_dnt.polyfills.js");
17
17
  const refFns_js_1 = require("../../helpers/refFns.js");
18
18
  const ts_pattern_1 = require("ts-pattern");
19
19
  const MAX_LOOKUPS = 10;
20
+ /**
21
+ * Represents an OpenAPI reference ($ref) in the SKMTC OAS processing system.
22
+ *
23
+ * The `OasRef` class handles OpenAPI JSON Reference Objects that point to reusable
24
+ * components within the same document. It provides type-safe reference resolution
25
+ * with support for chained references and circular reference detection.
26
+ *
27
+ * ## Key Features
28
+ *
29
+ * - **Type Safety**: Generic parameter ensures resolved types match the reference type
30
+ * - **Lazy Resolution**: References are resolved on-demand, not during construction
31
+ * - **Chain Resolution**: Handles references that point to other references
32
+ * - **Circular Detection**: Prevents infinite loops with maximum lookup limits
33
+ * - **Type Validation**: Ensures resolved objects match expected reference types
34
+ *
35
+ * @template T - The type of component this reference points to
36
+ *
37
+ * @example Basic reference resolution
38
+ * ```typescript
39
+ * import { OasRef } from '@skmtc/core';
40
+ *
41
+ * // Reference to a schema component
42
+ * const userRef = new OasRef<'schema'>({
43
+ * refType: 'schema',
44
+ * $ref: '#/components/schemas/User'
45
+ * }, document);
46
+ *
47
+ * // Resolve the reference
48
+ * const userSchema = userRef.resolve();
49
+ * console.log(userSchema.properties); // Access resolved schema properties
50
+ * ```
51
+ *
52
+ * @example Working with different reference types
53
+ * ```typescript
54
+ * // Schema reference
55
+ * const schemaRef = new OasRef<'schema'>({
56
+ * refType: 'schema',
57
+ * $ref: '#/components/schemas/Product'
58
+ * }, document);
59
+ *
60
+ * // Response reference
61
+ * const responseRef = new OasRef<'response'>({
62
+ * refType: 'response',
63
+ * $ref: '#/components/responses/ErrorResponse'
64
+ * }, document);
65
+ *
66
+ * // Parameter reference
67
+ * const paramRef = new OasRef<'parameter'>({
68
+ * refType: 'parameter',
69
+ * $ref: '#/components/parameters/PageSize'
70
+ * }, document);
71
+ * ```
72
+ *
73
+ * @example Reference checking and conditional resolution
74
+ * ```typescript
75
+ * function processSchemaOrRef(schema: OasSchema | OasRef<'schema'>) {
76
+ * if (schema.isRef()) {
77
+ * // Handle reference
78
+ * const refName = schema.toRefName();
79
+ * console.log(`Processing reference: ${refName}`);
80
+ *
81
+ * // Resolve only when needed
82
+ * const resolved = schema.resolve();
83
+ * return processed(resolved);
84
+ * } else {
85
+ * // Handle direct schema
86
+ * return process(schema);
87
+ * }
88
+ * }
89
+ * ```
90
+ *
91
+ * @example Chained reference handling
92
+ * ```typescript
93
+ * // References can point to other references
94
+ * const chainedRef = new OasRef<'schema'>({
95
+ * refType: 'schema',
96
+ * $ref: '#/components/schemas/AliasToUser'
97
+ * }, document);
98
+ *
99
+ * // resolve() automatically follows the chain
100
+ * const finalSchema = chainedRef.resolve(); // Follows chain to final schema
101
+ *
102
+ * // resolveOnce() resolves only one step
103
+ * const oneStep = chainedRef.resolveOnce(); // May still be a reference
104
+ * ```
105
+ */
20
106
  class OasRef {
21
107
  constructor(fields, oasDocument) {
22
108
  Object.defineProperty(this, "oasType", {
@@ -2,21 +2,108 @@ import "../../_dnt.polyfills.js";
2
2
  import type { OasRef } from '../ref/Ref.js';
3
3
  import type { ToJsonSchemaOptions } from '../schema/Schema.js';
4
4
  import type { OpenAPIV3 } from 'openapi-types';
5
+ /**
6
+ * Constructor fields for {@link OasString}.
7
+ *
8
+ * @template Nullable - Whether the string value can be null
9
+ */
5
10
  export type StringFields<Nullable extends boolean | undefined> = {
11
+ /** A short summary of the string schema */
6
12
  title?: string;
13
+ /** A description of the string schema */
7
14
  description?: string;
15
+ /** String format (e.g., 'email', 'date-time', 'uri') */
8
16
  format?: string;
17
+ /** Default value for the string */
9
18
  default?: Nullable extends true ? string | null | undefined : string | undefined;
19
+ /** Regular expression pattern for validation */
10
20
  pattern?: string;
21
+ /** Array of allowed enum values */
11
22
  enums?: Nullable extends true ? (string | null)[] | undefined : string[] | undefined;
23
+ /** Maximum length constraint */
12
24
  maxLength?: number;
25
+ /** Minimum length constraint */
13
26
  minLength?: number;
27
+ /** Whether the string value can be null */
14
28
  nullable?: Nullable;
29
+ /** Custom extension fields (x-* properties) */
15
30
  extensionFields?: Record<string, unknown>;
31
+ /** Example value for the string */
16
32
  example?: Nullable extends true ? string | null | undefined : string | undefined;
17
33
  };
18
34
  /**
19
- * Object representing a string in the OpenAPI Specification.
35
+ * Represents a string schema in the OpenAPI Specification.
36
+ *
37
+ * `OasString` handles string type definitions with comprehensive validation
38
+ * constraints including format validation, length limits, pattern matching,
39
+ * and enum restrictions. It supports nullable types and provides JSON Schema
40
+ * conversion for validation purposes.
41
+ *
42
+ * This class is used throughout the OAS processing pipeline to represent
43
+ * string fields in API schemas, parameters, and request/response bodies.
44
+ *
45
+ * ## Key Features
46
+ *
47
+ * - **Format Validation**: Support for standard formats (email, date-time, uri, etc.)
48
+ * - **Length Constraints**: Minimum and maximum length validation
49
+ * - **Pattern Matching**: Regular expression validation
50
+ * - **Enum Values**: Restricted sets of allowed values
51
+ * - **Nullable Support**: Type-safe nullable string handling
52
+ * - **JSON Schema**: Conversion to standard JSON Schema format
53
+ *
54
+ * @template Nullable - Whether the string value can be null
55
+ *
56
+ * @example Basic string schema
57
+ * ```typescript
58
+ * import { OasString } from '@skmtc/core';
59
+ *
60
+ * const basicString = new OasString({
61
+ * title: 'User Name',
62
+ * description: 'The full name of the user',
63
+ * minLength: 1,
64
+ * maxLength: 100
65
+ * });
66
+ * ```
67
+ *
68
+ * @example Email format validation
69
+ * ```typescript
70
+ * const emailString = new OasString({
71
+ * title: 'Email Address',
72
+ * description: 'Valid email address',
73
+ * format: 'email',
74
+ * example: 'user@example.com'
75
+ * });
76
+ * ```
77
+ *
78
+ * @example Enum with allowed values
79
+ * ```typescript
80
+ * const statusString = new OasString({
81
+ * title: 'Status',
82
+ * description: 'Current status of the item',
83
+ * enums: ['pending', 'approved', 'rejected'],
84
+ * default: 'pending'
85
+ * });
86
+ * ```
87
+ *
88
+ * @example Pattern validation
89
+ * ```typescript
90
+ * const phoneString = new OasString({
91
+ * title: 'Phone Number',
92
+ * description: 'US phone number format',
93
+ * pattern: '^\\+?1?[2-9]\\d{2}[2-9]\\d{2}\\d{4}$',
94
+ * example: '+15551234567'
95
+ * });
96
+ * ```
97
+ *
98
+ * @example Nullable string
99
+ * ```typescript
100
+ * const nullableString = new OasString<true>({
101
+ * title: 'Optional Note',
102
+ * description: 'Optional note that can be null',
103
+ * nullable: true,
104
+ * default: null
105
+ * });
106
+ * ```
20
107
  */
21
108
  export declare class OasString<Nullable extends boolean | undefined = boolean | undefined> {
22
109
  /**
@@ -68,6 +155,21 @@ export declare class OasString<Nullable extends boolean | undefined = boolean |
68
155
  * The default value of the string.
69
156
  */
70
157
  default: Nullable extends true ? string | null | undefined : string | undefined;
158
+ /**
159
+ * Creates a new OasString instance.
160
+ *
161
+ * @param fields - String schema configuration fields
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * const userIdString = new OasString({
166
+ * title: 'User ID',
167
+ * description: 'Unique identifier for user',
168
+ * format: 'uuid',
169
+ * example: '123e4567-e89b-12d3-a456-426614174000'
170
+ * });
171
+ * ```
172
+ */
71
173
  constructor(fields?: StringFields<Nullable>);
72
174
  isRef(): this is OasRef<'schema'>;
73
175
  resolve(): OasString<Nullable>;
@@ -1 +1 @@
1
- {"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,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../_dnt.polyfills.js");
5
5
  /**
6
- * Object representing a string in the OpenAPI Specification.
6
+ * Represents a string schema in the OpenAPI Specification.
7
+ *
8
+ * `OasString` handles string type definitions with comprehensive validation
9
+ * constraints including format validation, length limits, pattern matching,
10
+ * and enum restrictions. It supports nullable types and provides JSON Schema
11
+ * conversion for validation purposes.
12
+ *
13
+ * This class is used throughout the OAS processing pipeline to represent
14
+ * string fields in API schemas, parameters, and request/response bodies.
15
+ *
16
+ * ## Key Features
17
+ *
18
+ * - **Format Validation**: Support for standard formats (email, date-time, uri, etc.)
19
+ * - **Length Constraints**: Minimum and maximum length validation
20
+ * - **Pattern Matching**: Regular expression validation
21
+ * - **Enum Values**: Restricted sets of allowed values
22
+ * - **Nullable Support**: Type-safe nullable string handling
23
+ * - **JSON Schema**: Conversion to standard JSON Schema format
24
+ *
25
+ * @template Nullable - Whether the string value can be null
26
+ *
27
+ * @example Basic string schema
28
+ * ```typescript
29
+ * import { OasString } from '@skmtc/core';
30
+ *
31
+ * const basicString = new OasString({
32
+ * title: 'User Name',
33
+ * description: 'The full name of the user',
34
+ * minLength: 1,
35
+ * maxLength: 100
36
+ * });
37
+ * ```
38
+ *
39
+ * @example Email format validation
40
+ * ```typescript
41
+ * const emailString = new OasString({
42
+ * title: 'Email Address',
43
+ * description: 'Valid email address',
44
+ * format: 'email',
45
+ * example: 'user@example.com'
46
+ * });
47
+ * ```
48
+ *
49
+ * @example Enum with allowed values
50
+ * ```typescript
51
+ * const statusString = new OasString({
52
+ * title: 'Status',
53
+ * description: 'Current status of the item',
54
+ * enums: ['pending', 'approved', 'rejected'],
55
+ * default: 'pending'
56
+ * });
57
+ * ```
58
+ *
59
+ * @example Pattern validation
60
+ * ```typescript
61
+ * const phoneString = new OasString({
62
+ * title: 'Phone Number',
63
+ * description: 'US phone number format',
64
+ * pattern: '^\\+?1?[2-9]\\d{2}[2-9]\\d{2}\\d{4}$',
65
+ * example: '+15551234567'
66
+ * });
67
+ * ```
68
+ *
69
+ * @example Nullable string
70
+ * ```typescript
71
+ * const nullableString = new OasString<true>({
72
+ * title: 'Optional Note',
73
+ * description: 'Optional note that can be null',
74
+ * nullable: true,
75
+ * default: null
76
+ * });
77
+ * ```
7
78
  */
8
79
  class OasString {
80
+ /**
81
+ * Creates a new OasString instance.
82
+ *
83
+ * @param fields - String schema configuration fields
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const userIdString = new OasString({
88
+ * title: 'User ID',
89
+ * description: 'Unique identifier for user',
90
+ * format: 'uuid',
91
+ * example: '123e4567-e89b-12d3-a456-426614174000'
92
+ * });
93
+ * ```
94
+ */
9
95
  constructor(fields = {}) {
10
96
  /**
11
97
  * Object is part the 'schema' set which is used