schema-components 1.18.0 → 1.19.0
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/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +77 -14
- package/dist/core/constraints.d.mts +1 -1
- package/dist/core/diagnostics.d.mts +1 -1
- package/dist/core/errors.d.mts +1 -1
- package/dist/core/errors.mjs +7 -1
- package/dist/core/fieldOrder.d.mts +10 -0
- package/dist/core/fieldOrder.mjs +12 -0
- package/dist/core/formats.mjs +9 -1
- package/dist/core/merge.d.mts +1 -1
- package/dist/core/merge.mjs +30 -2
- package/dist/core/normalise.d.mts +38 -5
- package/dist/core/normalise.mjs +2 -2
- package/dist/core/openapi30.d.mts +33 -4
- package/dist/core/openapi30.mjs +2 -2
- package/dist/core/ref.d.mts +1 -1
- package/dist/core/renderer.d.mts +1 -1
- package/dist/core/renderer.mjs +7 -21
- package/dist/core/swagger2.d.mts +1 -1
- package/dist/core/swagger2.mjs +1 -1
- package/dist/core/version.d.mts +2 -2
- package/dist/core/version.mjs +19 -9
- package/dist/core/walkBuilders.d.mts +2 -2
- package/dist/{diagnostics-BYk63jsC.d.mts → diagnostics-VgEKI_Ct.d.mts} +1 -1
- package/dist/{errors-C5zRC2PU.d.mts → errors-CnGjT1cg.d.mts} +7 -2
- package/dist/html/a11y.d.mts +1 -1
- package/dist/html/renderToHtml.d.mts +1 -1
- package/dist/html/renderToHtml.mjs +13 -30
- package/dist/html/renderToHtmlStream.d.mts +1 -1
- package/dist/html/renderers.d.mts +1 -1
- package/dist/html/renderers.mjs +56 -23
- package/dist/html/streamRenderers.d.mts +1 -1
- package/dist/html/streamRenderers.mjs +10 -21
- package/dist/{normalise-tL9FckAk.mjs → normalise-C0ofw3W6.mjs} +418 -97
- package/dist/openapi/ApiSecurity.mjs +1 -1
- package/dist/openapi/bundle.mjs +1 -0
- package/dist/openapi/components.mjs +6 -2
- package/dist/openapi/parser.d.mts +2 -2
- package/dist/openapi/parser.mjs +8 -5
- package/dist/openapi/resolve.d.mts +6 -5
- package/dist/openapi/resolve.mjs +7 -6
- package/dist/react/SchemaComponent.d.mts +4 -4
- package/dist/react/SchemaComponent.mjs +4 -14
- package/dist/react/SchemaView.d.mts +2 -2
- package/dist/react/SchemaView.mjs +2 -1
- package/dist/react/headless.d.mts +7 -1
- package/dist/react/headless.mjs +13 -1
- package/dist/react/headlessRenderers.d.mts +53 -2
- package/dist/react/headlessRenderers.mjs +175 -33
- package/dist/{ref-Ckt5liZs.d.mts → ref-Bb43ZURY.d.mts} +1 -1
- package/dist/{renderer-DXo-rXHJ.d.mts → renderer-BQqiXUYP.d.mts} +15 -32
- package/dist/themes/mantine.d.mts +1 -1
- package/dist/themes/mantine.mjs +2 -1
- package/dist/themes/mui.d.mts +1 -1
- package/dist/themes/mui.mjs +3 -2
- package/dist/themes/radix.d.mts +1 -1
- package/dist/themes/radix.mjs +2 -1
- package/dist/themes/shadcn.d.mts +1 -1
- package/dist/themes/shadcn.mjs +2 -1
- package/dist/{version-B5NV-35j.d.mts → version-XNH7PRGP.d.mts} +8 -1
- package/package.json +1 -1
package/dist/core/adapter.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as SchemaMeta, m as JsonObject } from "../types-D_5ST7SS.mjs";
|
|
2
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
2
|
+
import { i as DiagnosticsOptions } from "../diagnostics-VgEKI_Ct.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/adapter.d.ts
|
|
5
5
|
type SchemaInput = Record<string, unknown>;
|
package/dist/core/adapter.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getProperty, hasProperty, isObject } from "./guards.mjs";
|
|
2
|
+
import { SchemaNormalisationError } from "./errors.mjs";
|
|
2
3
|
import { emitDiagnostic } from "./diagnostics.mjs";
|
|
3
4
|
import { dereference } from "./ref.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { detectOpenApiVersion, inferJsonSchemaDraftWithReason, isSwagger2, matchJsonSchemaDraftUri } from "./version.mjs";
|
|
6
|
+
import { a as normaliseOpenApiSchemas, i as normaliseJsonSchema$1 } from "../normalise-C0ofw3W6.mjs";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
//#region src/core/adapter.ts
|
|
8
9
|
/**
|
|
@@ -30,9 +31,55 @@ function detectSchemaKind(input) {
|
|
|
30
31
|
* but TypeScript cannot represent "has _zod.def" as the $ZodType parameter
|
|
31
32
|
* that z.toJSONSchema expects. This is the library boundary equivalent of
|
|
32
33
|
* object → Record<string, unknown> — the type mismatch is genuinely unavoidable.
|
|
34
|
+
*
|
|
35
|
+
* Any exception thrown by z.toJSONSchema is classified into a
|
|
36
|
+
* SchemaNormalisationError so the caller does not have to re-parse error
|
|
37
|
+
* message strings. The classification covers:
|
|
38
|
+
*
|
|
39
|
+
* - Nested Zod 3 schemas inside a Zod 4 tree (which surface as
|
|
40
|
+
* "Cannot read properties of undefined (reading 'def')") → zod3-unsupported
|
|
41
|
+
* - Transforms ("Transforms cannot be represented") → zod-transform-unsupported
|
|
42
|
+
* - Unrepresentable types ("BigInt cannot be represented", "Date cannot be
|
|
43
|
+
* represented", etc.) → zod-type-unrepresentable
|
|
44
|
+
* - Anything else → zod-conversion-failed
|
|
33
45
|
*/
|
|
34
46
|
function callToJsonSchema(schema) {
|
|
35
|
-
|
|
47
|
+
try {
|
|
48
|
+
return z.toJSONSchema(schema);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
throw classifyZodConversionError(err, schema);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Error messages emitted by Zod 4's z.toJSONSchema for unrepresentable types.
|
|
55
|
+
* Mapping is exact-prefix on the message and the corresponding Zod type name
|
|
56
|
+
* surfaced to the consumer via SchemaNormalisationError.zodType.
|
|
57
|
+
*
|
|
58
|
+
* Source: zod/src/v4/core/to-json-schema.ts ("cannot be represented" messages).
|
|
59
|
+
*/
|
|
60
|
+
const UNREPRESENTABLE_ZOD_TYPES = [
|
|
61
|
+
["BigInt cannot be represented", "bigint"],
|
|
62
|
+
["Date cannot be represented", "date"],
|
|
63
|
+
["Map cannot be represented", "map"],
|
|
64
|
+
["Set cannot be represented", "set"],
|
|
65
|
+
["Symbols cannot be represented", "symbol"],
|
|
66
|
+
["Function types cannot be represented", "function"],
|
|
67
|
+
["Undefined cannot be represented", "undefined"],
|
|
68
|
+
["Void cannot be represented", "void"],
|
|
69
|
+
["NaN cannot be represented", "nan"]
|
|
70
|
+
];
|
|
71
|
+
/**
|
|
72
|
+
* The cryptic error produced when z.toJSONSchema encounters a nested Zod 3
|
|
73
|
+
* schema (one without `_zod.def`). Reproduced verbatim from Node's TypeError
|
|
74
|
+
* for property access on undefined.
|
|
75
|
+
*/
|
|
76
|
+
const NESTED_ZOD3_MARKER = "Cannot read properties of undefined";
|
|
77
|
+
function classifyZodConversionError(err, schema) {
|
|
78
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
79
|
+
if (message.includes(NESTED_ZOD3_MARKER)) return new SchemaNormalisationError("A nested Zod 3 schema was found inside a Zod 4 schema. schema-components requires Zod 4 throughout the schema tree. See the Zod 4 migration guide at https://zod.dev/v4/migration or run: pnpm add zod@^4", schema, "zod3-unsupported");
|
|
80
|
+
if (message.includes("Transforms cannot be represented")) return new SchemaNormalisationError("Zod transforms cannot be represented in JSON Schema. Remove the .transform() call, or pre-transform the input before passing it to the component.", schema, "zod-transform-unsupported");
|
|
81
|
+
for (const [prefix, typeName] of UNREPRESENTABLE_ZOD_TYPES) if (message.includes(prefix)) return new SchemaNormalisationError(`Zod type ${typeName} cannot be represented in JSON Schema and is not supported by schema-components. Original message: ${message}`, schema, "zod-type-unrepresentable", typeName);
|
|
82
|
+
return new SchemaNormalisationError(`z.toJSONSchema() failed: ${message}`, schema, "zod-conversion-failed");
|
|
36
83
|
}
|
|
37
84
|
function normaliseSchema(input, ref, options) {
|
|
38
85
|
if (ref === void 0 && isObject(input)) {
|
|
@@ -46,14 +93,14 @@ function normaliseSchema(input, ref, options) {
|
|
|
46
93
|
result = normaliseZod4(input);
|
|
47
94
|
break;
|
|
48
95
|
case "zod3":
|
|
49
|
-
result = normaliseZod3();
|
|
96
|
+
result = normaliseZod3(input);
|
|
50
97
|
break;
|
|
51
98
|
case "openapi":
|
|
52
|
-
if (!isObject(input)) throw new
|
|
99
|
+
if (!isObject(input)) throw new SchemaNormalisationError("Invalid OpenAPI document", input, "openapi-invalid");
|
|
53
100
|
result = normaliseOpenApi(input, ref, options);
|
|
54
101
|
break;
|
|
55
102
|
case "jsonSchema":
|
|
56
|
-
if (!isObject(input)) throw new
|
|
103
|
+
if (!isObject(input)) throw new SchemaNormalisationError("Invalid JSON Schema", input, "invalid-json-schema");
|
|
57
104
|
result = normaliseJsonSchema(input, options?.diagnostics);
|
|
58
105
|
break;
|
|
59
106
|
}
|
|
@@ -62,10 +109,10 @@ function normaliseSchema(input, ref, options) {
|
|
|
62
109
|
}
|
|
63
110
|
function normaliseZod4(input) {
|
|
64
111
|
const zod = getProperty(input, "_zod");
|
|
65
|
-
if (!isObject(zod)) throw new
|
|
66
|
-
if (!("def" in zod)) throw new
|
|
112
|
+
if (!isObject(zod)) throw new SchemaNormalisationError("Invalid Zod 4 schema: missing _zod property", input, "invalid-zod");
|
|
113
|
+
if (!("def" in zod)) throw new SchemaNormalisationError("Invalid Zod 4 schema: missing _zod.def", input, "invalid-zod");
|
|
67
114
|
const jsonSchema = callToJsonSchema(input);
|
|
68
|
-
if (!isObject(jsonSchema)) throw new
|
|
115
|
+
if (!isObject(jsonSchema)) throw new SchemaNormalisationError("z.toJSONSchema() did not produce an object", input, "invalid-zod");
|
|
69
116
|
return {
|
|
70
117
|
jsonSchema,
|
|
71
118
|
zodSchema: input,
|
|
@@ -75,7 +122,8 @@ function normaliseZod4(input) {
|
|
|
75
122
|
}
|
|
76
123
|
function normaliseJsonSchema(jsonSchema, diagnostics) {
|
|
77
124
|
let draft;
|
|
78
|
-
|
|
125
|
+
const $schema = jsonSchema.$schema;
|
|
126
|
+
if (typeof $schema !== "string") {
|
|
79
127
|
const inferred = inferJsonSchemaDraftWithReason(jsonSchema);
|
|
80
128
|
draft = inferred.draft;
|
|
81
129
|
emitDiagnostic(diagnostics, {
|
|
@@ -87,16 +135,31 @@ function normaliseJsonSchema(jsonSchema, diagnostics) {
|
|
|
87
135
|
draft: inferred.draft
|
|
88
136
|
}
|
|
89
137
|
});
|
|
90
|
-
} else
|
|
91
|
-
|
|
138
|
+
} else {
|
|
139
|
+
const matched = matchJsonSchemaDraftUri($schema);
|
|
140
|
+
if (matched === void 0) {
|
|
141
|
+
draft = "draft-2020-12";
|
|
142
|
+
emitDiagnostic(diagnostics, {
|
|
143
|
+
code: "assumed-draft",
|
|
144
|
+
message: `Unknown $schema URI "${$schema}"; assuming draft-2020-12`,
|
|
145
|
+
pointer: "",
|
|
146
|
+
detail: {
|
|
147
|
+
inferredFrom: "unknown-uri",
|
|
148
|
+
draft,
|
|
149
|
+
uri: $schema
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
} else draft = matched;
|
|
153
|
+
}
|
|
154
|
+
const normalised = normaliseJsonSchema$1(jsonSchema, draft, diagnostics);
|
|
92
155
|
return {
|
|
93
156
|
jsonSchema: normalised,
|
|
94
157
|
rootMeta: extractRootMetaFromJson(normalised),
|
|
95
158
|
rootDocument: normalised
|
|
96
159
|
};
|
|
97
160
|
}
|
|
98
|
-
function normaliseZod3() {
|
|
99
|
-
throw new
|
|
161
|
+
function normaliseZod3(input) {
|
|
162
|
+
throw new SchemaNormalisationError("Zod 3 schemas are not supported. schema-components requires Zod 4. Detected: Zod 3 (has _def without _zod). See the Zod 4 migration guide at https://zod.dev/v4/migration or run: pnpm add zod@^4", input, "zod3-unsupported");
|
|
100
163
|
}
|
|
101
164
|
/**
|
|
102
165
|
* Mapping of Swagger 2.0 $ref prefixes to their OpenAPI 3.x equivalents.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { D as StringConstraints, f as FileConstraints, t as ArrayConstraints, x as ObjectConstraints, y as NumberConstraints } from "../types-D_5ST7SS.mjs";
|
|
2
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
2
|
+
import { i as DiagnosticsOptions } from "../diagnostics-VgEKI_Ct.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/constraints.d.ts
|
|
5
5
|
declare function extractStringConstraints(schema: Record<string, unknown>, diagnostics?: DiagnosticsOptions, pointer?: string): StringConstraints;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as appendPointer, i as DiagnosticsOptions, n as DiagnosticCode, o as emitDiagnostic, r as DiagnosticSink, t as Diagnostic } from "../diagnostics-
|
|
1
|
+
import { a as appendPointer, i as DiagnosticsOptions, n as DiagnosticCode, o as emitDiagnostic, r as DiagnosticSink, t as Diagnostic } from "../diagnostics-VgEKI_Ct.mjs";
|
|
2
2
|
export { Diagnostic, DiagnosticCode, DiagnosticSink, DiagnosticsOptions, appendPointer, emitDiagnostic };
|
package/dist/core/errors.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as SchemaRenderError, n as SchemaFieldError, r as SchemaNormalisationError, t as SchemaError } from "../errors-
|
|
1
|
+
import { i as SchemaRenderError, n as SchemaFieldError, r as SchemaNormalisationError, t as SchemaError } from "../errors-CnGjT1cg.mjs";
|
|
2
2
|
export { SchemaError, SchemaFieldError, SchemaNormalisationError, SchemaRenderError };
|
package/dist/core/errors.mjs
CHANGED
|
@@ -32,10 +32,16 @@ var SchemaError = class extends Error {
|
|
|
32
32
|
*/
|
|
33
33
|
var SchemaNormalisationError = class extends SchemaError {
|
|
34
34
|
kind;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* For `zod-type-unrepresentable`, the offending Zod type name
|
|
37
|
+
* (e.g. "bigint", "date", "map", "set"). `undefined` for other kinds.
|
|
38
|
+
*/
|
|
39
|
+
zodType;
|
|
40
|
+
constructor(message, schema, kind, zodType) {
|
|
36
41
|
super(message, schema);
|
|
37
42
|
this.name = "SchemaNormalisationError";
|
|
38
43
|
this.kind = kind;
|
|
44
|
+
this.zodType = zodType;
|
|
39
45
|
}
|
|
40
46
|
};
|
|
41
47
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { M as WalkedField } from "../types-D_5ST7SS.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/fieldOrder.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Sort `Object.entries(fields)` by `meta.order`. Lower values come
|
|
6
|
+
* first; fields without `meta.order` fall back to `Infinity` (last).
|
|
7
|
+
*/
|
|
8
|
+
declare function sortFieldsByOrder(fields: Record<string, WalkedField>): [string, WalkedField][];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { sortFieldsByOrder };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/core/fieldOrder.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sort `Object.entries(fields)` by `meta.order`. Lower values come
|
|
4
|
+
* first; fields without `meta.order` fall back to `Infinity` (last).
|
|
5
|
+
*/
|
|
6
|
+
function sortFieldsByOrder(fields) {
|
|
7
|
+
return Object.entries(fields).sort((a, b) => {
|
|
8
|
+
return (typeof a[1].meta.order === "number" ? a[1].meta.order : Infinity) - (typeof b[1].meta.order === "number" ? b[1].meta.order : Infinity);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { sortFieldsByOrder };
|
package/dist/core/formats.mjs
CHANGED
|
@@ -19,7 +19,15 @@ const FORMAT_PATTERNS = {
|
|
|
19
19
|
"relative-json-pointer": /^(0|[1-9][0-9]*)(#?([/]([^/~]|~0|~1)*)*)?$/,
|
|
20
20
|
duration: /^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$/,
|
|
21
21
|
"idn-email": /^[^\s@]+@[^\s@]+\.[^\s@]+$/u,
|
|
22
|
-
"idn-hostname": /^[a-z0-9\u00a1-\uffff]([a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?(\.[a-z0-9\u00a1-\uffff]([a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?)*$/iu
|
|
22
|
+
"idn-hostname": /^[a-z0-9\u00a1-\uffff]([a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?(\.[a-z0-9\u00a1-\uffff]([a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?)*$/iu,
|
|
23
|
+
cuid: /^[cC][0-9a-z]{6,}$/,
|
|
24
|
+
cuid2: /^[0-9a-z]+$/,
|
|
25
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
26
|
+
cidrv4: /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,
|
|
27
|
+
cidrv6: /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
28
|
+
base64: /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,
|
|
29
|
+
base64url: /^[A-Za-z0-9_-]*$/,
|
|
30
|
+
e164: /^\+[1-9]\d{6,14}$/
|
|
23
31
|
};
|
|
24
32
|
/**
|
|
25
33
|
* Format validators that use predicate functions instead of regex.
|
package/dist/core/merge.d.mts
CHANGED
package/dist/core/merge.mjs
CHANGED
|
@@ -23,27 +23,55 @@ function getObject(obj, key) {
|
|
|
23
23
|
* Structural equality for arbitrary JSON-like values. Used to decide
|
|
24
24
|
* whether a duplicated keyword across `allOf` branches genuinely
|
|
25
25
|
* conflicts (different values) or is benign (identical values).
|
|
26
|
+
*
|
|
27
|
+
* Cycle-safe: bundling external $refs via `structuredClone` preserves
|
|
28
|
+
* object cycles, so constraint values reaching this comparator can be
|
|
29
|
+
* cyclic. The co-recursive convention applies — when a pair of objects
|
|
30
|
+
* (or arrays) is re-encountered during the same comparison we assume
|
|
31
|
+
* equality holds and return true, letting any genuine inequality
|
|
32
|
+
* elsewhere in the structure surface naturally without recursing
|
|
33
|
+
* forever.
|
|
26
34
|
*/
|
|
27
35
|
function deepEqual(a, b) {
|
|
36
|
+
return deepEqualInner(a, b, /* @__PURE__ */ new WeakMap());
|
|
37
|
+
}
|
|
38
|
+
function deepEqualInner(a, b, seen) {
|
|
28
39
|
if (a === b) return true;
|
|
29
40
|
if (typeof a !== typeof b) return false;
|
|
30
41
|
if (Array.isArray(a)) {
|
|
31
42
|
if (!Array.isArray(b) || a.length !== b.length) return false;
|
|
32
|
-
|
|
43
|
+
if (hasSeenPair(seen, a, b)) return true;
|
|
44
|
+
recordPair(seen, a, b);
|
|
45
|
+
for (let i = 0; i < a.length; i++) if (!deepEqualInner(a[i], b[i], seen)) return false;
|
|
33
46
|
return true;
|
|
34
47
|
}
|
|
35
48
|
if (isObject(a) && isObject(b)) {
|
|
36
49
|
const keysA = Object.keys(a);
|
|
37
50
|
const keysB = Object.keys(b);
|
|
38
51
|
if (keysA.length !== keysB.length) return false;
|
|
52
|
+
if (hasSeenPair(seen, a, b)) return true;
|
|
53
|
+
recordPair(seen, a, b);
|
|
39
54
|
for (const key of keysA) {
|
|
40
55
|
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
41
|
-
if (!
|
|
56
|
+
if (!deepEqualInner(a[key], b[key], seen)) return false;
|
|
42
57
|
}
|
|
43
58
|
return true;
|
|
44
59
|
}
|
|
45
60
|
return false;
|
|
46
61
|
}
|
|
62
|
+
function hasSeenPair(seen, a, b) {
|
|
63
|
+
return seen.get(a)?.has(b) === true;
|
|
64
|
+
}
|
|
65
|
+
function recordPair(seen, a, b) {
|
|
66
|
+
const existing = seen.get(a);
|
|
67
|
+
if (existing === void 0) {
|
|
68
|
+
const partners = /* @__PURE__ */ new WeakSet();
|
|
69
|
+
partners.add(b);
|
|
70
|
+
seen.set(a, partners);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
existing.add(b);
|
|
74
|
+
}
|
|
47
75
|
/**
|
|
48
76
|
* Annotation keywords that can appear as siblings of `$ref` per
|
|
49
77
|
* Draft 2020-12 / OpenAPI 3.1. Structural keywords (type, properties,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
2
|
-
import { n as JsonSchemaDraft, r as OpenApiVersionInfo } from "../version-
|
|
1
|
+
import { i as DiagnosticsOptions } from "../diagnostics-VgEKI_Ct.mjs";
|
|
2
|
+
import { n as JsonSchemaDraft, r as OpenApiVersionInfo } from "../version-XNH7PRGP.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/normalise.d.ts
|
|
5
5
|
type NodeTransform = (node: Record<string, unknown>) => Record<string, unknown>;
|
|
@@ -8,9 +8,32 @@ type NodeTransform = (node: Record<string, unknown>) => Record<string, unknown>;
|
|
|
8
8
|
* and recursing into every sub-schema location.
|
|
9
9
|
*/
|
|
10
10
|
declare function deepNormalise(schema: Record<string, unknown>, transform: NodeTransform): Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Per-node context threaded through `deepNormaliseWithContext`.
|
|
13
|
+
*
|
|
14
|
+
* Carries the diagnostics sink and the JSON Pointer to the current
|
|
15
|
+
* node so per-node transforms can emit pointer-accurate diagnostics
|
|
16
|
+
* when they translate or reject legacy constructs.
|
|
17
|
+
*/
|
|
18
|
+
interface NodeContext {
|
|
19
|
+
diagnostics: DiagnosticsOptions | undefined;
|
|
20
|
+
pointer: string;
|
|
21
|
+
}
|
|
22
|
+
type NodeTransformWithContext = (node: Record<string, unknown>, ctx: NodeContext) => Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Deep-normalise a JSON Schema object, threading a context (diagnostics
|
|
25
|
+
* sink + JSON Pointer) through each recursive call. Used by the JSON
|
|
26
|
+
* Schema normalisation path so per-node transforms can emit diagnostics
|
|
27
|
+
* with accurate pointers.
|
|
28
|
+
*
|
|
29
|
+
* Mirrors `deepNormalise` structurally — keep the two in sync when
|
|
30
|
+
* adding new sub-schema locations.
|
|
31
|
+
*/
|
|
32
|
+
declare function deepNormaliseWithContext(schema: Record<string, unknown>, transform: NodeTransformWithContext, ctx: NodeContext): Record<string, unknown>;
|
|
11
33
|
/**
|
|
12
34
|
* Normalise Draft 04 `exclusiveMinimum`/`exclusiveMaximum` from boolean
|
|
13
|
-
* to number form
|
|
35
|
+
* to number form, plus the other Draft 04 translations applied to a
|
|
36
|
+
* single node.
|
|
14
37
|
*
|
|
15
38
|
* In Draft 04:
|
|
16
39
|
* - `exclusiveMinimum: true` + `minimum: 5` → value must be > 5
|
|
@@ -22,13 +45,23 @@ declare function deepNormalise(schema: Record<string, unknown>, transform: NodeT
|
|
|
22
45
|
*
|
|
23
46
|
* The transform converts boolean form to number form so the walker can
|
|
24
47
|
* treat `exclusiveMinimum`/`exclusiveMaximum` uniformly as numbers.
|
|
48
|
+
*
|
|
49
|
+
* This function preserves the no-context signature for the OpenAPI 3.0
|
|
50
|
+
* and Swagger 2.0 normalisers that compose it directly. The JSON Schema
|
|
51
|
+
* normalisation path uses {@link normaliseDraft04NodeWithContext} via
|
|
52
|
+
* {@link deepNormaliseWithContext} to thread diagnostics.
|
|
25
53
|
*/
|
|
26
54
|
declare function normaliseDraft04Node(node: Record<string, unknown>): Record<string, unknown>;
|
|
27
55
|
/**
|
|
28
56
|
* Normalise a JSON Schema to canonical Draft 2020-12 form.
|
|
29
57
|
* Deep-clones the input — the original is never mutated.
|
|
58
|
+
*
|
|
59
|
+
* When `diagnostics` is supplied, per-node transforms emit diagnostics
|
|
60
|
+
* for legacy-keyword rewrites and invalid constructs (e.g. `divisibleBy`
|
|
61
|
+
* conflicts, non-string entries in a `dependentRequired` array, legacy
|
|
62
|
+
* `dependencies` reaching the 2020-12 path).
|
|
30
63
|
*/
|
|
31
|
-
declare function normaliseJsonSchema(schema: Record<string, unknown>, draft: JsonSchemaDraft): Record<string, unknown>;
|
|
64
|
+
declare function normaliseJsonSchema(schema: Record<string, unknown>, draft: JsonSchemaDraft, diagnostics?: DiagnosticsOptions): Record<string, unknown>;
|
|
32
65
|
/**
|
|
33
66
|
* Normalise an OpenAPI document's schemas for walker consumption.
|
|
34
67
|
* Handles version-specific keyword transformations.
|
|
@@ -38,4 +71,4 @@ declare function normaliseJsonSchema(schema: Record<string, unknown>, draft: Jso
|
|
|
38
71
|
*/
|
|
39
72
|
declare function normaliseOpenApiSchemas(doc: Record<string, unknown>, version: OpenApiVersionInfo, diagnostics?: DiagnosticsOptions): Record<string, unknown>;
|
|
40
73
|
//#endregion
|
|
41
|
-
export { NodeTransform, deepNormalise, normaliseDraft04Node, normaliseJsonSchema, normaliseOpenApiSchemas };
|
|
74
|
+
export { NodeContext, NodeTransform, NodeTransformWithContext, deepNormalise, deepNormaliseWithContext, normaliseDraft04Node, normaliseJsonSchema, normaliseOpenApiSchemas };
|
package/dist/core/normalise.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { deepNormalise, normaliseDraft04Node, normaliseJsonSchema, normaliseOpenApiSchemas };
|
|
1
|
+
import { a as normaliseOpenApiSchemas, i as normaliseJsonSchema, n as deepNormaliseWithContext, r as normaliseDraft04Node, t as deepNormalise } from "../normalise-C0ofw3W6.mjs";
|
|
2
|
+
export { deepNormalise, deepNormaliseWithContext, normaliseDraft04Node, normaliseJsonSchema, normaliseOpenApiSchemas };
|
|
@@ -32,10 +32,39 @@ declare function normaliseOpenApi30Discriminator(node: Record<string, unknown>):
|
|
|
32
32
|
*/
|
|
33
33
|
declare function normaliseOpenApi30Combined(node: Record<string, unknown>): Record<string, unknown>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* Per-schema normaliser supplied by the caller. Given a Schema Object,
|
|
36
|
+
* returns the normalised (deep-cloned) Schema Object. The visitor is
|
|
37
|
+
* agnostic to which transforms run inside.
|
|
38
|
+
*/
|
|
39
|
+
type SchemaNormaliser = (schema: Record<string, unknown>) => Record<string, unknown>;
|
|
40
|
+
/**
|
|
41
|
+
* Deep-clone the parent first, then patch back any keys whose values were
|
|
42
|
+
* rewritten by the visitor. This preserves immutability of the original
|
|
43
|
+
* document while keeping the visitor straightforward to write.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Deep-normalise every Schema Object in an OpenAPI document.
|
|
47
|
+
*
|
|
48
|
+
* Walks: `paths.*` (operations + path-level parameters), `webhooks.*`
|
|
49
|
+
* (3.1), `components.schemas`, `components.parameters`,
|
|
50
|
+
* `components.responses`, `components.requestBodies`,
|
|
51
|
+
* `components.headers`, `components.callbacks`, `components.pathItems`
|
|
52
|
+
* (3.1). For each Schema-bearing location, applies the supplied
|
|
53
|
+
* `normaliseSchema` function.
|
|
54
|
+
*
|
|
55
|
+
* The walker is structural (it understands OAS document shapes) and
|
|
56
|
+
* delegates the per-schema transformation. For OAS 3.0 the caller
|
|
57
|
+
* passes a full Draft 04 + nullable + discriminator + example
|
|
58
|
+
* normaliser; for OAS 3.1 the caller passes a discriminator-only
|
|
59
|
+
* normaliser so the walker's discriminated-union detection sees the
|
|
60
|
+
* injected `const`s regardless of OAS minor version.
|
|
61
|
+
*/
|
|
62
|
+
declare function deepNormaliseOpenApiDoc(doc: Record<string, unknown>, normaliseSchema: SchemaNormaliser): Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Backwards-compatible wrapper retaining the historic `deepNormalise`
|
|
65
|
+
* signature used by callers in `normalise.ts`. Always applies the full
|
|
66
|
+
* 3.0 combined transform via `deepNormalise(schema, normaliseOpenApi30Combined)`.
|
|
38
67
|
*/
|
|
39
68
|
declare function deepNormaliseOpenApi30Doc(doc: Record<string, unknown>, deepNormalise: (schema: Record<string, unknown>, transform: NodeTransform) => Record<string, unknown>): Record<string, unknown>;
|
|
40
69
|
//#endregion
|
|
41
|
-
export { deepNormaliseOpenApi30Doc, normaliseOpenApi30Combined, normaliseOpenApi30Discriminator, normaliseOpenApi30Node };
|
|
70
|
+
export { deepNormaliseOpenApi30Doc, deepNormaliseOpenApiDoc, normaliseOpenApi30Combined, normaliseOpenApi30Discriminator, normaliseOpenApi30Node };
|
package/dist/core/openapi30.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
export { deepNormaliseOpenApi30Doc, normaliseOpenApi30Combined, normaliseOpenApi30Discriminator, normaliseOpenApi30Node };
|
|
1
|
+
import { c as deepNormaliseOpenApiDoc, d as normaliseOpenApi30Node, l as normaliseOpenApi30Combined, s as deepNormaliseOpenApi30Doc, u as normaliseOpenApi30Discriminator } from "../normalise-C0ofw3W6.mjs";
|
|
2
|
+
export { deepNormaliseOpenApi30Doc, deepNormaliseOpenApiDoc, normaliseOpenApi30Combined, normaliseOpenApi30Discriminator, normaliseOpenApi30Node };
|
package/dist/core/ref.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as findAnchor, i as dereference, n as RefOptions, o as resolveRef, r as countDistinctRefs, t as ExternalResolver } from "../ref-
|
|
1
|
+
import { a as findAnchor, i as dereference, n as RefOptions, o as resolveRef, r as countDistinctRefs, t as ExternalResolver } from "../ref-Bb43ZURY.mjs";
|
|
2
2
|
export { ExternalResolver, RefOptions, countDistinctRefs, dereference, findAnchor, resolveRef };
|
package/dist/core/renderer.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as HtmlRenderProps, c as RenderFunction, d as getHtmlRenderFn, f as getRenderFunction, h as typeToKey, i as HtmlRenderFunction, l as RenderProps, m as mergeResolvers, n as BaseFieldProps, o as HtmlResolver, p as mergeHtmlResolvers, r as ComponentResolver, s as RESOLVER_KEYS, t as AllConstraints, u as buildRenderProps } from "../renderer-
|
|
1
|
+
import { a as HtmlRenderProps, c as RenderFunction, d as getHtmlRenderFn, f as getRenderFunction, h as typeToKey, i as HtmlRenderFunction, l as RenderProps, m as mergeResolvers, n as BaseFieldProps, o as HtmlResolver, p as mergeHtmlResolvers, r as ComponentResolver, s as RESOLVER_KEYS, t as AllConstraints, u as buildRenderProps } from "../renderer-BQqiXUYP.mjs";
|
|
2
2
|
export { AllConstraints, BaseFieldProps, ComponentResolver, HtmlRenderFunction, HtmlRenderProps, HtmlResolver, RESOLVER_KEYS, RenderFunction, RenderProps, buildRenderProps, getHtmlRenderFn, getRenderFunction, mergeHtmlResolvers, mergeResolvers, typeToKey };
|
package/dist/core/renderer.mjs
CHANGED
|
@@ -11,11 +11,6 @@ function noopOnChange() {}
|
|
|
11
11
|
* a noop `onChange` is wired up, `readOnly` is forced to `true`, and
|
|
12
12
|
* `writeOnly` is forced to `false`. Otherwise the editability is taken
|
|
13
13
|
* from `tree.editability`.
|
|
14
|
-
*
|
|
15
|
-
* The duplicate sibling fields (`enumValues`, `element`, `fields`, etc.)
|
|
16
|
-
* are populated for backwards compatibility with renderers that have not
|
|
17
|
-
* yet migrated to reading from `tree` directly. New renderers should
|
|
18
|
-
* narrow on `tree.type` and read from `tree`.
|
|
19
14
|
*/
|
|
20
15
|
function buildRenderProps(tree, value, onChange, renderChild, path) {
|
|
21
16
|
const isReadOnly = onChange === void 0 || tree.editability === "presentation";
|
|
@@ -31,20 +26,6 @@ function buildRenderProps(tree, value, onChange, renderChild, path) {
|
|
|
31
26
|
tree,
|
|
32
27
|
renderChild
|
|
33
28
|
};
|
|
34
|
-
if (tree.type === "enum") props.enumValues = tree.enumValues;
|
|
35
|
-
if (tree.type === "array" && tree.element !== void 0) props.element = tree.element;
|
|
36
|
-
if (tree.type === "object") props.fields = tree.fields;
|
|
37
|
-
if (tree.type === "union" || tree.type === "discriminatedUnion") props.options = tree.options;
|
|
38
|
-
if (tree.type === "discriminatedUnion") props.discriminator = tree.discriminator;
|
|
39
|
-
if (tree.type === "record") props.keyType = tree.keyType;
|
|
40
|
-
if (tree.type === "record") props.valueType = tree.valueType;
|
|
41
|
-
if (tree.type === "tuple") props.prefixItems = tree.prefixItems;
|
|
42
|
-
if (tree.type === "conditional") props.ifClause = tree.ifClause;
|
|
43
|
-
if (tree.type === "conditional" && tree.thenClause !== void 0) props.thenClause = tree.thenClause;
|
|
44
|
-
if (tree.type === "conditional" && tree.elseClause !== void 0) props.elseClause = tree.elseClause;
|
|
45
|
-
if (tree.type === "negation") props.negated = tree.negated;
|
|
46
|
-
if (tree.type === "recursive") props.refTarget = tree.refTarget;
|
|
47
|
-
if (tree.type === "literal") props.literalValues = tree.literalValues;
|
|
48
29
|
if (tree.examples !== void 0) props.examples = tree.examples;
|
|
49
30
|
return props;
|
|
50
31
|
}
|
|
@@ -52,6 +33,7 @@ const RESOLVER_KEYS = [
|
|
|
52
33
|
"string",
|
|
53
34
|
"number",
|
|
54
35
|
"boolean",
|
|
36
|
+
"null",
|
|
55
37
|
"enum",
|
|
56
38
|
"object",
|
|
57
39
|
"array",
|
|
@@ -64,17 +46,21 @@ const RESOLVER_KEYS = [
|
|
|
64
46
|
"recursive",
|
|
65
47
|
"literal",
|
|
66
48
|
"file",
|
|
49
|
+
"never",
|
|
67
50
|
"unknown"
|
|
68
51
|
];
|
|
69
52
|
/**
|
|
70
53
|
* Map a schema type to the resolver key that handles it.
|
|
71
|
-
*
|
|
54
|
+
* Every WalkedField variant has a direct resolver key — exhaustive switch
|
|
55
|
+
* ensures new variants surface as a type error rather than silently
|
|
56
|
+
* falling through to "unknown".
|
|
72
57
|
*/
|
|
73
58
|
function typeToKey(type) {
|
|
74
59
|
switch (type) {
|
|
75
60
|
case "string":
|
|
76
61
|
case "number":
|
|
77
62
|
case "boolean":
|
|
63
|
+
case "null":
|
|
78
64
|
case "enum":
|
|
79
65
|
case "object":
|
|
80
66
|
case "array":
|
|
@@ -87,8 +73,8 @@ function typeToKey(type) {
|
|
|
87
73
|
case "recursive":
|
|
88
74
|
case "literal":
|
|
89
75
|
case "file":
|
|
76
|
+
case "never":
|
|
90
77
|
case "unknown": return type;
|
|
91
|
-
default: return "unknown";
|
|
92
78
|
}
|
|
93
79
|
}
|
|
94
80
|
/**
|
package/dist/core/swagger2.d.mts
CHANGED
package/dist/core/swagger2.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as normaliseSwagger2Document } from "../normalise-C0ofw3W6.mjs";
|
|
2
2
|
export { normaliseSwagger2Document };
|
package/dist/core/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as detectOpenApiVersion, c as isOpenApi30, i as detectJsonSchemaDraft, l as isOpenApi31, n as JsonSchemaDraft, o as inferJsonSchemaDraft, r as OpenApiVersionInfo, s as inferJsonSchemaDraftWithReason, t as InferredDraft, u as isSwagger2 } from "../version-
|
|
2
|
-
export { InferredDraft, JsonSchemaDraft, OpenApiVersionInfo, detectJsonSchemaDraft, detectOpenApiVersion, inferJsonSchemaDraft, inferJsonSchemaDraftWithReason, isOpenApi30, isOpenApi31, isSwagger2 };
|
|
1
|
+
import { a as detectOpenApiVersion, c as isOpenApi30, d as matchJsonSchemaDraftUri, i as detectJsonSchemaDraft, l as isOpenApi31, n as JsonSchemaDraft, o as inferJsonSchemaDraft, r as OpenApiVersionInfo, s as inferJsonSchemaDraftWithReason, t as InferredDraft, u as isSwagger2 } from "../version-XNH7PRGP.mjs";
|
|
2
|
+
export { InferredDraft, JsonSchemaDraft, OpenApiVersionInfo, detectJsonSchemaDraft, detectOpenApiVersion, inferJsonSchemaDraft, inferJsonSchemaDraftWithReason, isOpenApi30, isOpenApi31, isSwagger2, matchJsonSchemaDraftUri };
|
package/dist/core/version.mjs
CHANGED
|
@@ -15,6 +15,22 @@ const DRAFT_URIS = new Map([
|
|
|
15
15
|
["https://json-schema.org/draft-04/schema#", "draft-04"]
|
|
16
16
|
]);
|
|
17
17
|
/**
|
|
18
|
+
* Match a `$schema` URI string to a known draft. Returns `undefined`
|
|
19
|
+
* when the URI matches none of the documented Draft 04 – Draft 2020-12
|
|
20
|
+
* schema URIs (including the known prefix patterns) — callers can use
|
|
21
|
+
* this to distinguish an authoritative match from a silent fallback.
|
|
22
|
+
*/
|
|
23
|
+
function matchJsonSchemaDraftUri(uri) {
|
|
24
|
+
const exact = DRAFT_URIS.get(uri);
|
|
25
|
+
if (exact !== void 0) return exact;
|
|
26
|
+
for (const [draftUri, draft] of DRAFT_URIS) if (uri.startsWith(draftUri) || uri === draftUri) return draft;
|
|
27
|
+
if (uri.includes("/draft/2020-12/")) return "draft-2020-12";
|
|
28
|
+
if (uri.includes("/draft/2019-09/")) return "draft-2019-09";
|
|
29
|
+
if (uri.includes("/draft-07")) return "draft-07";
|
|
30
|
+
if (uri.includes("/draft-06")) return "draft-06";
|
|
31
|
+
if (uri.includes("/draft-04")) return "draft-04";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
18
34
|
* Detect the JSON Schema draft version from a schema's `$schema` URI.
|
|
19
35
|
* When `$schema` is absent, uses heuristic keyword detection via
|
|
20
36
|
* `inferJsonSchemaDraft` to guess the draft version.
|
|
@@ -24,14 +40,8 @@ const DRAFT_URIS = new Map([
|
|
|
24
40
|
function detectJsonSchemaDraft(schema) {
|
|
25
41
|
const $schema = schema.$schema;
|
|
26
42
|
if (typeof $schema === "string") {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
for (const [uri, draft] of DRAFT_URIS) if ($schema.startsWith(uri) || $schema === uri) return draft;
|
|
30
|
-
if ($schema.includes("/draft/2020-12/")) return "draft-2020-12";
|
|
31
|
-
if ($schema.includes("/draft/2019-09/")) return "draft-2019-09";
|
|
32
|
-
if ($schema.includes("/draft-07")) return "draft-07";
|
|
33
|
-
if ($schema.includes("/draft-06")) return "draft-06";
|
|
34
|
-
if ($schema.includes("/draft-04")) return "draft-04";
|
|
43
|
+
const matched = matchJsonSchemaDraftUri($schema);
|
|
44
|
+
if (matched !== void 0) return matched;
|
|
35
45
|
return "draft-2020-12";
|
|
36
46
|
}
|
|
37
47
|
return inferJsonSchemaDraft(schema);
|
|
@@ -148,4 +158,4 @@ function isSwagger2(version) {
|
|
|
148
158
|
return version.major === 2;
|
|
149
159
|
}
|
|
150
160
|
//#endregion
|
|
151
|
-
export { detectJsonSchemaDraft, detectOpenApiVersion, inferJsonSchemaDraft, inferJsonSchemaDraftWithReason, isOpenApi30, isOpenApi31, isSwagger2 };
|
|
161
|
+
export { detectJsonSchemaDraft, detectOpenApiVersion, inferJsonSchemaDraft, inferJsonSchemaDraftWithReason, isOpenApi30, isOpenApi31, isSwagger2, matchJsonSchemaDraftUri };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as WalkedField, O as StringField, T as SchemaMeta, b as NumberField, c as FieldBase, j as UnknownField, o as Editability, p as FileField, r as BooleanField, v as NullField } from "../types-D_5ST7SS.mjs";
|
|
2
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
3
|
-
import { t as ExternalResolver } from "../ref-
|
|
2
|
+
import { i as DiagnosticsOptions } from "../diagnostics-VgEKI_Ct.mjs";
|
|
3
|
+
import { t as ExternalResolver } from "../ref-Bb43ZURY.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/core/walkBuilders.d.ts
|
|
6
6
|
declare function getString(obj: Record<string, unknown>, key: string): string | undefined;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Machine-readable codes identifying each class of diagnostic.
|
|
17
17
|
* Stable across releases — consumers can pattern-match on these.
|
|
18
18
|
*/
|
|
19
|
-
type DiagnosticCode = "unresolved-ref" | "unknown-keyword" | "unknown-format" | "invalid-const" | "unsupported-type" | "dropped-swagger-feature" | "external-ref" | "type-negation-fallback" | "conditional-fallback" | "assumed-draft" | "depth-exceeded" | "allof-conflict" | "discriminator-inconsistent";
|
|
19
|
+
type DiagnosticCode = "unresolved-ref" | "unknown-keyword" | "unknown-format" | "invalid-const" | "unsupported-type" | "dropped-swagger-feature" | "external-ref" | "type-negation-fallback" | "conditional-fallback" | "assumed-draft" | "depth-exceeded" | "allof-conflict" | "discriminator-inconsistent" | "divisible-by-conflict" | "legacy-dependencies-split" | "dependent-required-invalid";
|
|
20
20
|
/**
|
|
21
21
|
* A single diagnostic emitted during schema processing.
|
|
22
22
|
*/
|
|
@@ -27,8 +27,13 @@ declare class SchemaError extends Error {
|
|
|
27
27
|
* JSON Schema, missing OpenAPI ref, unsupported ref format.
|
|
28
28
|
*/
|
|
29
29
|
declare class SchemaNormalisationError extends SchemaError {
|
|
30
|
-
readonly kind: "invalid-zod" | "zod3-unsupported" | "invalid-json-schema" | "openapi-missing-ref" | "openapi-invalid" | "unknown";
|
|
31
|
-
|
|
30
|
+
readonly kind: "invalid-zod" | "zod3-unsupported" | "zod-transform-unsupported" | "zod-type-unrepresentable" | "zod-conversion-failed" | "invalid-json-schema" | "openapi-missing-ref" | "openapi-invalid" | "unknown";
|
|
31
|
+
/**
|
|
32
|
+
* For `zod-type-unrepresentable`, the offending Zod type name
|
|
33
|
+
* (e.g. "bigint", "date", "map", "set"). `undefined` for other kinds.
|
|
34
|
+
*/
|
|
35
|
+
readonly zodType: string | undefined;
|
|
36
|
+
constructor(message: string, schema: unknown, kind: SchemaNormalisationError["kind"], zodType?: string);
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* A theme adapter's render function threw during rendering.
|
package/dist/html/a11y.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as WalkedField } from "../types-D_5ST7SS.mjs";
|
|
2
|
-
import { t as AllConstraints } from "../renderer-
|
|
2
|
+
import { t as AllConstraints } from "../renderer-BQqiXUYP.mjs";
|
|
3
3
|
import { HtmlAttributes, HtmlNode } from "./html.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/html/a11y.d.ts
|