klasik 1.0.25 → 1.0.26

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 (138) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/README.md +194 -0
  3. package/dist/cli.js +49 -0
  4. package/dist/index.d.ts +4 -0
  5. package/dist/index.js +8 -1
  6. package/dist/jsonschema/jsonschema-generator.d.ts +101 -0
  7. package/dist/jsonschema/jsonschema-generator.js +290 -0
  8. package/dist/jsonschema/jsonschema-parser.d.ts +44 -0
  9. package/dist/jsonschema/jsonschema-parser.js +239 -0
  10. package/dist/jsonschema/jsonschema-to-openapi.d.ts +67 -0
  11. package/dist/jsonschema/jsonschema-to-openapi.js +284 -0
  12. package/dist/jsonschema/types.d.ts +118 -0
  13. package/dist/jsonschema/types.js +5 -0
  14. package/dist/k8s-client-generator.js +7 -0
  15. package/dist/nestjs-type-fixer.d.ts +42 -0
  16. package/dist/nestjs-type-fixer.js +158 -0
  17. package/openapitools.json +0 -0
  18. package/package.json +1 -1
  19. package/test-jsonschema-decorators/index.ts +27 -0
  20. package/test-jsonschema-decorators/models/config-map-args.ts +211 -0
  21. package/test-jsonschema-decorators/models/field-selector.ts +47 -0
  22. package/test-jsonschema-decorators/models/field-spec.ts +116 -0
  23. package/test-jsonschema-decorators/models/generator-options.ts +101 -0
  24. package/test-jsonschema-decorators/models/helm-chart.ts +241 -0
  25. package/test-jsonschema-decorators/models/image.ts +116 -0
  26. package/test-jsonschema-decorators/models/inventory.ts +70 -0
  27. package/test-jsonschema-decorators/models/kustomization-helm-globals.ts +65 -0
  28. package/test-jsonschema-decorators/models/kustomization-legacy-sort-options.ts +62 -0
  29. package/test-jsonschema-decorators/models/kustomization-sort-options-one-of.ts +75 -0
  30. package/test-jsonschema-decorators/models/kustomization-sort-options-one-of1.ts +52 -0
  31. package/test-jsonschema-decorators/models/kustomization-sort-options.ts +33 -0
  32. package/test-jsonschema-decorators/models/kustomization.ts +693 -0
  33. package/test-jsonschema-decorators/models/kvsource.ts +80 -0
  34. package/test-jsonschema-decorators/models/labels.ts +103 -0
  35. package/test-jsonschema-decorators/models/metadata.ts +98 -0
  36. package/test-jsonschema-decorators/models/name-args.ts +62 -0
  37. package/test-jsonschema-decorators/models/patch-json6902-one-of.ts +67 -0
  38. package/test-jsonschema-decorators/models/patch-json6902-one-of1.ts +67 -0
  39. package/test-jsonschema-decorators/models/patch-json6902-one-of2-value.ts +23 -0
  40. package/test-jsonschema-decorators/models/patch-json6902-one-of2.ts +116 -0
  41. package/test-jsonschema-decorators/models/patch-json6902.ts +38 -0
  42. package/test-jsonschema-decorators/models/patch-target.ts +116 -0
  43. package/test-jsonschema-decorators/models/patches-inline-patch.ts +90 -0
  44. package/test-jsonschema-decorators/models/patches-options.ts +62 -0
  45. package/test-jsonschema-decorators/models/patches-patch-path.ts +90 -0
  46. package/test-jsonschema-decorators/models/replacements-inline-one-of.ts +72 -0
  47. package/test-jsonschema-decorators/models/replacements-inline-one-of1.ts +67 -0
  48. package/test-jsonschema-decorators/models/replacements-inline.ts +35 -0
  49. package/test-jsonschema-decorators/models/replacements-path.ts +44 -0
  50. package/test-jsonschema-decorators/models/replacements-source-options.ts +80 -0
  51. package/test-jsonschema-decorators/models/replacements-source.ts +160 -0
  52. package/test-jsonschema-decorators/models/replacements-target-options.ts +80 -0
  53. package/test-jsonschema-decorators/models/replacements-target.ts +110 -0
  54. package/test-jsonschema-decorators/models/replicas.ts +62 -0
  55. package/test-jsonschema-decorators/models/secret-args.ts +229 -0
  56. package/test-jsonschema-decorators/models/selector.ts +155 -0
  57. package/test-jsonschema-decorators/models/target.ts +134 -0
  58. package/test-jsonschema-decorators/models/var.ts +93 -0
  59. package/test-jsonschema-output/index.ts +27 -0
  60. package/test-jsonschema-output/models/config-map-args.ts +163 -0
  61. package/test-jsonschema-output/models/field-selector.ts +40 -0
  62. package/test-jsonschema-output/models/field-spec.ts +89 -0
  63. package/test-jsonschema-output/models/generator-options.ts +79 -0
  64. package/test-jsonschema-output/models/helm-chart.ts +163 -0
  65. package/test-jsonschema-output/models/image.ts +89 -0
  66. package/test-jsonschema-output/models/inventory.ts +58 -0
  67. package/test-jsonschema-output/models/kustomization-helm-globals.ts +53 -0
  68. package/test-jsonschema-output/models/kustomization-legacy-sort-options.ts +50 -0
  69. package/test-jsonschema-output/models/kustomization-sort-options-one-of.ts +62 -0
  70. package/test-jsonschema-output/models/kustomization-sort-options-one-of1.ts +44 -0
  71. package/test-jsonschema-output/models/kustomization-sort-options.ts +33 -0
  72. package/test-jsonschema-output/models/kustomization.ts +526 -0
  73. package/test-jsonschema-output/models/kvsource.ts +63 -0
  74. package/test-jsonschema-output/models/labels.ts +81 -0
  75. package/test-jsonschema-output/models/metadata.ts +76 -0
  76. package/test-jsonschema-output/models/name-args.ts +50 -0
  77. package/test-jsonschema-output/models/patch-json6902-one-of.ts +55 -0
  78. package/test-jsonschema-output/models/patch-json6902-one-of1.ts +55 -0
  79. package/test-jsonschema-output/models/patch-json6902-one-of2-value.ts +23 -0
  80. package/test-jsonschema-output/models/patch-json6902-one-of2.ts +93 -0
  81. package/test-jsonschema-output/models/patch-json6902.ts +38 -0
  82. package/test-jsonschema-output/models/patch-target.ts +89 -0
  83. package/test-jsonschema-output/models/patches-inline-patch.ts +73 -0
  84. package/test-jsonschema-output/models/patches-options.ts +50 -0
  85. package/test-jsonschema-output/models/patches-patch-path.ts +73 -0
  86. package/test-jsonschema-output/models/replacements-inline-one-of.ts +60 -0
  87. package/test-jsonschema-output/models/replacements-inline-one-of1.ts +55 -0
  88. package/test-jsonschema-output/models/replacements-inline.ts +35 -0
  89. package/test-jsonschema-output/models/replacements-path.ts +37 -0
  90. package/test-jsonschema-output/models/replacements-source-options.ts +63 -0
  91. package/test-jsonschema-output/models/replacements-source.ts +123 -0
  92. package/test-jsonschema-output/models/replacements-target-options.ts +63 -0
  93. package/test-jsonschema-output/models/replacements-target.ts +88 -0
  94. package/test-jsonschema-output/models/replicas.ts +50 -0
  95. package/test-jsonschema-output/models/secret-args.ts +176 -0
  96. package/test-jsonschema-output/models/selector.ts +118 -0
  97. package/test-jsonschema-output/models/target.ts +102 -0
  98. package/test-jsonschema-output/models/var.ts +76 -0
  99. package/test-multi-schemas/index.ts +27 -0
  100. package/test-multi-schemas/models/config-map-args.ts +163 -0
  101. package/test-multi-schemas/models/field-selector.ts +40 -0
  102. package/test-multi-schemas/models/field-spec.ts +89 -0
  103. package/test-multi-schemas/models/generator-options.ts +79 -0
  104. package/test-multi-schemas/models/helm-chart.ts +163 -0
  105. package/test-multi-schemas/models/image.ts +89 -0
  106. package/test-multi-schemas/models/inventory.ts +58 -0
  107. package/test-multi-schemas/models/kustomization-helm-globals.ts +53 -0
  108. package/test-multi-schemas/models/kustomization-legacy-sort-options.ts +50 -0
  109. package/test-multi-schemas/models/kustomization-sort-options-one-of.ts +62 -0
  110. package/test-multi-schemas/models/kustomization-sort-options-one-of1.ts +44 -0
  111. package/test-multi-schemas/models/kustomization-sort-options.ts +33 -0
  112. package/test-multi-schemas/models/kustomization.ts +526 -0
  113. package/test-multi-schemas/models/kvsource.ts +63 -0
  114. package/test-multi-schemas/models/labels.ts +81 -0
  115. package/test-multi-schemas/models/metadata.ts +76 -0
  116. package/test-multi-schemas/models/name-args.ts +50 -0
  117. package/test-multi-schemas/models/patch-json6902-one-of.ts +55 -0
  118. package/test-multi-schemas/models/patch-json6902-one-of1.ts +55 -0
  119. package/test-multi-schemas/models/patch-json6902-one-of2-value.ts +23 -0
  120. package/test-multi-schemas/models/patch-json6902-one-of2.ts +93 -0
  121. package/test-multi-schemas/models/patch-json6902.ts +38 -0
  122. package/test-multi-schemas/models/patch-target.ts +89 -0
  123. package/test-multi-schemas/models/patches-inline-patch.ts +73 -0
  124. package/test-multi-schemas/models/patches-options.ts +50 -0
  125. package/test-multi-schemas/models/patches-patch-path.ts +73 -0
  126. package/test-multi-schemas/models/replacements-inline-one-of.ts +60 -0
  127. package/test-multi-schemas/models/replacements-inline-one-of1.ts +55 -0
  128. package/test-multi-schemas/models/replacements-inline.ts +35 -0
  129. package/test-multi-schemas/models/replacements-path.ts +37 -0
  130. package/test-multi-schemas/models/replacements-source-options.ts +63 -0
  131. package/test-multi-schemas/models/replacements-source.ts +123 -0
  132. package/test-multi-schemas/models/replacements-target-options.ts +63 -0
  133. package/test-multi-schemas/models/replacements-target.ts +88 -0
  134. package/test-multi-schemas/models/replicas.ts +50 -0
  135. package/test-multi-schemas/models/secret-args.ts +176 -0
  136. package/test-multi-schemas/models/selector.ts +118 -0
  137. package/test-multi-schemas/models/target.ts +102 -0
  138. package/test-multi-schemas/models/var.ts +76 -0
