@formspec/build 0.1.0-alpha.10 → 0.1.0-alpha.12
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 +51 -15
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +2 -0
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +1 -0
- package/dist/__tests__/constraint-validator.test.d.ts +2 -0
- package/dist/__tests__/constraint-validator.test.d.ts.map +1 -0
- package/dist/__tests__/extension-api.test.d.ts +2 -0
- package/dist/__tests__/extension-api.test.d.ts.map +1 -0
- package/dist/__tests__/fixtures/example-a-builtins.d.ts +18 -0
- package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -1
- package/dist/__tests__/ir-analyzer.test.d.ts +11 -0
- package/dist/__tests__/ir-analyzer.test.d.ts.map +1 -0
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +12 -0
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +1 -0
- package/dist/__tests__/ir-json-schema-generator.test.d.ts +11 -0
- package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +1 -0
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts +2 -0
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +1 -0
- package/dist/__tests__/jsdoc-constraints.test.d.ts +4 -4
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +19 -0
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +13 -0
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +28 -0
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +12 -0
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +19 -0
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/parity.test.d.ts +14 -0
- package/dist/__tests__/parity/parity.test.d.ts.map +1 -0
- package/dist/__tests__/parity/utils.d.ts +139 -0
- package/dist/__tests__/parity/utils.d.ts.map +1 -0
- package/dist/analyzer/class-analyzer.d.ts +54 -99
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +78 -30
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +61 -0
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
- package/dist/browser.cjs +1200 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.ts +12 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1147 -44
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +385 -160
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +18 -0
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
- package/dist/canonicalize/index.d.ts +8 -0
- package/dist/canonicalize/index.d.ts.map +1 -0
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts +34 -0
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
- package/dist/cli.cjs +2028 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +1978 -101
- package/dist/cli.js.map +1 -1
- package/dist/extensions/index.d.ts +8 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/registry.d.ts +55 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/generators/class-schema.d.ts +28 -47
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/method-schema.d.ts +6 -8
- package/dist/generators/method-schema.d.ts.map +1 -1
- package/dist/index.cjs +1832 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1779 -114
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +2125 -0
- package/dist/internals.cjs.map +1 -0
- package/dist/internals.d.ts +12 -2
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +2084 -21
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts +10 -5
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +84 -0
- package/dist/json-schema/ir-generator.d.ts.map +1 -0
- package/dist/json-schema/schema.d.ts +16 -0
- package/dist/json-schema/schema.d.ts.map +1 -0
- package/dist/json-schema/types.d.ts +5 -6
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/ui-schema/generator.d.ts +5 -0
- package/dist/ui-schema/generator.d.ts.map +1 -1
- package/dist/ui-schema/ir-generator.d.ts +53 -0
- package/dist/ui-schema/ir-generator.d.ts.map +1 -0
- package/dist/ui-schema/schema.d.ts +357 -0
- package/dist/ui-schema/schema.d.ts.map +1 -0
- package/dist/ui-schema/types.d.ts +8 -73
- package/dist/ui-schema/types.d.ts.map +1 -1
- package/dist/validate/constraint-validator.d.ts +66 -0
- package/dist/validate/constraint-validator.d.ts.map +1 -0
- package/dist/validate/index.d.ts +9 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/package.json +15 -9
- package/dist/__tests__/analyzer-edge-cases.test.d.ts +0 -13
- package/dist/__tests__/analyzer-edge-cases.test.d.ts.map +0 -1
- package/dist/__tests__/analyzer-edge-cases.test.js +0 -376
- package/dist/__tests__/analyzer-edge-cases.test.js.map +0 -1
- package/dist/__tests__/analyzer.test.d.ts +0 -5
- package/dist/__tests__/analyzer.test.d.ts.map +0 -1
- package/dist/__tests__/analyzer.test.js +0 -190
- package/dist/__tests__/analyzer.test.js.map +0 -1
- package/dist/__tests__/cli.test.js +0 -178
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/__tests__/codegen.test.d.ts +0 -5
- package/dist/__tests__/codegen.test.d.ts.map +0 -1
- package/dist/__tests__/codegen.test.js +0 -506
- package/dist/__tests__/codegen.test.js.map +0 -1
- package/dist/__tests__/decorator-pipeline.test.d.ts +0 -11
- package/dist/__tests__/decorator-pipeline.test.d.ts.map +0 -1
- package/dist/__tests__/decorator-pipeline.test.js +0 -460
- package/dist/__tests__/decorator-pipeline.test.js.map +0 -1
- package/dist/__tests__/edge-cases.test.js +0 -215
- package/dist/__tests__/edge-cases.test.js.map +0 -1
- package/dist/__tests__/fixtures/edge-cases.js +0 -137
- package/dist/__tests__/fixtures/edge-cases.js.map +0 -1
- package/dist/__tests__/fixtures/example-a-builtins.js +0 -100
- package/dist/__tests__/fixtures/example-a-builtins.js.map +0 -1
- package/dist/__tests__/fixtures/example-b-decorators.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-b-decorators.js +0 -5
- package/dist/__tests__/fixtures/example-b-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-b-extended.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-extended.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-b-extended.js +0 -60
- package/dist/__tests__/fixtures/example-b-extended.js.map +0 -1
- package/dist/__tests__/fixtures/example-c-custom.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-custom.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-c-custom.js +0 -61
- package/dist/__tests__/fixtures/example-c-custom.js.map +0 -1
- package/dist/__tests__/fixtures/example-c-decorators.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-c-decorators.js +0 -4
- package/dist/__tests__/fixtures/example-c-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts +0 -6
- package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-d-mixed-decorators.js +0 -75
- package/dist/__tests__/fixtures/example-d-mixed-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-e-decorators.d.ts +0 -11
- package/dist/__tests__/fixtures/example-e-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-e-decorators.js +0 -10
- package/dist/__tests__/fixtures/example-e-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-e-no-namespace.d.ts +0 -5
- package/dist/__tests__/fixtures/example-e-no-namespace.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-e-no-namespace.js +0 -61
- package/dist/__tests__/fixtures/example-e-no-namespace.js.map +0 -1
- package/dist/__tests__/fixtures/example-interface-types.js +0 -8
- package/dist/__tests__/fixtures/example-interface-types.js.map +0 -1
- package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts +0 -16
- package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-jsdoc-constraints.js +0 -98
- package/dist/__tests__/fixtures/example-jsdoc-constraints.js.map +0 -1
- package/dist/__tests__/fixtures/example-nested-class.d.ts +0 -45
- package/dist/__tests__/fixtures/example-nested-class.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-nested-class.js +0 -248
- package/dist/__tests__/fixtures/example-nested-class.js.map +0 -1
- package/dist/__tests__/fixtures/sample-forms.js +0 -78
- package/dist/__tests__/fixtures/sample-forms.js.map +0 -1
- package/dist/__tests__/generator.test.js +0 -234
- package/dist/__tests__/generator.test.js.map +0 -1
- package/dist/__tests__/integration.test.js +0 -161
- package/dist/__tests__/integration.test.js.map +0 -1
- package/dist/__tests__/interface-types.test.d.ts +0 -11
- package/dist/__tests__/interface-types.test.d.ts.map +0 -1
- package/dist/__tests__/interface-types.test.js +0 -404
- package/dist/__tests__/interface-types.test.js.map +0 -1
- package/dist/__tests__/jsdoc-constraints.test.js +0 -465
- package/dist/__tests__/jsdoc-constraints.test.js.map +0 -1
- package/dist/__tests__/write-schemas.test.js +0 -198
- package/dist/__tests__/write-schemas.test.js.map +0 -1
- package/dist/analyzer/class-analyzer.js +0 -377
- package/dist/analyzer/class-analyzer.js.map +0 -1
- package/dist/analyzer/decorator-extractor.d.ts +0 -78
- package/dist/analyzer/decorator-extractor.d.ts.map +0 -1
- package/dist/analyzer/decorator-extractor.js +0 -336
- package/dist/analyzer/decorator-extractor.js.map +0 -1
- package/dist/analyzer/jsdoc-constraints.js +0 -153
- package/dist/analyzer/jsdoc-constraints.js.map +0 -1
- package/dist/analyzer/program.js +0 -114
- package/dist/analyzer/program.js.map +0 -1
- package/dist/analyzer/type-converter.d.ts +0 -75
- package/dist/analyzer/type-converter.d.ts.map +0 -1
- package/dist/analyzer/type-converter.js +0 -474
- package/dist/analyzer/type-converter.js.map +0 -1
- package/dist/codegen/index.d.ts +0 -75
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/index.js +0 -597
- package/dist/codegen/index.js.map +0 -1
- package/dist/generators/class-schema.js +0 -140
- package/dist/generators/class-schema.js.map +0 -1
- package/dist/generators/method-schema.js +0 -108
- package/dist/generators/method-schema.js.map +0 -1
- package/dist/json-schema/generator.js +0 -166
- package/dist/json-schema/generator.js.map +0 -1
- package/dist/json-schema/types.js +0 -33
- package/dist/json-schema/types.js.map +0 -1
- package/dist/ui-schema/generator.js +0 -148
- package/dist/ui-schema/generator.js.map +0 -1
- package/dist/ui-schema/types.js +0 -8
- package/dist/ui-schema/types.js.map +0 -1
|
@@ -1,46 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class schema generator.
|
|
3
3
|
*
|
|
4
|
-
* Generates JSON Schema and
|
|
5
|
-
* class
|
|
4
|
+
* Generates JSON Schema 2020-12 and JSON Forms UI Schema from statically
|
|
5
|
+
* analyzed class/interface/type alias declarations, routing through the
|
|
6
|
+
* canonical FormIR pipeline.
|
|
6
7
|
*/
|
|
7
|
-
import type
|
|
8
|
-
import
|
|
9
|
-
import { type
|
|
10
|
-
import type
|
|
8
|
+
import type { UISchema } from "../ui-schema/types.js";
|
|
9
|
+
import { type IRClassAnalysis } from "../analyzer/class-analyzer.js";
|
|
10
|
+
import { type TSDocSource } from "../canonicalize/index.js";
|
|
11
|
+
import { type JsonSchema2020 } from "../json-schema/ir-generator.js";
|
|
11
12
|
/**
|
|
12
13
|
* Generated schemas for a class.
|
|
13
14
|
*/
|
|
14
15
|
export interface ClassSchemas {
|
|
15
|
-
/** JSON Schema for validation */
|
|
16
|
-
jsonSchema:
|
|
17
|
-
/**
|
|
18
|
-
uiSchema:
|
|
19
|
-
elements: FormSpecField[];
|
|
20
|
-
};
|
|
16
|
+
/** JSON Schema 2020-12 for validation */
|
|
17
|
+
jsonSchema: JsonSchema2020;
|
|
18
|
+
/** JSON Forms UI Schema for rendering */
|
|
19
|
+
uiSchema: UISchema;
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
|
-
* Generates JSON Schema and
|
|
22
|
+
* Generates JSON Schema 2020-12 and UI Schema from an IR class analysis.
|
|
24
23
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* Routes through the canonical IR pipeline:
|
|
25
|
+
* IRClassAnalysis → canonicalizeTSDoc → FormIR → JSON Schema / UI Schema
|
|
27
26
|
*
|
|
28
|
-
* @param analysis - The
|
|
29
|
-
* @param
|
|
30
|
-
* @returns Generated JSON Schema and
|
|
27
|
+
* @param analysis - The IR analysis result (from analyzeClassToIR, analyzeInterfaceToIR, or analyzeTypeAliasToIR)
|
|
28
|
+
* @param source - Optional source file metadata for provenance
|
|
29
|
+
* @returns Generated JSON Schema and UI Schema
|
|
31
30
|
*/
|
|
32
|
-
export declare function generateClassSchemas(analysis:
|
|
33
|
-
/**
|
|
34
|
-
* Generates JSON Schema for a single field.
|
|
35
|
-
*
|
|
36
|
-
* Useful for generating schemas for method return types
|
|
37
|
-
* or individual field extraction.
|
|
38
|
-
*
|
|
39
|
-
* @param field - The field information
|
|
40
|
-
* @param checker - TypeScript type checker
|
|
41
|
-
* @returns JSON Schema for the field's type
|
|
42
|
-
*/
|
|
43
|
-
export declare function generateFieldSchema(field: FieldInfo, checker: ts.TypeChecker): ExtendedJSONSchema7;
|
|
31
|
+
export declare function generateClassSchemas(analysis: IRClassAnalysis, source?: TSDocSource): ClassSchemas;
|
|
44
32
|
/**
|
|
45
33
|
* Options for generating schemas from a decorated class.
|
|
46
34
|
*/
|
|
@@ -54,18 +42,16 @@ export interface GenerateFromClassOptions {
|
|
|
54
42
|
* Result of generating schemas from a decorated class.
|
|
55
43
|
*/
|
|
56
44
|
export interface GenerateFromClassResult {
|
|
57
|
-
/** JSON Schema for validation */
|
|
58
|
-
jsonSchema:
|
|
59
|
-
/**
|
|
60
|
-
uiSchema:
|
|
61
|
-
elements: FormSpecField[];
|
|
62
|
-
};
|
|
45
|
+
/** JSON Schema 2020-12 for validation */
|
|
46
|
+
jsonSchema: JsonSchema2020;
|
|
47
|
+
/** JSON Forms UI Schema for rendering */
|
|
48
|
+
uiSchema: UISchema;
|
|
63
49
|
}
|
|
64
50
|
/**
|
|
65
|
-
* Generates JSON Schema and
|
|
51
|
+
* Generates JSON Schema and UI Schema from a decorated TypeScript class.
|
|
66
52
|
*
|
|
67
53
|
* This is a high-level entry point that handles the entire pipeline:
|
|
68
|
-
* creating a TypeScript program, finding the class, analyzing it,
|
|
54
|
+
* creating a TypeScript program, finding the class, analyzing it to IR,
|
|
69
55
|
* and generating schemas — all in one call.
|
|
70
56
|
*
|
|
71
57
|
* @example
|
|
@@ -78,7 +64,7 @@ export interface GenerateFromClassResult {
|
|
|
78
64
|
* ```
|
|
79
65
|
*
|
|
80
66
|
* @param options - File path, class name, and optional compiler options
|
|
81
|
-
* @returns Generated JSON Schema and
|
|
67
|
+
* @returns Generated JSON Schema and UI Schema
|
|
82
68
|
*/
|
|
83
69
|
export declare function generateSchemasFromClass(options: GenerateFromClassOptions): GenerateFromClassResult;
|
|
84
70
|
/**
|
|
@@ -91,20 +77,15 @@ export interface GenerateSchemasOptions {
|
|
|
91
77
|
typeName: string;
|
|
92
78
|
}
|
|
93
79
|
/**
|
|
94
|
-
* Generates JSON Schema and
|
|
80
|
+
* Generates JSON Schema and UI Schema from a named TypeScript
|
|
95
81
|
* type — a decorated class, an interface with TSDoc tags, or a type alias.
|
|
96
82
|
*
|
|
97
83
|
* This is the recommended entry point. It automatically detects whether
|
|
98
84
|
* the name resolves to a class, interface, or type alias and uses the
|
|
99
|
-
* appropriate analysis pipeline
|
|
100
|
-
*
|
|
101
|
-
* - **Classes**: extracts decorators and JSDoc constraints
|
|
102
|
-
* - **Interfaces**: extracts TSDoc tags (`@Field_displayName`, `@Minimum`, etc.)
|
|
103
|
-
* - **Type aliases**: object literal bodies analyzed like interfaces
|
|
85
|
+
* appropriate IR analysis pipeline.
|
|
104
86
|
*
|
|
105
87
|
* @example
|
|
106
88
|
* ```typescript
|
|
107
|
-
* // Works with both classes and interfaces — caller doesn't need to know
|
|
108
89
|
* const result = generateSchemas({
|
|
109
90
|
* filePath: "./src/config.ts",
|
|
110
91
|
* typeName: "DiscountConfig",
|
|
@@ -112,7 +93,7 @@ export interface GenerateSchemasOptions {
|
|
|
112
93
|
* ```
|
|
113
94
|
*
|
|
114
95
|
* @param options - File path and type name
|
|
115
|
-
* @returns Generated JSON Schema and
|
|
96
|
+
* @returns Generated JSON Schema and UI Schema
|
|
116
97
|
*/
|
|
117
98
|
export declare function generateSchemas(options: GenerateSchemasOptions): GenerateFromClassResult;
|
|
118
99
|
//# sourceMappingURL=class-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAOtD,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAG/F;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,YAAY,CAMd;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAUzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,uBAAuB,CA+BxF"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Method schema generator.
|
|
3
3
|
*
|
|
4
|
-
* Generates schemas for method parameters and return types
|
|
5
|
-
*
|
|
6
|
-
* - Parameters with regular types -> static type conversion
|
|
7
|
-
* - Return types -> static type conversion
|
|
4
|
+
* Generates schemas for method parameters and return types, routing through
|
|
5
|
+
* the canonical IR pipeline (TypeScript type → TypeNode → JSON Schema 2020-12).
|
|
8
6
|
*/
|
|
9
7
|
import type * as ts from "typescript";
|
|
10
8
|
import type { MethodInfo } from "../analyzer/class-analyzer.js";
|
|
11
|
-
import type
|
|
9
|
+
import { type JsonSchema2020 } from "../json-schema/ir-generator.js";
|
|
12
10
|
/**
|
|
13
11
|
* Runtime-loaded FormSpec schemas, compatible with the CLI's FormSpecSchemas type.
|
|
14
12
|
*/
|
|
@@ -29,14 +27,14 @@ export interface MethodSchemas {
|
|
|
29
27
|
/** Parameter schemas (from FormSpec or static analysis) */
|
|
30
28
|
params: MethodParamsSchemas | null;
|
|
31
29
|
/** Return type schema */
|
|
32
|
-
returnType:
|
|
30
|
+
returnType: JsonSchema2020;
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* Parameter schemas for a method.
|
|
36
34
|
*/
|
|
37
35
|
export interface MethodParamsSchemas {
|
|
38
36
|
/** JSON Schema for parameters */
|
|
39
|
-
jsonSchema:
|
|
37
|
+
jsonSchema: JsonSchema2020;
|
|
40
38
|
/** UI Schema / FormSpec for parameters (if available) */
|
|
41
39
|
uiSchema: object | null;
|
|
42
40
|
/** Name of the FormSpec export used (if any) */
|
|
@@ -47,7 +45,7 @@ export interface MethodParamsSchemas {
|
|
|
47
45
|
*
|
|
48
46
|
* If a parameter references a FormSpec via `InferSchema<typeof X>`,
|
|
49
47
|
* the schemas are taken from the loaded FormSpec at runtime.
|
|
50
|
-
* Otherwise, schemas are generated from static type analysis.
|
|
48
|
+
* Otherwise, schemas are generated from static type analysis via the IR.
|
|
51
49
|
*
|
|
52
50
|
* @param method - The method information from static analysis
|
|
53
51
|
* @param checker - TypeScript type checker
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-schema.d.ts","sourceRoot":"","sources":["../../src/generators/method-schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"method-schema.d.ts","sourceRoot":"","sources":["../../src/generators/method-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,+BAA+B,CAAC;AAG/E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAG/F;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,yBAAyB;IACzB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,UAAU,EAAE,cAAc,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gDAAgD;IAChD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AA4CD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAClD,aAAa,CAYf;AAmED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY5E"}
|