@formspec/build 0.1.0-alpha.11 → 0.1.0-alpha.13
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__/guards.test.d.ts +2 -0
- package/dist/__tests__/guards.test.d.ts.map +1 -0
- 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 +998 -309
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +10 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +996 -308
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +65 -150
- 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 +1455 -1656
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1459 -1647
- 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 +23 -38
- 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 +1391 -1614
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1403 -1610
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +1642 -824
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.d.ts +12 -3
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +1645 -820
- 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 +3 -3
- 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 -15
- 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/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 +5 -4
- 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.test.d.ts +0 -5
- package/dist/__tests__/analyzer.test.d.ts.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__/decorator-pipeline.test.d.ts +0 -11
- package/dist/__tests__/decorator-pipeline.test.d.ts.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-extended.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-extended.d.ts.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-decorators.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-decorators.d.ts.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-e-decorators.d.ts +0 -11
- package/dist/__tests__/fixtures/example-e-decorators.d.ts.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-jsdoc-constraints.d.ts +0 -16
- package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts.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__/interface-types.test.d.ts +0 -11
- package/dist/__tests__/interface-types.test.d.ts.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/type-converter.d.ts +0 -75
- package/dist/analyzer/type-converter.d.ts.map +0 -1
- package/dist/codegen/index.d.ts +0 -75
- package/dist/codegen/index.d.ts.map +0 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JSON Schema generator for FormSpec forms.
|
|
3
|
+
*
|
|
4
|
+
* Routes through the canonical IR pipeline: Chain DSL → FormIR → JSON Schema 2020-12.
|
|
3
5
|
*/
|
|
4
6
|
import type { FormElement, FormSpec } from "@formspec/core";
|
|
5
|
-
import type
|
|
7
|
+
import { type JsonSchema2020 } from "./ir-generator.js";
|
|
6
8
|
/**
|
|
7
|
-
* Generates a JSON Schema from a FormSpec.
|
|
9
|
+
* Generates a JSON Schema 2020-12 from a FormSpec.
|
|
10
|
+
*
|
|
11
|
+
* All generation routes through the canonical IR. The chain DSL is first
|
|
12
|
+
* canonicalized to a FormIR, then the IR-based generator produces the schema.
|
|
8
13
|
*
|
|
9
14
|
* @example
|
|
10
15
|
* ```typescript
|
|
@@ -15,7 +20,7 @@ import type { JSONSchema7 } from "./types.js";
|
|
|
15
20
|
*
|
|
16
21
|
* const schema = generateJsonSchema(form);
|
|
17
22
|
* // {
|
|
18
|
-
* // $schema: "https://json-schema.org/draft-
|
|
23
|
+
* // $schema: "https://json-schema.org/draft/2020-12/schema",
|
|
19
24
|
* // type: "object",
|
|
20
25
|
* // properties: {
|
|
21
26
|
* // name: { type: "string", title: "Name" },
|
|
@@ -26,7 +31,7 @@ import type { JSONSchema7 } from "./types.js";
|
|
|
26
31
|
* ```
|
|
27
32
|
*
|
|
28
33
|
* @param form - The FormSpec to convert
|
|
29
|
-
* @returns A JSON Schema object
|
|
34
|
+
* @returns A JSON Schema 2020-12 object
|
|
30
35
|
*/
|
|
31
|
-
export declare function generateJsonSchema<E extends readonly FormElement[]>(form: FormSpec<E>):
|
|
36
|
+
export declare function generateJsonSchema<E extends readonly FormElement[]>(form: FormSpec<E>): JsonSchema2020;
|
|
32
37
|
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/json-schema/generator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/json-schema/generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,WAAW,EAAE,EACjE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAChB,cAAc,CAGhB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema 2020-12 generator that consumes the canonical FormIR.
|
|
3
|
+
*
|
|
4
|
+
* This generator is a pure function of the IR. It never consults the TypeScript
|
|
5
|
+
* AST or surface syntax directly — only the IR (per the JSON Schema vocabulary spec §1.2).
|
|
6
|
+
*
|
|
7
|
+
* @see https://json-schema.org/draft/2020-12/schema
|
|
8
|
+
* @see https://json-schema.org/draft/2020-12/schema
|
|
9
|
+
*/
|
|
10
|
+
import type { FormIR } from "@formspec/core";
|
|
11
|
+
/**
|
|
12
|
+
* A JSON Schema 2020-12 document, sub-schema, or keyword collection.
|
|
13
|
+
*
|
|
14
|
+
* This interface covers the subset of JSON Schema 2020-12 that this generator
|
|
15
|
+
* emits, plus an index signature for custom `x-formspec-*` extension keywords.
|
|
16
|
+
*/
|
|
17
|
+
export interface JsonSchema2020 {
|
|
18
|
+
$schema?: string;
|
|
19
|
+
$ref?: string;
|
|
20
|
+
$defs?: Record<string, JsonSchema2020>;
|
|
21
|
+
type?: string;
|
|
22
|
+
properties?: Record<string, JsonSchema2020>;
|
|
23
|
+
required?: string[];
|
|
24
|
+
items?: JsonSchema2020;
|
|
25
|
+
additionalProperties?: boolean;
|
|
26
|
+
enum?: readonly (string | number)[];
|
|
27
|
+
const?: string | number | boolean | null;
|
|
28
|
+
oneOf?: readonly JsonSchema2020[];
|
|
29
|
+
anyOf?: readonly JsonSchema2020[];
|
|
30
|
+
minimum?: number;
|
|
31
|
+
maximum?: number;
|
|
32
|
+
exclusiveMinimum?: number;
|
|
33
|
+
exclusiveMaximum?: number;
|
|
34
|
+
multipleOf?: number;
|
|
35
|
+
minLength?: number;
|
|
36
|
+
maxLength?: number;
|
|
37
|
+
minItems?: number;
|
|
38
|
+
maxItems?: number;
|
|
39
|
+
pattern?: string;
|
|
40
|
+
uniqueItems?: boolean;
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
default?: unknown;
|
|
44
|
+
deprecated?: boolean;
|
|
45
|
+
[key: `x-${string}`]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generates a JSON Schema 2020-12 object from a canonical FormIR.
|
|
49
|
+
*
|
|
50
|
+
* Groups and conditionals are flattened — they influence UI layout but do not
|
|
51
|
+
* affect the data schema. All fields appear at the level they would occupy in
|
|
52
|
+
* the output data.
|
|
53
|
+
*
|
|
54
|
+
* Named types in the `typeRegistry` are emitted as `$defs` entries and
|
|
55
|
+
* referenced via `$ref` (per PP7 — high-fidelity output).
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { canonicalizeDSL } from "./canonicalize/index.js";
|
|
60
|
+
* import { generateJsonSchemaFromIR } from "./json-schema/ir-generator.js";
|
|
61
|
+
* import { formspec, field } from "@formspec/dsl";
|
|
62
|
+
*
|
|
63
|
+
* const form = formspec(
|
|
64
|
+
* field.text("name", { label: "Name", required: true }),
|
|
65
|
+
* field.number("age", { min: 0 }),
|
|
66
|
+
* );
|
|
67
|
+
* const ir = canonicalizeDSL(form);
|
|
68
|
+
* const schema = generateJsonSchemaFromIR(ir);
|
|
69
|
+
* // {
|
|
70
|
+
* // $schema: "https://json-schema.org/draft/2020-12/schema",
|
|
71
|
+
* // type: "object",
|
|
72
|
+
* // properties: {
|
|
73
|
+
* // name: { type: "string", title: "Name" },
|
|
74
|
+
* // age: { type: "number", minimum: 0 }
|
|
75
|
+
* // },
|
|
76
|
+
* // required: ["name"]
|
|
77
|
+
* // }
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param ir - The canonical FormIR produced by a canonicalizer
|
|
81
|
+
* @returns A plain JSON-serializable JSON Schema 2020-12 object
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateJsonSchemaFromIR(ir: FormIR): JsonSchema2020;
|
|
84
|
+
//# sourceMappingURL=ir-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../../src/json-schema/ir-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,MAAM,EAeP,MAAM,gBAAgB,CAAC;AAMxB;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACzC,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAElC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IAGrB,CAAC,GAAG,EAAE,KAAK,MAAM,EAAE,GAAG,OAAO,CAAC;CAC/B;AAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CA8BnE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Zod schemas for JSON Schema
|
|
2
|
+
* Zod schemas for JSON Schema output validation.
|
|
3
3
|
*
|
|
4
|
-
* These schemas cover the subset of JSON Schema
|
|
4
|
+
* These schemas cover the subset of JSON Schema that FormSpec generates,
|
|
5
5
|
* plus the FormSpec-specific `x-formspec-*` extension properties.
|
|
6
6
|
*
|
|
7
|
-
* @see https://json-schema.org/draft-
|
|
7
|
+
* @see https://json-schema.org/draft/2020-12/schema
|
|
8
8
|
*/
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import type { JSONSchema7 } from "./types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* JSON Schema
|
|
2
|
+
* JSON Schema type definitions.
|
|
3
3
|
*
|
|
4
4
|
* These types are a subset of JSON Schema sufficient for form generation.
|
|
5
5
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
10
10
|
/**
|
|
11
|
-
* A JSON Schema definition (
|
|
11
|
+
* A JSON Schema definition (legacy subset used by Zod validator and types.ts).
|
|
12
12
|
*/
|
|
13
13
|
export interface JSONSchema7 {
|
|
14
14
|
$schema?: string;
|
|
@@ -73,16 +73,15 @@ export type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;
|
|
|
73
73
|
* @param key - Extension key (must start with `x-formspec-`)
|
|
74
74
|
* @param value - Extension value
|
|
75
75
|
*/
|
|
76
|
-
export declare function setSchemaExtension(schema:
|
|
76
|
+
export declare function setSchemaExtension(schema: object, key: `x-formspec-${string}`, value: unknown): void;
|
|
77
77
|
/**
|
|
78
78
|
* Reads a FormSpec extension property from a JSON Schema node.
|
|
79
79
|
*
|
|
80
|
-
*
|
|
81
|
-
* including nested schemas typed as `JSONSchema7`.
|
|
80
|
+
* Accepts any schema object — `JSONSchema7`, `JsonSchema2020`, `ExtendedJSONSchema7`, etc.
|
|
82
81
|
*
|
|
83
82
|
* @param schema - Any JSON Schema node
|
|
84
83
|
* @param key - Extension key (must start with `x-formspec-`)
|
|
85
84
|
* @returns The extension value, or `undefined` if not present
|
|
86
85
|
*/
|
|
87
|
-
export declare function getSchemaExtension(schema:
|
|
86
|
+
export declare function getSchemaExtension(schema: object, key: `x-formspec-${string}`): unknown;
|
|
88
87
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/json-schema/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAA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F;AACtF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,wBAAwB,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,cAAc,MAAM,EAAE,EAC3B,KAAK,EAAE,OAAO,GACb,IAAI,CAEN;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,MAAM,EAAE,GAAG,OAAO,CAEvF"}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JSON Forms UI Schema generator for FormSpec forms.
|
|
3
|
+
*
|
|
4
|
+
* Routes through the canonical IR pipeline: Chain DSL → FormIR → UI Schema.
|
|
3
5
|
*/
|
|
4
6
|
import type { FormElement, FormSpec } from "@formspec/core";
|
|
5
7
|
import type { UISchema } from "./types.js";
|
|
6
|
-
import type { FormSpecField } from "../analyzer/type-converter.js";
|
|
7
|
-
/**
|
|
8
|
-
* Converts FormSpecField[] (from decorator/interface/type analysis) to a JSON Forms UISchema.
|
|
9
|
-
*
|
|
10
|
-
* Mapping:
|
|
11
|
-
* - Each field → `{ type: "Control", scope: "#/properties/{id}", label? }`
|
|
12
|
-
* - `showWhen: { field, value }` → rule with SHOW effect
|
|
13
|
-
* - `group` property → Groups fields by group name, preserving insertion order
|
|
14
|
-
* - `fields` (nested object) → single Control pointing to the object property
|
|
15
|
-
* - Root wrapper → `{ type: "VerticalLayout", elements }`
|
|
16
|
-
*
|
|
17
|
-
* @param fields - The FormSpecField array to convert
|
|
18
|
-
* @returns A JSON Forms UISchema
|
|
19
|
-
*/
|
|
20
|
-
export declare function generateUiSchemaFromFields(fields: FormSpecField[]): UISchema;
|
|
21
8
|
/**
|
|
22
9
|
* Generates a JSON Forms UI Schema from a FormSpec.
|
|
23
10
|
*
|
|
11
|
+
* All generation routes through the canonical IR. The chain DSL is first
|
|
12
|
+
* canonicalized to a FormIR, then the IR-based generator produces the schema.
|
|
13
|
+
*
|
|
24
14
|
* @example
|
|
25
15
|
* ```typescript
|
|
26
16
|
* const form = formspec(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/ui-schema/generator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/ui-schema/generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAG9F"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Forms UI Schema generator that operates on the canonical FormIR.
|
|
3
|
+
*
|
|
4
|
+
* This generator consumes the IR produced by the Canonicalize phase and
|
|
5
|
+
* produces a JSON Forms UI Schema. All downstream UI Schema generation
|
|
6
|
+
* should use this module for UI Schema generation.
|
|
7
|
+
*/
|
|
8
|
+
import type { FormIR } from "@formspec/core";
|
|
9
|
+
import type { UISchema } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Generates a JSON Forms UI Schema from a canonical `FormIR`.
|
|
12
|
+
*
|
|
13
|
+
* Mapping rules:
|
|
14
|
+
* - `FieldNode` → `ControlElement` with `scope: "#/properties/<name>"`
|
|
15
|
+
* - `displayName` annotation → `label` on the `ControlElement`
|
|
16
|
+
* - `GroupLayoutNode` → `GroupLayout` with recursively converted `elements`
|
|
17
|
+
* - `ConditionalLayoutNode` → children flattened with a `SHOW` rule
|
|
18
|
+
* - Nested conditionals → combined `allOf` rule
|
|
19
|
+
* - Root wrapper is always `{ type: "VerticalLayout", elements: [...] }`
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const ir = canonicalizeDSL(
|
|
24
|
+
* formspec(
|
|
25
|
+
* group("Customer", field.text("name", { label: "Name" })),
|
|
26
|
+
* when(is("status", "draft"), field.text("notes", { label: "Notes" })),
|
|
27
|
+
* )
|
|
28
|
+
* );
|
|
29
|
+
*
|
|
30
|
+
* const uiSchema = generateUiSchemaFromIR(ir);
|
|
31
|
+
* // {
|
|
32
|
+
* // type: "VerticalLayout",
|
|
33
|
+
* // elements: [
|
|
34
|
+
* // {
|
|
35
|
+
* // type: "Group",
|
|
36
|
+
* // label: "Customer",
|
|
37
|
+
* // elements: [{ type: "Control", scope: "#/properties/name", label: "Name" }]
|
|
38
|
+
* // },
|
|
39
|
+
* // {
|
|
40
|
+
* // type: "Control",
|
|
41
|
+
* // scope: "#/properties/notes",
|
|
42
|
+
* // label: "Notes",
|
|
43
|
+
* // rule: { effect: "SHOW", condition: { scope: "#/properties/status", schema: { const: "draft" } } }
|
|
44
|
+
* // }
|
|
45
|
+
* // ]
|
|
46
|
+
* // }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param ir - The canonical FormIR produced by the Canonicalize phase
|
|
50
|
+
* @returns A validated JSON Forms UI Schema
|
|
51
|
+
*/
|
|
52
|
+
export declare function generateUiSchemaFromIR(ir: FormIR): UISchema;
|
|
53
|
+
//# sourceMappingURL=ir-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../../src/ui-schema/ir-generator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAA6C,MAAM,gBAAgB,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAsD,MAAM,YAAY,CAAC;AA2K/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAO3D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constraint validator for the FormSpec IR.
|
|
3
|
+
*
|
|
4
|
+
* Performs the Validate pipeline phase:
|
|
5
|
+
* - Contradiction detection between paired constraints
|
|
6
|
+
* - Type applicability checks (e.g. numeric constraints on string fields)
|
|
7
|
+
* - Custom constraint type applicability (when extension registry is provided)
|
|
8
|
+
* - Unknown extension warnings (when a registry is provided)
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import type { FormIR, Provenance } from "@formspec/core";
|
|
13
|
+
import type { ExtensionRegistry } from "../extensions/index.js";
|
|
14
|
+
/**
|
|
15
|
+
* A structured diagnostic produced by constraint validation.
|
|
16
|
+
*
|
|
17
|
+
* The `code` follows the format: `{VENDOR}-{CATEGORY}-{NNN}`.
|
|
18
|
+
* - VENDOR defaults to "FORMSPEC" (configurable via `vendorPrefix`).
|
|
19
|
+
* - Categories: CONTRADICTION, TYPE_MISMATCH, UNKNOWN_EXTENSION
|
|
20
|
+
*/
|
|
21
|
+
export interface ValidationDiagnostic {
|
|
22
|
+
readonly code: string;
|
|
23
|
+
readonly message: string;
|
|
24
|
+
readonly severity: "error" | "warning";
|
|
25
|
+
/** Location of the primary constraint involved in the violation. */
|
|
26
|
+
readonly primaryLocation: Provenance;
|
|
27
|
+
/** Related locations (e.g., the other side of a contradiction pair). */
|
|
28
|
+
readonly relatedLocations: readonly Provenance[];
|
|
29
|
+
}
|
|
30
|
+
/** Result of validating a {@link FormIR}. */
|
|
31
|
+
export interface ValidationResult {
|
|
32
|
+
readonly diagnostics: readonly ValidationDiagnostic[];
|
|
33
|
+
/** `true` if there are no error-severity diagnostics (warnings are OK). */
|
|
34
|
+
readonly valid: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** Options for constraint validation. */
|
|
37
|
+
export interface ValidateIROptions {
|
|
38
|
+
/**
|
|
39
|
+
* Vendor prefix used when constructing diagnostic codes.
|
|
40
|
+
* @defaultValue "FORMSPEC"
|
|
41
|
+
*/
|
|
42
|
+
readonly vendorPrefix?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Extension registry for resolving custom constraint type applicability.
|
|
45
|
+
* When provided, custom constraints with `applicableTypes` will be
|
|
46
|
+
* validated against the field's type node kind. Custom constraints
|
|
47
|
+
* whose IDs are absent from this registry emit a WARNING (UNKNOWN_EXTENSION).
|
|
48
|
+
* When omitted, custom constraints are silently skipped.
|
|
49
|
+
*/
|
|
50
|
+
readonly extensionRegistry?: ExtensionRegistry;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validate all constraints in a {@link FormIR}.
|
|
54
|
+
*
|
|
55
|
+
* Checks for:
|
|
56
|
+
* - Contradictions between paired constraints (e.g. `minimum > maximum`)
|
|
57
|
+
* - Type applicability violations (e.g. `minLength` on a number field)
|
|
58
|
+
* - Custom constraint type applicability (via extension registry)
|
|
59
|
+
* - Unknown extension constraints (when `extensionRegistry` is provided)
|
|
60
|
+
*
|
|
61
|
+
* @param ir - The form IR to validate.
|
|
62
|
+
* @param options - Optional configuration.
|
|
63
|
+
* @returns A {@link ValidationResult} with diagnostics and a `valid` flag.
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateIR(ir: FormIR, options?: ValidateIROptions): ValidationResult;
|
|
66
|
+
//# sourceMappingURL=constraint-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraint-validator.d.ts","sourceRoot":"","sources":["../../src/validate/constraint-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,MAAM,EAQN,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAMhE;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,gBAAgB,EAAE,SAAS,UAAU,EAAE,CAAC;CAClD;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtD,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CAChD;AA2bD;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAepF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constraint validation for the FormSpec IR.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { validateIR } from "./constraint-validator.js";
|
|
7
|
+
export type { ValidationDiagnostic, ValidationResult, ValidateIROptions, } from "./constraint-validator.js";
|
|
8
|
+
export type { ExtensionRegistry } from "../extensions/index.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formspec/build",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.13",
|
|
4
4
|
"description": "Build tools to compile FormSpec forms to JSON Schema and UI Schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -31,16 +31,17 @@
|
|
|
31
31
|
"README.md"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@microsoft/tsdoc": "^0.16.0",
|
|
35
|
+
"@microsoft/tsdoc-config": "^0.18.1",
|
|
34
36
|
"zod": "^3.25.0",
|
|
35
|
-
"@formspec/core": "0.1.0-alpha.
|
|
37
|
+
"@formspec/core": "0.1.0-alpha.13"
|
|
36
38
|
},
|
|
37
39
|
"peerDependencies": {
|
|
38
40
|
"typescript": "^5.0.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
43
|
"vitest": "^3.0.0",
|
|
42
|
-
"@formspec/
|
|
43
|
-
"@formspec/dsl": "0.1.0-alpha.11"
|
|
44
|
+
"@formspec/dsl": "0.1.0-alpha.13"
|
|
44
45
|
},
|
|
45
46
|
"publishConfig": {
|
|
46
47
|
"access": "public"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Edge case and negative tests for analysis and generation components.
|
|
3
|
-
*
|
|
4
|
-
* Tests cover:
|
|
5
|
-
* - Complex union types
|
|
6
|
-
* - Nullable and optional patterns
|
|
7
|
-
* - Array edge cases
|
|
8
|
-
* - Object edge cases
|
|
9
|
-
* - Decorator extractor edge cases
|
|
10
|
-
* - Program context error handling
|
|
11
|
-
*/
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=analyzer-edge-cases.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer-edge-cases.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/analyzer-edge-cases.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/analyzer.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/codegen.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration tests for the decorated class -> static analysis -> JSON Schema pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Tests the full pipeline: decorated TypeScript class -> analyzeClass -> generateClassSchemas
|
|
5
|
-
* -> JSON Schema + UI Schema output, including extended and custom decorator support.
|
|
6
|
-
*
|
|
7
|
-
* @see packages/decorators/src/index.ts for decorator definitions
|
|
8
|
-
* @see packages/build/src/analyzer/decorator-extractor.ts for brand resolution
|
|
9
|
-
*/
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=decorator-pipeline.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator-pipeline.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/decorator-pipeline.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { FieldOptions } from "@formspec/decorators";
|
|
2
|
-
export declare const CustomField: ((_args: FieldOptions) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Field">;
|
|
3
|
-
export declare const Floor: ((_args: number) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Minimum">;
|
|
4
|
-
export declare const Ceiling: ((_args: number) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Maximum">;
|
|
5
|
-
//# sourceMappingURL=example-b-decorators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-b-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-decorators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,WAAW,2JAA2D,CAAC;AACpF,eAAO,MAAM,KAAK,uJAAiD,CAAC;AACpE,eAAO,MAAM,OAAO,uJAAmD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-b-extended.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-extended.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IAIvB,MAAM,EAAG,MAAM,CAAC;IAGhB,KAAK,EAAG,MAAM,CAAC;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-c-custom.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-c-custom.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAGvB,OAAO,EAAG,MAAM,CAAC;IAKjB,OAAO,EAAG,MAAM,CAAC;CAClB"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const Title: ((value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecMarkerBrand & import("@formspec/decorators").FormSpecExtensionBrand<"title-field">;
|
|
2
|
-
export declare const Priority: ((_args: {
|
|
3
|
-
level: string;
|
|
4
|
-
}) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtensionBrand<"priority">;
|
|
5
|
-
//# sourceMappingURL=example-c-decorators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-c-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-c-decorators.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,+LAAiD,CAAC;AACpE,eAAO,MAAM,QAAQ;WAA2C,MAAM;0IAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-d-mixed-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-d-mixed-decorators.ts"],"names":[],"mappings":"AAYA,qBAAa,YAAY;IAGvB,QAAQ,EAAG,MAAM,CAAC;IAIlB,KAAK,EAAG,MAAM,CAAC;IAGf,KAAK,EAAG,MAAM,CAAC;CAChB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom decorator created without an extension namespace.
|
|
3
|
-
* The `customDecorator()` no-arg overload produces decorators
|
|
4
|
-
* that are recognized as FormSpec but have no extensionName,
|
|
5
|
-
* so no x-formspec-* keys should be emitted.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Highlight: ((value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecMarkerBrand;
|
|
8
|
-
export declare const Metadata: (_args: {
|
|
9
|
-
key: string;
|
|
10
|
-
}) => (value: undefined, context: ClassFieldDecoratorContext) => void;
|
|
11
|
-
//# sourceMappingURL=example-e-decorators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-e-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-e-decorators.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,wHAAwC,CAAC;AAC/D,eAAO,MAAM,QAAQ;SAA+B,MAAM;qEAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-e-no-namespace.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-e-no-namespace.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAGvB,KAAK,EAAG,MAAM,CAAC;IAIf,KAAK,EAAG,MAAM,CAAC;CAChB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare class JSDocConstraintsForm {
|
|
2
|
-
/** @MinLength 1 @MaxLength 200 */
|
|
3
|
-
name: string;
|
|
4
|
-
/** @Minimum 0 @Maximum 150 */
|
|
5
|
-
age: number;
|
|
6
|
-
/** @Minimum 0.01 @Maximum 1000 */
|
|
7
|
-
weight: number;
|
|
8
|
-
/** @Minimum -273.15 */
|
|
9
|
-
temperature: number;
|
|
10
|
-
/** @Pattern ^[A-Z]{3}-\d{4}$ */
|
|
11
|
-
sku: string;
|
|
12
|
-
/** @ExclusiveMaximum 10000 */
|
|
13
|
-
stock: number;
|
|
14
|
-
notes?: string;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=example-jsdoc-constraints.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-jsdoc-constraints.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-jsdoc-constraints.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAC/B,kCAAkC;IAElC,IAAI,EAAG,MAAM,CAAC;IAEd,8BAA8B;IAE9B,GAAG,EAAG,MAAM,CAAC;IAEb,kCAAkC;IAElC,MAAM,EAAG,MAAM,CAAC;IAEhB,uBAAuB;IAEvB,WAAW,EAAG,MAAM,CAAC;IAErB,gCAAgC;IAEhC,GAAG,EAAG,MAAM,CAAC;IAGb,8BAA8B;IAG9B,KAAK,EAAG,MAAM,CAAC;IAIf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export declare class Address {
|
|
2
|
-
street: string;
|
|
3
|
-
city: string;
|
|
4
|
-
zip?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class Dimensions {
|
|
7
|
-
/** @Minimum 0 @Maximum 10000 */
|
|
8
|
-
width: number;
|
|
9
|
-
/** @Minimum 0 @Maximum 10000 */
|
|
10
|
-
height: number;
|
|
11
|
-
/** @Minimum 0 */
|
|
12
|
-
depth: number;
|
|
13
|
-
}
|
|
14
|
-
export declare class UserWithAddress {
|
|
15
|
-
username: string;
|
|
16
|
-
address: Address;
|
|
17
|
-
}
|
|
18
|
-
export declare class ProductWithDimensions {
|
|
19
|
-
name: string;
|
|
20
|
-
dimensions: Dimensions;
|
|
21
|
-
}
|
|
22
|
-
export declare class Customer {
|
|
23
|
-
name: string;
|
|
24
|
-
address: Address;
|
|
25
|
-
}
|
|
26
|
-
export declare class Order {
|
|
27
|
-
orderId: string;
|
|
28
|
-
customer: Customer;
|
|
29
|
-
}
|
|
30
|
-
export declare class NodeA {
|
|
31
|
-
name: string;
|
|
32
|
-
sibling?: NodeB;
|
|
33
|
-
}
|
|
34
|
-
export declare class NodeB {
|
|
35
|
-
label: string;
|
|
36
|
-
sibling?: NodeA;
|
|
37
|
-
}
|
|
38
|
-
export declare class WithInlineObject {
|
|
39
|
-
title: string;
|
|
40
|
-
metadata: {
|
|
41
|
-
key: string;
|
|
42
|
-
value: string;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=example-nested-class.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-nested-class.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-nested-class.ts"],"names":[],"mappings":"AAIA,qBAAa,OAAO;IAIlB,MAAM,EAAG,MAAM,CAAC;IAIhB,IAAI,EAAG,MAAM,CAAC;IAId,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,UAAU;IACrB,gCAAgC;IAEhC,KAAK,EAAG,MAAM,CAAC;IAEf,gCAAgC;IAEhC,MAAM,EAAG,MAAM,CAAC;IAEhB,iBAAiB;IAEjB,KAAK,EAAG,MAAM,CAAC;CAChB;AAID,qBAAa,eAAe;IAG1B,QAAQ,EAAG,MAAM,CAAC;IAGlB,OAAO,EAAG,OAAO,CAAC;CACnB;AAED,qBAAa,qBAAqB;IAEhC,IAAI,EAAG,MAAM,CAAC;IAGd,UAAU,EAAG,UAAU,CAAC;CACzB;AAID,qBAAa,QAAQ;IAGnB,IAAI,EAAG,MAAM,CAAC;IAGd,OAAO,EAAG,OAAO,CAAC;CACnB;AAED,qBAAa,KAAK;IAEhB,OAAO,EAAG,MAAM,CAAC;IAGjB,QAAQ,EAAG,QAAQ,CAAC;CACrB;AAID,qBAAa,KAAK;IAGhB,IAAI,EAAG,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,qBAAa,KAAK;IAEhB,KAAK,EAAG,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAID,qBAAa,gBAAgB;IAE3B,KAAK,EAAG,MAAM,CAAC;IAEf,QAAQ,EAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for interface and type alias schema generation.
|
|
3
|
-
*
|
|
4
|
-
* Covers the `generateSchemas` unified entry point, `analyzeInterface`,
|
|
5
|
-
* `analyzeTypeAlias`, `extractJSDocFieldMetadata`, `@EnumOptions` JSON
|
|
6
|
-
* parsing, nested type propagation, and error paths.
|
|
7
|
-
*
|
|
8
|
-
* @see https://json-schema.org/understanding-json-schema
|
|
9
|
-
*/
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=interface-types.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface-types.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/interface-types.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|