@@ -16,7 +16,8 @@
16
16
  "Bash(node dist/cli.js generate-crd:*)",
17
17
  "Bash(node test-programmatic-api.js:*)",
18
18
  "WebFetch(domain:www.schemastore.org)",
19
- "WebFetch(domain:json.schemastore.org)"
19
+ "WebFetch(domain:json.schemastore.org)",
20
+ "Bash(node dist/cli.js:*)"
20
21
  ]
21
22
  }
22
23
  }
package/README.md CHANGED
@@ -6,6 +6,7 @@ Download OpenAPI specifications from remote URLs and generate TypeScript clients
6
6
 
7
7
  - 📥 **Download OpenAPI specs** from remote URLs or local files
8
8
  - ☸️ **Kubernetes CRD support** - Generate TypeScript models from CustomResourceDefinitions
9
+ - 📋 **JSON Schema support** - Generate models from JSON Schema files (SchemaStore.org and more)
9
10
  - 📁 **Multiple input formats** - HTTP/HTTPS URLs, file:// URLs, absolute/relative paths
10
11
  - 📄 **JSON and YAML support** - Automatically parse and handle both formats (YAML specs are converted to JSON for code generation)
11
12
  - 🔐 **Authentication support** - Custom headers including Bearer tokens and API keys
@@ -244,6 +245,129 @@ output/
244
245
  └── index.ts
