@flink-app/ts-source-to-json-schema 0.1.3 → 0.1.4
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.
- package/README.md +207 -2
- package/dist/ast.d.ts +3 -0
- package/dist/ast.d.ts.map +1 -1
- package/dist/cli.js +52 -15
- package/dist/cli.js.map +1 -1
- package/dist/emitter.d.ts +81 -0
- package/dist/emitter.d.ts.map +1 -1
- package/dist/emitter.js +162 -14
- package/dist/emitter.js.map +1 -1
- package/dist/import-parser.d.ts +6 -1
- package/dist/import-parser.d.ts.map +1 -1
- package/dist/import-parser.js +91 -1
- package/dist/import-parser.js.map +1 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -2
- package/dist/index.js.map +1 -1
- package/dist/module-resolver.d.ts +6 -0
- package/dist/module-resolver.d.ts.map +1 -1
- package/dist/module-resolver.js +37 -4
- package/dist/module-resolver.js.map +1 -1
- package/dist/parser.d.ts +4 -0
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +150 -2
- package/dist/parser.js.map +1 -1
- package/dist/path-utils.d.ts +37 -0
- package/dist/path-utils.d.ts.map +1 -1
- package/dist/path-utils.js +314 -9
- package/dist/path-utils.js.map +1 -1
- package/dist/tokenizer.d.ts.map +1 -1
- package/dist/tokenizer.js +2 -1
- package/dist/tokenizer.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,6 +77,7 @@ npx ts-source-to-json-schema src/user.ts -r User --strictObjects --followImports
|
|
|
77
77
|
-h, --help Show help message
|
|
78
78
|
-v, --version Show version number
|
|
79
79
|
--doctor Output diagnostic information for debugging
|
|
80
|
+
--batch Batch mode: generate schemas for all types across files
|
|
80
81
|
|
|
81
82
|
-r, --rootType <name> Emit this type as root (others in $defs)
|
|
82
83
|
-s, --includeSchema <bool> Include $schema property (default: true)
|
|
@@ -150,6 +151,32 @@ npx ts-source-to-json-schema src/standalone.ts --followImports none
|
|
|
150
151
|
npx ts-source-to-json-schema src/api.ts --baseDir ./src
|
|
151
152
|
```
|
|
152
153
|
|
|
154
|
+
### Batch Mode (`--batch`)
|
|
155
|
+
|
|
156
|
+
Use `--batch` to generate schemas for all types across multiple files at once. Accepts glob patterns or multiple file paths:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Batch: all schemas from matching files
|
|
160
|
+
npx ts-source-to-json-schema --batch 'src/schemas/**/*.ts' --followImports local
|
|
161
|
+
|
|
162
|
+
# Batch: specific files
|
|
163
|
+
npx ts-source-to-json-schema --batch src/PostReq.ts src/PostRes.ts --followImports local
|
|
164
|
+
|
|
165
|
+
# Batch with strict objects
|
|
166
|
+
npx ts-source-to-json-schema --batch 'src/types/*.ts' --strictObjects
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Output is a JSON object where keys are type names and values are standalone schemas:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"PostReq": { "$schema": "...", "type": "object", "properties": { ... } },
|
|
174
|
+
"PostRes": { "$schema": "...", "type": "object", "properties": { ... } }
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Shared imports are resolved once and deduplicated across all entry files.
|
|
179
|
+
|
|
153
180
|
### Diagnostics Mode (`--doctor`)
|
|
154
181
|
|
|
155
182
|
When you encounter issues with schema conversion, use the `--doctor` flag to output comprehensive diagnostic information that can be shared with developers:
|
|
@@ -334,6 +361,45 @@ console.log(schemas.GetTree_12_ResSchema);
|
|
|
334
361
|
|
|
335
362
|
**Performance:** Same batch performance benefits as `toJsonSchemas()`, plus automatic import resolution.
|
|
336
363
|
|
|
364
|
+
#### Multi-Entry Batch Generation
|
|
365
|
+
|
|
366
|
+
When you need to generate schemas from multiple TypeScript files (not just one entry file), use `toJsonSchemasFromFiles()`. It accepts a glob pattern or an array of file paths:
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { toJsonSchemasFromFiles } from "ts-source-to-json-schema";
|
|
370
|
+
|
|
371
|
+
// Glob pattern — matches all .ts files in src/schemas/
|
|
372
|
+
const schemas = toJsonSchemasFromFiles('src/schemas/**/*.ts', {
|
|
373
|
+
followImports: 'local'
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// Array of specific files
|
|
377
|
+
const schemas = toJsonSchemasFromFiles([
|
|
378
|
+
'src/schemas/PostUserReq.ts',
|
|
379
|
+
'src/schemas/PostUserRes.ts'
|
|
380
|
+
], { followImports: 'local' });
|
|
381
|
+
|
|
382
|
+
// With defineNameTransform for namespacing
|
|
383
|
+
const schemas = toJsonSchemasFromFiles('src/schemas/**/*.ts', {
|
|
384
|
+
followImports: 'local',
|
|
385
|
+
defineNameTransform: (name, decl, ctx) => {
|
|
386
|
+
const file = path.basename(ctx?.relativePath ?? '', '.ts');
|
|
387
|
+
return `${file}.${name}`;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
**Key benefits over `toJsonSchemasFromFile()`:**
|
|
393
|
+
- Accepts multiple entry files or a glob pattern (not just a single file)
|
|
394
|
+
- Shared imports are resolved once and deduplicated across all entry files
|
|
395
|
+
- Combined with `defineNameTransform`, enables stable type IDs across all schemas
|
|
396
|
+
- Returns `{}` when no files match (safe for empty globs)
|
|
397
|
+
|
|
398
|
+
**Glob support:**
|
|
399
|
+
- `*` matches any characters within a file/directory name
|
|
400
|
+
- `**` matches zero or more directory levels
|
|
401
|
+
- `?` matches a single character
|
|
402
|
+
|
|
337
403
|
Output:
|
|
338
404
|
|
|
339
405
|
```json
|
|
@@ -378,12 +444,23 @@ toJsonSchemaFromFile(filePath, {
|
|
|
378
444
|
// All options from toJsonSchema, plus:
|
|
379
445
|
followImports: 'local', // Follow imports: 'none' (default for API), 'local' (default for CLI), 'all'
|
|
380
446
|
baseDir: './src', // Base directory for resolving imports (default: dirname(filePath))
|
|
447
|
+
onDuplicateDeclarations: 'error', // Handle duplicate type names: 'error' (default), 'warn', 'silent'
|
|
381
448
|
});
|
|
382
449
|
|
|
383
450
|
toJsonSchemasFromFile(filePath, {
|
|
384
451
|
// All options from toJsonSchemas, plus:
|
|
385
452
|
followImports: 'local', // Follow imports: 'none', 'local' (default), 'all'
|
|
386
453
|
baseDir: './src', // Base directory for resolving imports (default: dirname(filePath))
|
|
454
|
+
onDuplicateDeclarations: 'error', // Handle duplicate type names: 'error' (default), 'warn', 'silent'
|
|
455
|
+
// Note: rootType is not supported (generates schemas for all types)
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
toJsonSchemasFromFiles(entries, {
|
|
459
|
+
// entries: glob pattern (string) or array of file paths
|
|
460
|
+
// All options from toJsonSchemas, plus:
|
|
461
|
+
followImports: 'local', // Follow imports: 'none' (default), 'local', 'all'
|
|
462
|
+
baseDir: './src', // Base directory for resolving imports (default: cwd)
|
|
463
|
+
onDuplicateDeclarations: 'error', // Handle duplicate type names: 'error' (default), 'warn', 'silent'
|
|
387
464
|
// Note: rootType is not supported (generates schemas for all types)
|
|
388
465
|
});
|
|
389
466
|
```
|
|
@@ -538,7 +615,7 @@ interface Settings {
|
|
|
538
615
|
- `local`: Follows relative imports (`./` and `../`), skips `node_modules`
|
|
539
616
|
- `all`: Reserved for future `node_modules` support (currently behaves like `local`)
|
|
540
617
|
|
|
541
|
-
**Only available with file-based APIs** (`toJsonSchemaFromFile()` and `
|
|
618
|
+
**Only available with file-based APIs** (`toJsonSchemaFromFile()`, `toJsonSchemasFromFile()`, and `toJsonSchemasFromFiles()`) — the string-based APIs (`toJsonSchema()` and `toJsonSchemas()`) do not support import resolution.
|
|
542
619
|
|
|
543
620
|
**Example:**
|
|
544
621
|
```typescript
|
|
@@ -555,7 +632,7 @@ const schema = toJsonSchemaFromFile('./api.ts', {
|
|
|
555
632
|
|
|
556
633
|
**Features:**
|
|
557
634
|
- Circular dependency detection (prevents infinite loops)
|
|
558
|
-
- Duplicate name
|
|
635
|
+
- Duplicate name handling (configurable with `onDuplicateDeclarations` option)
|
|
559
636
|
- Automatic extension resolution (`.ts`, `.tsx`, `.d.ts`)
|
|
560
637
|
- Index file resolution (`./types` → `./types/index.ts`)
|
|
561
638
|
|
|
@@ -566,6 +643,134 @@ const schema = toJsonSchemaFromFile('./api.ts', {
|
|
|
566
643
|
|
|
567
644
|
Only relevant when `followImports` is not `"none"`.
|
|
568
645
|
|
|
646
|
+
### `onDuplicateDeclarations` (optional)
|
|
647
|
+
- **Type:** `"error" | "warn" | "silent"`
|
|
648
|
+
- **Default:** `"error"`
|
|
649
|
+
- **Description:** Controls how to handle duplicate type names across multiple files
|
|
650
|
+
|
|
651
|
+
**Only relevant when `followImports` is not `"none"`** (requires import resolution).
|
|
652
|
+
|
|
653
|
+
**Modes:**
|
|
654
|
+
- `error` (default): Throws an error when the same type name is found in multiple files
|
|
655
|
+
- `warn`: Uses the first declaration encountered and logs a warning to `console.warn`
|
|
656
|
+
- `silent`: Uses the first declaration encountered without any warning
|
|
657
|
+
|
|
658
|
+
**When to use:**
|
|
659
|
+
- `error`: Strict mode for catching unintentional duplicates (recommended for most cases)
|
|
660
|
+
- `warn`: Development mode where you want to be notified but not block execution
|
|
661
|
+
- `silent`: When you have intentional duplicates and want to use the first declaration
|
|
662
|
+
|
|
663
|
+
**Example:**
|
|
664
|
+
```typescript
|
|
665
|
+
// File 1: schemas/CampaignImage.ts
|
|
666
|
+
export interface ImageDimensions {
|
|
667
|
+
width: number;
|
|
668
|
+
height: number;
|
|
669
|
+
format?: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// File 2: schemas/BrandAsset.ts
|
|
673
|
+
export interface ImageDimensions {
|
|
674
|
+
width: number;
|
|
675
|
+
height: number;
|
|
676
|
+
format: string; // Required (different from File 1)
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// With error mode (default) - throws error
|
|
680
|
+
toJsonSchemaFromFile('entry.ts', {
|
|
681
|
+
followImports: 'local'
|
|
682
|
+
});
|
|
683
|
+
// Error: Duplicate declaration "ImageDimensions" found in:
|
|
684
|
+
// .../CampaignImage.ts
|
|
685
|
+
// .../BrandAsset.ts
|
|
686
|
+
|
|
687
|
+
// With warn mode - uses first declaration
|
|
688
|
+
toJsonSchemaFromFile('entry.ts', {
|
|
689
|
+
followImports: 'local',
|
|
690
|
+
onDuplicateDeclarations: 'warn'
|
|
691
|
+
});
|
|
692
|
+
// Warning: Duplicate declaration "ImageDimensions" found...
|
|
693
|
+
// Uses ImageDimensions from CampaignImage.ts (format is optional)
|
|
694
|
+
|
|
695
|
+
// With silent mode - uses first declaration without warning
|
|
696
|
+
toJsonSchemaFromFile('entry.ts', {
|
|
697
|
+
followImports: 'local',
|
|
698
|
+
onDuplicateDeclarations: 'silent'
|
|
699
|
+
});
|
|
700
|
+
// No warning, uses ImageDimensions from CampaignImage.ts
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
**Best practice:** Keep the default `error` mode to catch duplicate names early. If you encounter duplicates:
|
|
704
|
+
1. Check if the types are structurally identical — if so, extract to a shared file
|
|
705
|
+
2. If they're different but have the same name, rename one of them for clarity
|
|
706
|
+
3. Use `warn` or `silent` mode only as a temporary workaround
|
|
707
|
+
|
|
708
|
+
### `defineId` (optional)
|
|
709
|
+
- **Type:** `(originalName: string, declaration: Declaration, context?: { absolutePath: string; relativePath: string }) => string`
|
|
710
|
+
- **Default:** `undefined`
|
|
711
|
+
- **Description:** Assigns a `$id` to each schema and uses external `$ref` instead of local `#/definitions/` refs
|
|
712
|
+
|
|
713
|
+
When set on batch APIs (`toJsonSchemas`, `toJsonSchemasFromFile`, `toJsonSchemasFromFiles`):
|
|
714
|
+
1. Each schema gets a `$id` field (the return value of the callback)
|
|
715
|
+
2. Internal `$ref` pointers become external refs pointing to the `$id` of the referenced type
|
|
716
|
+
3. The `definitions` block is omitted entirely
|
|
717
|
+
4. The `$id` is used as the key in the returned `Record<string, JSONSchema>`
|
|
718
|
+
|
|
719
|
+
This is designed for use with **AJV's global registry**, where schemas are registered by `$id` and cross-references are resolved at validation time.
|
|
720
|
+
|
|
721
|
+
**Example with AJV:**
|
|
722
|
+
```typescript
|
|
723
|
+
import { toJsonSchemas } from "ts-source-to-json-schema";
|
|
724
|
+
import Ajv from "ajv";
|
|
725
|
+
|
|
726
|
+
const schemas = toJsonSchemas(`
|
|
727
|
+
interface User { id: string; name: string; }
|
|
728
|
+
interface Post { title: string; author: User; }
|
|
729
|
+
`, {
|
|
730
|
+
defineId: (name) => \`schemas.\${name}\`
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
// schemas = {
|
|
734
|
+
// "schemas.User": {
|
|
735
|
+
// "$id": "schemas.User",
|
|
736
|
+
// "$schema": "...",
|
|
737
|
+
// "type": "object",
|
|
738
|
+
// "properties": { "id": { "type": "string" }, "name": { "type": "string" } }
|
|
739
|
+
// },
|
|
740
|
+
// "schemas.Post": {
|
|
741
|
+
// "$id": "schemas.Post",
|
|
742
|
+
// "$schema": "...",
|
|
743
|
+
// "type": "object",
|
|
744
|
+
// "properties": { "title": { "type": "string" }, "author": { "$ref": "schemas.User" } }
|
|
745
|
+
// }
|
|
746
|
+
// }
|
|
747
|
+
|
|
748
|
+
// Register all schemas with AJV
|
|
749
|
+
const ajv = new Ajv();
|
|
750
|
+
for (const schema of Object.values(schemas)) {
|
|
751
|
+
ajv.addSchema(schema);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// Validate — AJV resolves $ref: "schemas.User" from its global registry
|
|
755
|
+
const validate = ajv.getSchema("schemas.Post");
|
|
756
|
+
validate({ title: "Hello", author: { id: "1", name: "Joel" } }); // ✅
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
**With file context for namespacing:**
|
|
760
|
+
```typescript
|
|
761
|
+
const schemas = toJsonSchemasFromFiles('src/schemas/**/*.ts', {
|
|
762
|
+
followImports: 'local',
|
|
763
|
+
defineId: (name, decl, ctx) => {
|
|
764
|
+
const dir = ctx?.relativePath.replace(/\.ts$/, '').replace(/\//g, '.') ?? '';
|
|
765
|
+
return dir ? \`\${dir}.\${name}\` : name;
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
**Can be combined with `defineNameTransform`** — both options are independent. `defineId` controls `$id`/external `$ref`, while `defineNameTransform` controls `$defs`/`#/definitions/` names.
|
|
771
|
+
|
|
772
|
+
**Throws** if the callback returns duplicate `$id` values for different types.
|
|
773
|
+
|
|
569
774
|
## What it doesn't handle
|
|
570
775
|
|
|
571
776
|
Anything that requires the type checker to evaluate:
|
package/dist/ast.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export type Declaration = InterfaceDeclaration | TypeAliasDeclaration | EnumDecl
|
|
|
73
73
|
export interface InterfaceDeclaration {
|
|
74
74
|
kind: "interface";
|
|
75
75
|
name: string;
|
|
76
|
+
sourceFile?: string;
|
|
76
77
|
extends?: TypeNode[];
|
|
77
78
|
properties: PropertyNode[];
|
|
78
79
|
indexSignature?: IndexSignatureNode;
|
|
@@ -83,6 +84,7 @@ export interface InterfaceDeclaration {
|
|
|
83
84
|
export interface TypeAliasDeclaration {
|
|
84
85
|
kind: "type_alias";
|
|
85
86
|
name: string;
|
|
87
|
+
sourceFile?: string;
|
|
86
88
|
type: TypeNode;
|
|
87
89
|
description?: string;
|
|
88
90
|
tags?: Record<string, string>;
|
|
@@ -91,6 +93,7 @@ export interface TypeAliasDeclaration {
|
|
|
91
93
|
export interface EnumDeclaration {
|
|
92
94
|
kind: "enum";
|
|
93
95
|
name: string;
|
|
96
|
+
sourceFile?: string;
|
|
94
97
|
members: {
|
|
95
98
|
name: string;
|
|
96
99
|
value: string | number;
|
package/dist/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAIA,6CAA6C;AAC7C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EA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ACnB"}
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as fs from 'fs';
|
|
12
12
|
import * as path from 'path';
|
|
13
|
-
import { toJsonSchema, toJsonSchemaFromFile } from './index.js';
|
|
13
|
+
import { toJsonSchema, toJsonSchemaFromFile, toJsonSchemasFromFiles } from './index.js';
|
|
14
14
|
const version = '0.1.0'; // TODO: Read from package.json
|
|
15
15
|
function showHelp() {
|
|
16
16
|
console.log(`
|
|
@@ -18,6 +18,7 @@ ts-source-to-json-schema v${version}
|
|
|
18
18
|
|
|
19
19
|
USAGE:
|
|
20
20
|
ts-source-to-json-schema <file.ts> [options]
|
|
21
|
+
ts-source-to-json-schema --batch <pattern|files...> [options]
|
|
21
22
|
|
|
22
23
|
DESCRIPTION:
|
|
23
24
|
Convert TypeScript type definitions to JSON Schema (2020-12 draft).
|
|
@@ -26,6 +27,7 @@ OPTIONS:
|
|
|
26
27
|
-h, --help Show this help message
|
|
27
28
|
-v, --version Show version number
|
|
28
29
|
--doctor Output diagnostic information for debugging
|
|
30
|
+
--batch Batch mode: generate schemas for all types across files
|
|
29
31
|
|
|
30
32
|
-r, --rootType <name> Emit this type as root (others in $defs)
|
|
31
33
|
-s, --includeSchema <bool> Include $schema property (default: true)
|
|
@@ -58,11 +60,17 @@ EXAMPLES:
|
|
|
58
60
|
|
|
59
61
|
# Combine options
|
|
60
62
|
ts-source-to-json-schema src/user.ts -r User --strictObjects --followImports local
|
|
63
|
+
|
|
64
|
+
# Batch: all schemas from matching files
|
|
65
|
+
ts-source-to-json-schema --batch 'src/schemas/**/*.ts' --followImports local
|
|
66
|
+
|
|
67
|
+
# Batch: specific files
|
|
68
|
+
ts-source-to-json-schema --batch src/PostReq.ts src/PostRes.ts --followImports local
|
|
61
69
|
`);
|
|
62
70
|
}
|
|
63
71
|
function parseArgs(args) {
|
|
64
72
|
const options = {};
|
|
65
|
-
|
|
73
|
+
const filePaths = [];
|
|
66
74
|
for (let i = 0; i < args.length; i++) {
|
|
67
75
|
const arg = args[i];
|
|
68
76
|
if (arg === '-h' || arg === '--help') {
|
|
@@ -74,6 +82,9 @@ function parseArgs(args) {
|
|
|
74
82
|
else if (arg === '--doctor') {
|
|
75
83
|
options.doctor = true;
|
|
76
84
|
}
|
|
85
|
+
else if (arg === '--batch') {
|
|
86
|
+
options.batch = true;
|
|
87
|
+
}
|
|
77
88
|
else if (arg === '-r' || arg === '--rootType') {
|
|
78
89
|
options.rootType = args[++i];
|
|
79
90
|
}
|
|
@@ -110,17 +121,10 @@ function parseArgs(args) {
|
|
|
110
121
|
process.exit(1);
|
|
111
122
|
}
|
|
112
123
|
else {
|
|
113
|
-
|
|
114
|
-
if (!filePath) {
|
|
115
|
-
filePath = arg;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
console.error(`Unexpected argument: ${arg}`);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
124
|
+
filePaths.push(arg);
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
|
-
return {
|
|
127
|
+
return { filePaths, options };
|
|
124
128
|
}
|
|
125
129
|
function parseBoolean(value) {
|
|
126
130
|
const lower = value.toLowerCase();
|
|
@@ -141,7 +145,7 @@ function main() {
|
|
|
141
145
|
showHelp();
|
|
142
146
|
process.exit(0);
|
|
143
147
|
}
|
|
144
|
-
const {
|
|
148
|
+
const { filePaths, options } = parseArgs(args);
|
|
145
149
|
// Handle special flags
|
|
146
150
|
if (options.help) {
|
|
147
151
|
showHelp();
|
|
@@ -151,6 +155,34 @@ function main() {
|
|
|
151
155
|
console.log(version);
|
|
152
156
|
process.exit(0);
|
|
153
157
|
}
|
|
158
|
+
// Batch mode
|
|
159
|
+
if (options.batch) {
|
|
160
|
+
if (filePaths.length === 0) {
|
|
161
|
+
console.error('Error: No input files specified for --batch mode');
|
|
162
|
+
console.error('Usage: ts-source-to-json-schema --batch <pattern|files...> [options]');
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
const { help, version, doctor, batch, ...emitterOptions } = options;
|
|
167
|
+
const followMode = emitterOptions.followImports ?? 'local';
|
|
168
|
+
// If single argument with glob chars, pass as pattern string; otherwise as array
|
|
169
|
+
const entries = filePaths.length === 1 && /[*?]/.test(filePaths[0])
|
|
170
|
+
? filePaths[0]
|
|
171
|
+
: filePaths;
|
|
172
|
+
const schemas = toJsonSchemasFromFiles(entries, {
|
|
173
|
+
...emitterOptions,
|
|
174
|
+
followImports: followMode,
|
|
175
|
+
});
|
|
176
|
+
console.log(JSON.stringify(schemas, null, 2));
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
process.exit(0);
|
|
183
|
+
}
|
|
184
|
+
// Single-file mode
|
|
185
|
+
const filePath = filePaths[0] ?? null;
|
|
154
186
|
// Validate file path
|
|
155
187
|
if (!filePath) {
|
|
156
188
|
console.error('Error: No input file specified');
|
|
@@ -158,6 +190,11 @@ function main() {
|
|
|
158
190
|
console.error('Run with --help for more information');
|
|
159
191
|
process.exit(1);
|
|
160
192
|
}
|
|
193
|
+
if (filePaths.length > 1) {
|
|
194
|
+
console.error('Error: Multiple files given without --batch flag');
|
|
195
|
+
console.error('Use --batch for multi-file mode: ts-source-to-json-schema --batch <files...>');
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
161
198
|
// Resolve file path
|
|
162
199
|
const absolutePath = path.resolve(process.cwd(), filePath);
|
|
163
200
|
// Check if file exists (skip in doctor mode to provide diagnostics)
|
|
@@ -181,7 +218,7 @@ function main() {
|
|
|
181
218
|
}
|
|
182
219
|
// Doctor mode: output comprehensive diagnostics
|
|
183
220
|
if (options.doctor) {
|
|
184
|
-
const { help, version, doctor, ...emitterOptions } = options;
|
|
221
|
+
const { help, version, doctor, batch, ...emitterOptions } = options;
|
|
185
222
|
const inputInfo = {
|
|
186
223
|
filePath: filePath,
|
|
187
224
|
absolutePath: absolutePath,
|
|
@@ -247,8 +284,8 @@ function main() {
|
|
|
247
284
|
// Convert to JSON Schema
|
|
248
285
|
let schema;
|
|
249
286
|
try {
|
|
250
|
-
// Remove help, version, doctor from emitter options
|
|
251
|
-
const { help, version, doctor, ...emitterOptions } = options;
|
|
287
|
+
// Remove help, version, doctor, batch from emitter options
|
|
288
|
+
const { help, version, doctor, batch, ...emitterOptions } = options;
|
|
252
289
|
// Determine followImports mode (default to 'local' in CLI)
|
|
253
290
|
const followMode = emitterOptions.followImports ?? 'local';
|
|
254
291
|
if (followMode !== 'none') {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAkB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAkB,MAAM,YAAY,CAAC;AAWxG,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,+BAA+B;AAExD,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;4BACc,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDlC,CAAC,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,MAAM,SA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cAAc,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACrE,MAAM,GAAG,oBAAoB,CAAC,YAAY,EAAE;gBAC1C,GAAG,cAAc;gBACjB,OAAO;gBACP,aAAa,EAAE,UAAU;aAC1B,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,iDAAiD;YACjD,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5G,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,+BAA+B;IAC/B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/emitter.d.ts
CHANGED
|
@@ -47,11 +47,80 @@ export interface EmitterOptions {
|
|
|
47
47
|
followImports?: "none" | "local" | "all";
|
|
48
48
|
/** Base directory for resolving imports. Default: dirname(entryPath) or cwd */
|
|
49
49
|
baseDir?: string;
|
|
50
|
+
/**
|
|
51
|
+
* How to handle duplicate type declarations across files.
|
|
52
|
+
* - 'error': Throw error (strict, default)
|
|
53
|
+
* - 'warn': Use first declaration, log warning
|
|
54
|
+
* - 'silent': Use first declaration, no warning
|
|
55
|
+
* Default: 'error'
|
|
56
|
+
*/
|
|
57
|
+
onDuplicateDeclarations?: 'error' | 'warn' | 'silent';
|
|
58
|
+
/**
|
|
59
|
+
* Callback to transform type names in $defs and $ref pointers.
|
|
60
|
+
* Useful for namespacing types by file, adding prefixes/suffixes, or custom naming schemes.
|
|
61
|
+
*
|
|
62
|
+
* @param originalName - The original type name from the TypeScript source
|
|
63
|
+
* @param declaration - The AST declaration node for the type
|
|
64
|
+
* @param context - File path context (undefined for string-based APIs, defined for file-based APIs)
|
|
65
|
+
* @returns The transformed name to use in the schema
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // Namespace by file path
|
|
69
|
+
* defineNameTransform: (name, decl, context) => {
|
|
70
|
+
* if (!context) return name;
|
|
71
|
+
* const parts = context.relativePath.replace(/\.ts$/, '').split('/');
|
|
72
|
+
* return `${parts.join('_')}_${name}`;
|
|
73
|
+
* }
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* // Add prefix by declaration kind
|
|
77
|
+
* defineNameTransform: (name, decl) => {
|
|
78
|
+
* const prefix = decl.kind === 'interface' ? 'I' : 'T';
|
|
79
|
+
* return `${prefix}${name}`;
|
|
80
|
+
* }
|
|
81
|
+
*/
|
|
82
|
+
defineNameTransform?: (originalName: string, declaration: Declaration, context?: {
|
|
83
|
+
absolutePath: string;
|
|
84
|
+
relativePath: string;
|
|
85
|
+
}) => string;
|
|
86
|
+
/**
|
|
87
|
+
* Callback to assign a `$id` to each schema in batch generation.
|
|
88
|
+
* When set, schemas use external `$ref` (the `$id` of the referenced type)
|
|
89
|
+
* instead of local `#/definitions/...` refs. This eliminates the `definitions`
|
|
90
|
+
* block entirely — AJV resolves external refs from its global registry.
|
|
91
|
+
*
|
|
92
|
+
* The `$id` also becomes the key in the returned `Record<string, JSONSchema>`.
|
|
93
|
+
*
|
|
94
|
+
* @param originalName - The original type name from the TypeScript source
|
|
95
|
+
* @param declaration - The AST declaration node for the type
|
|
96
|
+
* @param context - File path context (undefined for string-based APIs, defined for file-based APIs)
|
|
97
|
+
* @returns The `$id` for this schema
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* // Simple dot-namespaced IDs for AJV
|
|
101
|
+
* defineId: (name) => `schemas.${name}`
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* // Namespace by file path
|
|
105
|
+
* defineId: (name, decl, context) => {
|
|
106
|
+
* if (!context) return name;
|
|
107
|
+
* const dir = context.relativePath.replace(/\.ts$/, '').replace(/\//g, '.');
|
|
108
|
+
* return `${dir}.${name}`;
|
|
109
|
+
* }
|
|
110
|
+
*/
|
|
111
|
+
defineId?: (originalName: string, declaration: Declaration, context?: {
|
|
112
|
+
absolutePath: string;
|
|
113
|
+
relativePath: string;
|
|
114
|
+
}) => string;
|
|
50
115
|
}
|
|
51
116
|
export declare class Emitter {
|
|
52
117
|
private declarations;
|
|
118
|
+
private nameMapping;
|
|
119
|
+
private idMapping;
|
|
53
120
|
private options;
|
|
54
121
|
constructor(declarations: Declaration[], options?: EmitterOptions);
|
|
122
|
+
private getDefineName;
|
|
123
|
+
private getDefineId;
|
|
55
124
|
/**
|
|
56
125
|
* Check if a declaration is generic (has type parameters like T, U, V, W)
|
|
57
126
|
*/
|
|
@@ -71,6 +140,9 @@ export declare class Emitter {
|
|
|
71
140
|
* Emits a declaration as a standalone schema with minimal definitions.
|
|
72
141
|
* Only includes types that are transitively referenced.
|
|
73
142
|
* Uses "definitions" (draft-07 style) instead of "$defs" for compatibility.
|
|
143
|
+
*
|
|
144
|
+
* When `defineId` is set, uses external `$ref` (the `$id` of the referenced type)
|
|
145
|
+
* instead of local `#/definitions/...` refs, eliminating the `definitions` block.
|
|
74
146
|
*/
|
|
75
147
|
private emitDeclarationStandalone;
|
|
76
148
|
/**
|
|
@@ -89,6 +161,15 @@ export declare class Emitter {
|
|
|
89
161
|
* Recursively converts $ref paths from #/$defs/ to #/definitions/ in a schema.
|
|
90
162
|
*/
|
|
91
163
|
private convertRefsToDefinitions;
|
|
164
|
+
/**
|
|
165
|
+
* Recursively converts internal $ref paths to external $id references.
|
|
166
|
+
* Replaces `#/$defs/TypeName` with the $id of the referenced type.
|
|
167
|
+
*/
|
|
168
|
+
private convertRefsToExternalIds;
|
|
169
|
+
/**
|
|
170
|
+
* Finds the original type name from a transformed (getDefineName) name.
|
|
171
|
+
*/
|
|
172
|
+
private findOriginalName;
|
|
92
173
|
/**
|
|
93
174
|
* Checks if a schema contains a reference to a specific type name.
|
|
94
175
|
* Used to detect self-referential types.
|
package/dist/emitter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,WAAW,EAEZ,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC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