245
246
  ```
246
247
 
248
+ ## JSON Schema Support
249
+
250
+ Klasik can generate TypeScript models from JSON Schema files (like those from [SchemaStore.org](https://schemastore.org)). This is perfect for working with configuration files, data formats, and schema definitions.
251
+
252
+ ### Quick Start with JSON Schema
253
+
254
+ Generate TypeScript models from a JSON Schema:
255
+
256
+ ```bash
257
+ # From SchemaStore (kustomization.json schema)
258
+ npx klasik generate-jsonschema \
259
+ -u https://json.schemastore.org/kustomization.json \
260
+ -o ./generated/kustomization
261
+
262
+ # From multiple schemas (merged into single output)
263
+ npx klasik generate-jsonschema \
264
+ -u https://json.schemastore.org/kustomization.json \
265
+ -u https://json.schemastore.org/package.json \
266
+ -o ./generated/models
267
+
268
+ # From a local file
269
+ npx klasik generate-jsonschema \
270
+ -u ./my-schema.json \
271
+ -o ./generated
272
+
273
+ # With NestJS and validation decorators
274
+ npx klasik generate-jsonschema \
275
+ -u ./schema.json \
276
+ -o ./src/generated \
277
+ --nestjs-swagger \
278
+ --class-validator
279
+ ```
280
+
281
+ ### JSON Schema Features
282
+
283
+ - ✅ **All definitions generated** - Creates models for every definition in the schema
284
+ - ✅ **Multiple URL support** - Merge models from multiple JSON Schema files
285
+ - ✅ **Nested type extraction** - Complex nested objects become separate TypeScript interfaces
286
+ - ✅ **Full decorator support** - Works with `--nestjs-swagger`, `--class-validator`, `--esm`
287
+ - ✅ **Standards compliant** - Supports JSON Schema Draft 4 and Draft 7
288
+ - ✅ **patternProperties handling** - Automatically converts to OpenAPI-compatible schemas
289
+
290
+ ### Generated Structure
291
+
292
+ For a JSON Schema file with definitions:
293
+
294
+ ```
295
+ output/
296
+ ├── models/
297
+ │ ├── kustomization.ts
298
+ │ ├── config-map-args.ts
299
+ │ ├── helm-chart.ts
300
+ │ └── ... (all definitions)
301
+ └── index.ts
302
+ ```
303
+
304
+ **Naming convention:**
305
+ - `ConfigMapArgs` → `config-map-args.ts`
306
+ - `HelmChart` → `helm-chart.ts`
307
+ - `Kustomization` → `kustomization.ts`
308
+
309
+ ### Using Generated JSON Schema Models
310
+
311
+ ```typescript
312
+ import { Kustomization, ConfigMapArgs } from './generated/kustomization';
313
+
314
+ // Create a typed kustomization file
315
+ const kustomization: Kustomization = {
316
+ apiVersion: 'kustomize.config.k8s.io/v1beta1',
317
+ kind: 'Kustomization',
318
+ resources: [
319
+ './deployment.yaml',
320
+ './service.yaml'
321
+ ],
322
+ configMapGenerator: [
323
+ {
324
+ name: 'my-config',
325
+ literals: ['key=value']
326
+ }
327
+ ]
328
+ };
329
+
330
+ // Full TypeScript intellisense and type checking!
331
+ ```
332
+
333
+ ### JSON Schema Programmatic API
334
+
335
+ ```typescript
336
+ import { JSONSchemaGenerator } from 'klasik';
337
+
338
+ const generator = new JSONSchemaGenerator();
339
+
340
+ // Single URL
341
+ await generator.generate({
342
+ urls: './schemas/my-schema.json',
343
+ outputDir: './generated',
344
+ nestJsSwagger: true,
345
+ classValidator: true
346
+ });
347
+
348
+ // Multiple URLs
349
+ await generator.generate({
350
+ urls: [
351
+ 'https://json.schemastore.org/kustomization.json',
352
+ './local-schema.json'
353
+ ],
354
+ outputDir: './generated',
355
+ keepSpec: true // Keep intermediate OpenAPI specs
356
+ });
357
+ ```
358
+
359
+ **JSONSchemaGeneratorOptions:**
360
+ - `urls: string | string[]` - URL(s) or file path(s) to JSON Schema files (required)
361
+ - `outputDir: string` - Output directory (required)
362
+ - `headers?: Record<string, string>` - Custom HTTP headers
363
+ - `timeout?: number` - Request timeout in milliseconds (default: 30000)
364
+ - `fixEsmImports?: boolean` - Add .js extensions for ESM (default: false)
365
+ - `nestJsSwagger?: boolean` - Include NestJS decorators (default: false)
366
+ - `classValidator?: boolean` - Include validation decorators (default: false)
367
+ - `skipJsExtensions?: boolean` - Skip .js extensions (default: false)
368
+ - `templateDir?: string` - Custom template directory
369
+ - `keepSpec?: boolean` - Keep intermediate OpenAPI specs (default: false)
370
+
247
371
  ## CLI Commands
248
372
 
249
373
  ### `generate`
@@ -454,6 +578,76 @@ output/
454
578
  └── index.ts
455
579
  ```
456
580
 
581
+ ### `generate-jsonschema`
582
+
583
+ Generate TypeScript models from JSON Schema files.
584
+
585
+ **Options:**
586
+ - `-u, --url <url...>` - URL(s) or file path(s) to JSON Schema files (required)
587
+ - Can be specified multiple times: `-u url1 -u url2 -u url3`
588
+ - All schemas from all URLs are merged into a single output directory
589
+ - Supports: `https://...`, `http://...`, `file://...`, `/absolute/path`, `./relative/path`
590
+ - `-o, --output <dir>` - Output directory for generated models (required)
591
+ - `--nestjs-swagger` - Include NestJS Swagger `@ApiProperty` decorators
592
+ - `--class-validator` - Include class-validator decorators
593
+ - `--esm` - Add `.js` extensions to imports for ESM compatibility
594
+ - `-H, --header <header...>` - Custom headers for HTTP requests (format: "Key: Value")
595
+ - `-t, --template <dir>` - Custom template directory
596
+ - `-k, --keep-spec` - Keep the generated OpenAPI spec files (for debugging)
597
+ - `--timeout <ms>` - Request timeout in milliseconds (default: 30000)
598
+
599
+ **Examples:**
600
+
601
+ ```bash
602
+ # Generate from SchemaStore
603
+ klasik generate-jsonschema \
604
+ --url https://json.schemastore.org/kustomization.json \
605
+ --output ./generated/kustomization
606
+
607
+ # Generate from multiple JSON Schema files (merged into single output)
608
+ klasik generate-jsonschema \
609
+ -u https://json.schemastore.org/kustomization.json \
610
+ -u https://json.schemastore.org/package.json \
611
+ --output ./generated/schemas
612
+
613
+ # Mix remote and local schemas
614
+ klasik generate-jsonschema \
615
+ -u https://json.schemastore.org/kustomization.json \
616
+ -u ./schemas/my-schema.json \
617
+ -u ./schemas/another-schema.json \
618
+ --output ./src/generated
619
+
620
+ # NestJS integration with validation
621
+ klasik generate-jsonschema \
622
+ --url ./schemas/ \
623
+ --output ./src/generated/models \
624
+ --nestjs-swagger \
625
+ --class-validator
626
+
627
+ # From local file with ESM support
628
+ klasik generate-jsonschema \
629
+ --url ./local-schema.json \
630
+ --output ./generated \
631
+ --esm
632
+
633
+ # Keep intermediate OpenAPI specs for debugging
634
+ klasik generate-jsonschema \
635
+ --url https://json.schemastore.org/kustomization.json \
636
+ --output ./generated \
637
+ --keep-spec
638
+ ```
639
+
640
+ **Output Structure:**
641
+
642
+ ```
643
+ output/
644
+ ├── models/
645
+ │ ├── type-a.ts
646
+ │ ├── type-b.ts
647
+ │ └── ... (all definitions from all schemas)
648
+ └── index.ts
649
+ ```
650
+
457
651
  ## Programmatic API
458
652
 
459
653
  ### K8sClientGenerator
package/dist/cli.js CHANGED
@@ -185,4 +185,53 @@ program
185
185
  process.exit(1);
186
186
  }
187
187
  });
188
+ program
189
+ .command('generate-jsonschema')
190
+ .description('Generate TypeScript models from JSON Schema files')
191
+ .requiredOption('-u, --url <url...>', 'URL(s) or file path(s) to JSON Schema files (can be specified multiple times)')
192
+ .requiredOption('-o, --output <dir>', 'Output directory for generated models')
193
+ .option('--nestjs-swagger', 'Include NestJS Swagger @ApiProperty decorators in generated models', false)
194
+ .option('--class-validator', 'Include class-validator decorators in generated models', false)
195
+ .option('--esm', 'Add .js extensions to imports for ESM compatibility', false)
196
+ .option('-H, --header <header...>', 'Custom headers for the request (format: "Key: Value")')
197
+ .option('--timeout <ms>', 'Request timeout in milliseconds', '30000')
198
+ .option('-t, --template <dir>', 'Custom template directory')
199
+ .option('-k, --keep-spec', 'Keep the generated OpenAPI spec files', false)
200
+ .action(async (options) => {
201
+ try {
202
+ // Parse headers if provided
203
+ const headers = {};
204
+ if (options.header) {
205
+ for (const header of options.header) {
206
+ const [key, ...valueParts] = header.split(':');
207
+ const value = valueParts.join(':').trim();
208
+ if (key && value) {
209
+ headers[key.trim()] = value;
210
+ }
211
+ }
212
+ }
213
+ // Resolve output directory to absolute path
214
+ const outputDir = path.resolve(options.output);
215
+ const { JSONSchemaGenerator } = await Promise.resolve().then(() => __importStar(require('./jsonschema/jsonschema-generator')));
216
+ const generator = new JSONSchemaGenerator();
217
+ // Handle both single URL (backwards compat) and multiple URLs
218
+ const urls = Array.isArray(options.url) ? options.url : [options.url];
219
+ await generator.generate({
220
+ urls,
221
+ outputDir,
222
+ headers: Object.keys(headers).length > 0 ? headers : undefined,
223
+ timeout: parseInt(options.timeout, 10),
224
+ fixEsmImports: options.esm,
225
+ nestJsSwagger: options.nestjsSwagger,
226
+ classValidator: options.classValidator,
227
+ templateDir: options.template,
228
+ keepSpec: options.keepSpec,
229
+ });
230
+ process.exit(0);
231
+ }
232
+ catch (error) {
233
+ console.error('Error:', error instanceof Error ? error.message : error);
234
+ process.exit(1);
235
+ }
236
+ });
188
237
  program.parse();
package/dist/index.d.ts CHANGED
@@ -5,3 +5,7 @@ export { CRDGenerator, CRDGeneratorOptions } from './crd/crd-generator';
5
5
  export { CRDParser } from './crd/crd-parser';
6
6
  export { CRDToOpenAPIConverter, ConversionOptions } from './crd/crd-to-openapi';
7
7
  export { ParsedCRD, ParsedCRDResult, CRDVersion, CRDMetadata, ExtractedSchema, CRDParserOptions, } from './crd/types';
8
+ export { JSONSchemaGenerator, JSONSchemaGeneratorOptions } from './jsonschema/jsonschema-generator';
9
+ export { JSONSchemaParser } from './jsonschema/jsonschema-parser';
10
+ export { JSONSchemaToOpenAPIConverter, JSONSchemaConversionOptions } from './jsonschema/jsonschema-to-openapi';
11
+ export { ParsedJSONSchema, ParsedJSONSchemaResult, JSONSchemaMetadata, JSONSchemaParserOptions, } from './jsonschema/types';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CRDToOpenAPIConverter = exports.CRDParser = exports.CRDGenerator = exports.EsmFixer = exports.SpecDownloader = exports.K8sClientGenerator = void 0;
3
+ exports.JSONSchemaToOpenAPIConverter = exports.JSONSchemaParser = exports.JSONSchemaGenerator = exports.CRDToOpenAPIConverter = exports.CRDParser = exports.CRDGenerator = exports.EsmFixer = exports.SpecDownloader = exports.K8sClientGenerator = void 0;
4
4
  var k8s_client_generator_1 = require("./k8s-client-generator");
5
5
  Object.defineProperty(exports, "K8sClientGenerator", { enumerable: true, get: function () { return k8s_client_generator_1.K8sClientGenerator; } });
6
6
  var spec_downloader_1 = require("./spec-downloader");
@@ -14,3 +14,10 @@ var crd_parser_1 = require("./crd/crd-parser");
14
14
  Object.defineProperty(exports, "CRDParser", { enumerable: true, get: function () { return crd_parser_1.CRDParser; } });
15
15
  var crd_to_openapi_1 = require("./crd/crd-to-openapi");
16
16
  Object.defineProperty(exports, "CRDToOpenAPIConverter", { enumerable: true, get: function () { return crd_to_openapi_1.CRDToOpenAPIConverter; } });
17
+ // JSON Schema generation exports
18
+ var jsonschema_generator_1 = require("./jsonschema/jsonschema-generator");
19
+ Object.defineProperty(exports, "JSONSchemaGenerator", { enumerable: true, get: function () { return jsonschema_generator_1.JSONSchemaGenerator; } });
20
+ var jsonschema_parser_1 = require("./jsonschema/jsonschema-parser");
21
+ Object.defineProperty(exports, "JSONSchemaParser", { enumerable: true, get: function () { return jsonschema_parser_1.JSONSchemaParser; } });
22
+ var jsonschema_to_openapi_1 = require("./jsonschema/jsonschema-to-openapi");
23
+ Object.defineProperty(exports, "JSONSchemaToOpenAPIConverter", { enumerable: true, get: function () { return jsonschema_to_openapi_1.JSONSchemaToOpenAPIConverter; } });
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Options for JSON Schema client generation
3
+ */
4
+ export interface JSONSchemaGeneratorOptions {
5
+ /**
6
+ * URL(s) or file path(s) to JSON Schema file(s)
7
+ * Can be a single URL string or array of URLs
8
+ */
9
+ urls: string | string[];
10
+ /**
11
+ * Output directory for generated models
12
+ */
13
+ outputDir: string;
14
+ /**
15
+ * Custom headers for downloading schemas from URLs
16
+ */
17
+ headers?: Record<string, string>;
18
+ /**
19
+ * Request timeout for downloading specs in milliseconds
20
+ * @default 30000
21
+ */
22
+ timeout?: number;
23
+ /**
24
+ * Whether to fix ESM imports by adding .js extensions
25
+ * @default false
26
+ */
27
+ fixEsmImports?: boolean;
28
+ /**
29
+ * Include NestJS Swagger @ApiProperty decorators
30
+ * @default false
31
+ */
32
+ nestJsSwagger?: boolean;
33
+ /**
34
+ * Include class-validator decorators
35
+ * @default false
36
+ */
37
+ classValidator?: boolean;
38
+ /**
39
+ * Skip adding .js extensions to imports/exports
40
+ * @default false
41
+ */
42
+ skipJsExtensions?: boolean;
43
+ /**
44
+ * Custom template directory
45
+ */
46
+ templateDir?: string;
47
+ /**
48
+ * Whether to keep the intermediate OpenAPI specs
49
+ * @default false
50
+ */
51
+ keepSpec?: boolean;
52
+ }
53
+ /**
54
+ * Main orchestrator for generating TypeScript models from JSON Schema files
55
+ */
56
+ export declare class JSONSchemaGenerator {
57
+ private parser;
58
+ private converter;
59
+ private k8sGenerator;
60
+ constructor();
61
+ /**
62
+ * Main generation workflow
63
+ * @param options Generation options
64
+ */
65
+ generate(options: JSONSchemaGeneratorOptions): Promise<void>;
66
+ /**
67
+ * Load JSON Schema file from URL or local path
68
+ * @param url URL or file path
69
+ * @param headers Optional HTTP headers
70
+ * @param timeout Optional timeout in milliseconds
71
+ * @returns Schema file content as string
72
+ */
73
+ private loadSchemaFile;
74
+ /**
75
+ * Check if the URL is a local file path
76
+ */
77
+ private isLocalFile;
78
+ /**
79
+ * Load JSON Schema from local file
80
+ */
81
+ private loadLocalSchemaFile;
82
+ /**
83
+ * Generate index file for all definitions
84
+ * @param outputDir Output directory
85
+ * @param definitions List of definition names
86
+ */
87
+ private generateIndex;
88
+ /**
89
+ * Convert definition name to file name
90
+ * ConfigMapArgs → config-map-args
91
+ * @param definitionName Definition name
92
+ * @returns File name (without .ts extension)
93
+ */
94
+ private toFileName;
95
+ /**
96
+ * Extract filename from source path/URL
97
+ * @param source Source path or URL
98
+ * @returns Filename without extension
99
+ */
100
+ private extractFilename;
101
+ }