@elaraai/east 1.0.69 → 1.0.71
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/src/builtins.d.ts +1 -1
- package/dist/src/builtins.d.ts.map +1 -1
- package/dist/src/builtins.js +7 -0
- package/dist/src/builtins.js.map +1 -1
- package/dist/src/codegen/spellings.d.ts.map +1 -1
- package/dist/src/codegen/spellings.js +1 -0
- package/dist/src/codegen/spellings.js.map +1 -1
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +50 -2
- package/dist/src/compile.js.map +1 -1
- package/dist/src/compile.open_beast.spec.d.ts +6 -0
- package/dist/src/compile.open_beast.spec.d.ts.map +1 -0
- package/dist/src/compile.open_beast.spec.js +99 -0
- package/dist/src/compile.open_beast.spec.js.map +1 -0
- package/dist/src/expr/blob.d.ts +41 -1
- package/dist/src/expr/blob.d.ts.map +1 -1
- package/dist/src/expr/blob.js +52 -0
- package/dist/src/expr/blob.js.map +1 -1
- package/dist/src/expr/libs/datetime.d.ts +11 -0
- package/dist/src/expr/libs/datetime.d.ts.map +1 -1
- package/dist/src/expr/libs/datetime.js +11 -0
- package/dist/src/expr/libs/datetime.js.map +1 -1
- package/dist/src/location.d.ts +12 -0
- package/dist/src/location.d.ts.map +1 -1
- package/dist/src/location.js +15 -3
- package/dist/src/location.js.map +1 -1
- package/dist/src/serialization/beast2/index.d.ts +16 -1
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +24 -3
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/v4/container.d.ts +10 -0
- package/dist/src/serialization/beast2/v4/container.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v4/container.js +13 -0
- package/dist/src/serialization/beast2/v4/container.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.d.ts +17 -0
- package/dist/src/serialization/beast2/v5/frames.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.js +40 -0
- package/dist/src/serialization/beast2/v5/frames.js.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.d.ts +10 -113
- package/dist/src/serialization/beast2/v5/geometry.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.js +7 -151
- package/dist/src/serialization/beast2/v5/geometry.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +8 -2
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.js +9 -3
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
- package/dist/src/serialization/beast2/v5/range.d.ts +201 -0
- package/dist/src/serialization/beast2/v5/range.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/range.js +252 -0
- package/dist/src/serialization/beast2/v5/range.js.map +1 -0
- package/dist/src/serialization/beast2/v5/stream.d.ts +29 -5
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +86 -19
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/beast2/v5/sync-reader.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/sync-reader.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/sync-reader.spec.js +228 -0
- package/dist/src/serialization/beast2/v5/sync-reader.spec.js.map +1 -0
- package/dist/src/serialization/index.d.ts +3 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +3 -1
- package/dist/src/serialization/index.js.map +1 -1
- package/dist/src/serialization/json.d.ts.map +1 -1
- package/dist/src/serialization/json.js +31 -1
- package/dist/src/serialization/json.js.map +1 -1
- package/dist/src/serialization/json_schema.d.ts +76 -0
- package/dist/src/serialization/json_schema.d.ts.map +1 -0
- package/dist/src/serialization/json_schema.js +290 -0
- package/dist/src/serialization/json_schema.js.map +1 -0
- package/dist/src/serialization/json_schema.spec.d.ts +2 -0
- package/dist/src/serialization/json_schema.spec.d.ts.map +1 -0
- package/dist/src/serialization/json_schema.spec.js +327 -0
- package/dist/src/serialization/json_schema.spec.js.map +1 -0
- package/dist/src/serialization/json_schema_to_type.d.ts +74 -0
- package/dist/src/serialization/json_schema_to_type.d.ts.map +1 -0
- package/dist/src/serialization/json_schema_to_type.js +500 -0
- package/dist/src/serialization/json_schema_to_type.js.map +1 -0
- package/dist/src/serialization/json_schema_to_type.spec.d.ts +2 -0
- package/dist/src/serialization/json_schema_to_type.spec.d.ts.map +1 -0
- package/dist/src/serialization/json_schema_to_type.spec.js +372 -0
- package/dist/src/serialization/json_schema_to_type.spec.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, test } from "node:test";
|
|
6
|
+
import assert from "node:assert/strict";
|
|
7
|
+
import { ArrayType, BlobType, BooleanType, DateTimeType, DictType, FloatType, IntegerType, isTypeEqual, MatrixType, NullType, OptionType, printType, RecursiveType, RefType, SetType, StringType, StructType, VariantType, VectorType, } from "../types.js";
|
|
8
|
+
import { jsonSchemaFor } from "./json_schema.js";
|
|
9
|
+
import { JsonSchemaUnsupportedError, typeFromJsonSchema } from "./json_schema_to_type.js";
|
|
10
|
+
const LinkedListType = RecursiveType((self) => VariantType({
|
|
11
|
+
nil: NullType,
|
|
12
|
+
cons: StructType({ head: IntegerType, tail: self }),
|
|
13
|
+
}));
|
|
14
|
+
/** The corpus both directions are pinned against. */
|
|
15
|
+
const CORPUS = [
|
|
16
|
+
["Null", NullType],
|
|
17
|
+
["Boolean", BooleanType],
|
|
18
|
+
["Integer", IntegerType],
|
|
19
|
+
["Float", FloatType],
|
|
20
|
+
["String", StringType],
|
|
21
|
+
["DateTime", DateTimeType],
|
|
22
|
+
["Blob", BlobType],
|
|
23
|
+
["Array<Integer>", ArrayType(IntegerType)],
|
|
24
|
+
["Set<String>", SetType(StringType)],
|
|
25
|
+
["Dict<String,Integer>", DictType(StringType, IntegerType)],
|
|
26
|
+
["Struct", StructType({ a: StringType, b: IntegerType, c: DateTimeType })],
|
|
27
|
+
["Variant", VariantType({ ok: IntegerType, err: StringType })],
|
|
28
|
+
["Option<String>", OptionType(StringType)],
|
|
29
|
+
["Ref<Integer>", RefType(IntegerType)],
|
|
30
|
+
["Vector<Float>", VectorType(FloatType)],
|
|
31
|
+
["Matrix<Integer>", MatrixType(IntegerType)],
|
|
32
|
+
["nested", ArrayType(StructType({
|
|
33
|
+
id: IntegerType,
|
|
34
|
+
tags: SetType(StringType),
|
|
35
|
+
note: OptionType(StringType),
|
|
36
|
+
when: DateTimeType,
|
|
37
|
+
}))],
|
|
38
|
+
["recursive", LinkedListType],
|
|
39
|
+
["Array<recursive>", ArrayType(LinkedListType)],
|
|
40
|
+
];
|
|
41
|
+
const DRAFTS = ["2020-12", "draft-07", "openapi-3.0"];
|
|
42
|
+
/** Assert a conversion is refused, and that it names the expected pointer. */
|
|
43
|
+
function refuses(schema, message, pointer) {
|
|
44
|
+
try {
|
|
45
|
+
typeFromJsonSchema(schema);
|
|
46
|
+
assert.fail("should have refused the schema");
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
assert.ok(e instanceof JsonSchemaUnsupportedError, `expected JsonSchemaUnsupportedError, got ${e}`);
|
|
50
|
+
assert.match(e.message, message);
|
|
51
|
+
if (pointer !== undefined)
|
|
52
|
+
assert.equal(e.pointer, pointer);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
describe("typeFromJsonSchema", () => {
|
|
56
|
+
describe("round-trip with jsonSchemaFor", () => {
|
|
57
|
+
for (const draft of DRAFTS) {
|
|
58
|
+
test(`inverts every corpus type exactly (${draft})`, () => {
|
|
59
|
+
for (const [name, type] of CORPUS) {
|
|
60
|
+
const back = typeFromJsonSchema(jsonSchemaFor(type, { draft }));
|
|
61
|
+
assert.ok(isTypeEqual(back, type), `${name}: got ${printType(back)}, want ${printType(type)}`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
describe("structural mapping for a foreign document", () => {
|
|
67
|
+
test("maps the primitive types", () => {
|
|
68
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "null" }), NullType));
|
|
69
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "boolean" }), BooleanType));
|
|
70
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "string" }), StringType));
|
|
71
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "number" }), FloatType));
|
|
72
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "integer" }), IntegerType));
|
|
73
|
+
});
|
|
74
|
+
test("reads OpenAPI 3.0's nullable spelling of null", () => {
|
|
75
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ nullable: true, enum: [null] }), NullType));
|
|
76
|
+
});
|
|
77
|
+
test("maps an array to an Array of its items", () => {
|
|
78
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "array", items: { type: "string" } }), ArrayType(StringType)));
|
|
79
|
+
});
|
|
80
|
+
test("maps a closed, fully-required object to a Struct", () => {
|
|
81
|
+
const T = typeFromJsonSchema({
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: { a: { type: "string" }, b: { type: "integer" } },
|
|
84
|
+
required: ["a", "b"],
|
|
85
|
+
additionalProperties: false,
|
|
86
|
+
});
|
|
87
|
+
assert.ok(isTypeEqual(T, StructType({ a: StringType, b: IntegerType })));
|
|
88
|
+
});
|
|
89
|
+
test("maps a tagged oneOf to a Variant, in either tag spelling", () => {
|
|
90
|
+
const withConst = typeFromJsonSchema({
|
|
91
|
+
oneOf: [
|
|
92
|
+
{
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: { type: { const: "ok" }, value: { type: "integer" } },
|
|
95
|
+
required: ["type", "value"], additionalProperties: false,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
assert.ok(isTypeEqual(withConst, VariantType({ ok: IntegerType })));
|
|
100
|
+
// draft-04 / OpenAPI 3.0 has no `const`.
|
|
101
|
+
const withEnum = typeFromJsonSchema({
|
|
102
|
+
oneOf: [
|
|
103
|
+
{
|
|
104
|
+
type: "object",
|
|
105
|
+
properties: { type: { enum: ["ok"] }, value: { type: "integer" } },
|
|
106
|
+
required: ["type", "value"], additionalProperties: false,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
assert.ok(isTypeEqual(withEnum, VariantType({ ok: IntegerType })));
|
|
111
|
+
});
|
|
112
|
+
test("without annotations, a Set is indistinguishable from an Array", () => {
|
|
113
|
+
// The documented limit of the best-effort mapping: uniqueItems is
|
|
114
|
+
// not enough to recover Set, so an un-annotated document does not
|
|
115
|
+
// promise to round-trip.
|
|
116
|
+
const T = typeFromJsonSchema({ type: "array", items: { type: "string" }, uniqueItems: true });
|
|
117
|
+
assert.ok(isTypeEqual(T, ArrayType(StringType)));
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe("definitions", () => {
|
|
121
|
+
test("resolves a self-referential definition into a RecursiveType", () => {
|
|
122
|
+
const schema = jsonSchemaFor(LinkedListType);
|
|
123
|
+
const back = typeFromJsonSchema(schema);
|
|
124
|
+
assert.equal(back.type, "Recursive");
|
|
125
|
+
assert.ok(isTypeEqual(back, LinkedListType));
|
|
126
|
+
});
|
|
127
|
+
test("reads definitions from either keyword", () => {
|
|
128
|
+
const modern = typeFromJsonSchema({
|
|
129
|
+
$ref: "#/$defs/Leaf",
|
|
130
|
+
$defs: { Leaf: { type: "string" } },
|
|
131
|
+
});
|
|
132
|
+
const legacy = typeFromJsonSchema({
|
|
133
|
+
$ref: "#/definitions/Leaf",
|
|
134
|
+
definitions: { Leaf: { type: "string" } },
|
|
135
|
+
});
|
|
136
|
+
assert.ok(isTypeEqual(modern, StringType));
|
|
137
|
+
assert.ok(isTypeEqual(legacy, StringType));
|
|
138
|
+
});
|
|
139
|
+
test("binds a two-definition cycle on one definition", () => {
|
|
140
|
+
// A → B → A needs one RecursiveType: B is inlined under A's binder.
|
|
141
|
+
const T = typeFromJsonSchema({
|
|
142
|
+
$ref: "#/$defs/A",
|
|
143
|
+
$defs: {
|
|
144
|
+
A: {
|
|
145
|
+
type: "object", properties: { b: { $ref: "#/$defs/B" } },
|
|
146
|
+
required: ["b"], additionalProperties: false,
|
|
147
|
+
},
|
|
148
|
+
B: {
|
|
149
|
+
type: "object", properties: { a: { $ref: "#/$defs/A" } },
|
|
150
|
+
required: ["a"], additionalProperties: false,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
const want = RecursiveType((self) => StructType({ b: StructType({ a: self }) }));
|
|
155
|
+
assert.ok(isTypeEqual(T, want), `got ${printType(T)}`);
|
|
156
|
+
});
|
|
157
|
+
test("binds a cycle through an array alias, the ordinary recursive shape", () => {
|
|
158
|
+
// Node → NodeList → Node is how recursive schemas are usually
|
|
159
|
+
// written (the JSON Schema meta-schemas do it), and it is one East
|
|
160
|
+
// type with the alias inlined.
|
|
161
|
+
const $defs = {
|
|
162
|
+
Node: {
|
|
163
|
+
type: "object", properties: { children: { $ref: "#/$defs/NodeList" } },
|
|
164
|
+
required: ["children"], additionalProperties: false,
|
|
165
|
+
},
|
|
166
|
+
NodeList: { type: "array", items: { $ref: "#/$defs/Node" } },
|
|
167
|
+
};
|
|
168
|
+
const node = RecursiveType((self) => StructType({ children: ArrayType(self) }));
|
|
169
|
+
const T = typeFromJsonSchema({ $ref: "#/$defs/Node", $defs });
|
|
170
|
+
assert.ok(isTypeEqual(T, node), `got ${printType(T)}`);
|
|
171
|
+
// Entered at the alias, the same node is read as an array of it.
|
|
172
|
+
const list = typeFromJsonSchema({ $ref: "#/$defs/NodeList", $defs });
|
|
173
|
+
assert.ok(isTypeEqual(list, ArrayType(node)), `got ${printType(list)}`);
|
|
174
|
+
});
|
|
175
|
+
test("shares a cyclic alias referenced from outside its cycle", () => {
|
|
176
|
+
const T = typeFromJsonSchema({
|
|
177
|
+
$ref: "#/$defs/Root",
|
|
178
|
+
$defs: {
|
|
179
|
+
Root: {
|
|
180
|
+
type: "object",
|
|
181
|
+
properties: { a: { $ref: "#/$defs/NodeList" }, b: { $ref: "#/$defs/Node" } },
|
|
182
|
+
required: ["a", "b"], additionalProperties: false,
|
|
183
|
+
},
|
|
184
|
+
Node: {
|
|
185
|
+
type: "object", properties: { children: { $ref: "#/$defs/NodeList" } },
|
|
186
|
+
required: ["children"], additionalProperties: false,
|
|
187
|
+
},
|
|
188
|
+
NodeList: { type: "array", items: { $ref: "#/$defs/Node" } },
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
const node = RecursiveType((self) => StructType({ children: ArrayType(self) }));
|
|
192
|
+
assert.ok(isTypeEqual(T, StructType({ a: ArrayType(node), b: node })), `got ${printType(T)}`);
|
|
193
|
+
});
|
|
194
|
+
test("refuses a cycle group that needs two binders, naming its members", () => {
|
|
195
|
+
// Both definitions loop on themselves and on each other, so no one
|
|
196
|
+
// definition lies on every cycle — East cannot bind that.
|
|
197
|
+
refuses({
|
|
198
|
+
$ref: "#/$defs/A",
|
|
199
|
+
$defs: {
|
|
200
|
+
A: {
|
|
201
|
+
type: "object",
|
|
202
|
+
properties: { a: { $ref: "#/$defs/A" }, b: { $ref: "#/$defs/B" } },
|
|
203
|
+
required: ["a", "b"], additionalProperties: false,
|
|
204
|
+
},
|
|
205
|
+
B: {
|
|
206
|
+
type: "object",
|
|
207
|
+
properties: { a: { $ref: "#/$defs/A" }, b: { $ref: "#/$defs/B" } },
|
|
208
|
+
required: ["a", "b"], additionalProperties: false,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
}, /definitions "A" and "B" are mutually recursive in a way East cannot express/, "/$defs/A");
|
|
212
|
+
});
|
|
213
|
+
test("decides recursion by reachability, never by the order references appear in", () => {
|
|
214
|
+
// Every ordering of the self and cross references is refused the
|
|
215
|
+
// same way, with the same pointer.
|
|
216
|
+
const props = (selfFirst, self, other) => selfFirst
|
|
217
|
+
? { self: { $ref: `#/$defs/${self}` }, other: { $ref: `#/$defs/${other}` } }
|
|
218
|
+
: { other: { $ref: `#/$defs/${other}` }, self: { $ref: `#/$defs/${self}` } };
|
|
219
|
+
for (const aSelfFirst of [true, false]) {
|
|
220
|
+
for (const bSelfFirst of [true, false]) {
|
|
221
|
+
refuses({
|
|
222
|
+
$ref: "#/$defs/A",
|
|
223
|
+
$defs: {
|
|
224
|
+
A: { type: "object", properties: props(aSelfFirst, "A", "B"), required: ["self", "other"], additionalProperties: false },
|
|
225
|
+
B: { type: "object", properties: props(bSelfFirst, "B", "A"), required: ["self", "other"], additionalProperties: false },
|
|
226
|
+
},
|
|
227
|
+
}, /mutually recursive in a way East cannot express/, "/$defs/A");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
test("treats a definition that is not a schema object as an error at its pointer", () => {
|
|
232
|
+
refuses({ $ref: "#/$defs/L", $defs: { L: null } }, /expected definition "L" to be a schema object/, "/$defs/L");
|
|
233
|
+
});
|
|
234
|
+
test("refuses a reference it cannot resolve", () => {
|
|
235
|
+
refuses({ $ref: "#/$defs/Nope" }, /no such definition/, "/$ref");
|
|
236
|
+
refuses({ $ref: "https://example.com/other.json" }, /only local #\/\$defs\/… references are supported/, "/$ref");
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
describe("the declared release", () => {
|
|
240
|
+
test("honours $schema on the releases it emits", () => {
|
|
241
|
+
for (const draft of ["2020-12", "draft-07"]) {
|
|
242
|
+
const schema = jsonSchemaFor(ArrayType(IntegerType), { draft });
|
|
243
|
+
assert.ok(schema["$schema"] !== undefined, `${draft} must stamp $schema`);
|
|
244
|
+
assert.ok(isTypeEqual(typeFromJsonSchema(schema), ArrayType(IntegerType)));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
test("accepts a fragment carrying no $schema", () => {
|
|
248
|
+
// An OpenAPI 3.0 schema object lives inside an OpenAPI document and
|
|
249
|
+
// carries no $schema of its own, so requiring one would reject what
|
|
250
|
+
// jsonSchemaFor emits for that release.
|
|
251
|
+
const schema = jsonSchemaFor(ArrayType(IntegerType), { draft: "openapi-3.0" });
|
|
252
|
+
assert.equal(schema["$schema"], undefined);
|
|
253
|
+
assert.ok(isTypeEqual(typeFromJsonSchema(schema), ArrayType(IntegerType)));
|
|
254
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "string" }), StringType));
|
|
255
|
+
});
|
|
256
|
+
test("refuses a release it cannot read, rather than guessing", () => {
|
|
257
|
+
refuses({ $schema: "http://json-schema.org/draft-04/schema#", type: "string" }, /cannot read the JSON Schema release/, "/$schema");
|
|
258
|
+
refuses({ $schema: "https://json-schema.org/draft/2019-09/schema", type: "string" }, /cannot read the JSON Schema release/, "/$schema");
|
|
259
|
+
});
|
|
260
|
+
test("ignores the scheme and a trailing # in $schema", () => {
|
|
261
|
+
// Neither is significant in a $schema value, and producers vary.
|
|
262
|
+
for (const uri of [
|
|
263
|
+
"https://json-schema.org/draft/2020-12/schema",
|
|
264
|
+
"http://json-schema.org/draft/2020-12/schema#",
|
|
265
|
+
"http://json-schema.org/draft-07/schema#",
|
|
266
|
+
"https://json-schema.org/draft-07/schema",
|
|
267
|
+
]) {
|
|
268
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ $schema: uri, type: "string" }), StringType), uri);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
test("refuses a non-string $schema", () => {
|
|
272
|
+
refuses({ $schema: 7, type: "string" }, /expected "\$schema" to be a string/, "/$schema");
|
|
273
|
+
});
|
|
274
|
+
test("resolves draft-07 definitions even though it declares them", () => {
|
|
275
|
+
const T = typeFromJsonSchema({
|
|
276
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
277
|
+
$ref: "#/definitions/Leaf",
|
|
278
|
+
definitions: { Leaf: { type: "string" } },
|
|
279
|
+
});
|
|
280
|
+
assert.ok(isTypeEqual(T, StringType));
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
describe("keywords East cannot express", () => {
|
|
284
|
+
const unsupported = [
|
|
285
|
+
["allOf", { type: "object", allOf: [{ type: "string" }] }, /have no intersection/, "/allOf"],
|
|
286
|
+
["not", { not: { type: "string" } }, /have no negation/, "/not"],
|
|
287
|
+
["anyOf", { anyOf: [{ type: "string" }] }, /variants are discriminated/, "/anyOf"],
|
|
288
|
+
["if", { if: { type: "string" }, then: { type: "string" } }, /have no conditionals/, "/if"],
|
|
289
|
+
["patternProperties",
|
|
290
|
+
{ type: "object", patternProperties: { "^a": { type: "string" } } },
|
|
291
|
+
/no pattern-keyed record/, "/patternProperties"],
|
|
292
|
+
["prefixItems",
|
|
293
|
+
{ type: "array", prefixItems: [{ type: "string" }] },
|
|
294
|
+
/no tuple type/, "/prefixItems"],
|
|
295
|
+
];
|
|
296
|
+
for (const [name, schema, message, pointer] of unsupported) {
|
|
297
|
+
test(`refuses ${name}, naming the keyword and its pointer`, () => {
|
|
298
|
+
refuses(schema, message, pointer);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
test("refuses an open record", () => {
|
|
302
|
+
refuses({ type: "object", properties: { a: { type: "string" } }, required: ["a"] }, /East structs are closed/);
|
|
303
|
+
});
|
|
304
|
+
test("refuses an optional property, pointing at it", () => {
|
|
305
|
+
refuses({
|
|
306
|
+
type: "object",
|
|
307
|
+
properties: { a: { type: "string" }, b: { type: "string" } },
|
|
308
|
+
required: ["a"],
|
|
309
|
+
additionalProperties: false,
|
|
310
|
+
}, /"b" is optional.*model it as an Option/, "/properties/b");
|
|
311
|
+
});
|
|
312
|
+
test("refuses a union of primitive types", () => {
|
|
313
|
+
refuses({ type: ["string", "null"] }, /East unions are discriminated variants/, "/type");
|
|
314
|
+
});
|
|
315
|
+
test("refuses nullable beside a type, rather than dropping it", () => {
|
|
316
|
+
// East JSON has no bare null for a String, so accepting this would
|
|
317
|
+
// admit a contract whose nulls the reader then refuses.
|
|
318
|
+
refuses({ type: "string", nullable: true }, /cannot express "nullable" beside a type/, "/nullable");
|
|
319
|
+
refuses({ $ref: "#/$defs/L", nullable: true, $defs: { L: { type: "string" } } }, /cannot express "nullable" beside a type/, "/nullable");
|
|
320
|
+
refuses({
|
|
321
|
+
nullable: true,
|
|
322
|
+
oneOf: [{
|
|
323
|
+
type: "object", properties: { type: { const: "ok" }, value: { type: "integer" } },
|
|
324
|
+
required: ["type", "value"], additionalProperties: false,
|
|
325
|
+
}],
|
|
326
|
+
}, /cannot express "nullable" beside a type/, "/nullable");
|
|
327
|
+
// `nullable: false` asserts nothing.
|
|
328
|
+
assert.ok(isTypeEqual(typeFromJsonSchema({ type: "string", nullable: false }), StringType));
|
|
329
|
+
});
|
|
330
|
+
test("treats an explicit null as present, never as absent", () => {
|
|
331
|
+
// A null is a value the document carries; refusing it at its own
|
|
332
|
+
// pointer is what keeps the two language twins reading alike.
|
|
333
|
+
refuses({ type: "array", items: null }, /expected items to be a schema object/, "/items");
|
|
334
|
+
refuses({ $schema: null, type: "string" }, /expected "\$schema" to be a string/, "/$schema");
|
|
335
|
+
refuses({ type: null }, /does not recognise the type "null"/, "/type");
|
|
336
|
+
refuses({ type: null, nullable: true }, /cannot express "nullable" beside a type/, "/nullable");
|
|
337
|
+
refuses({ type: "object", properties: null, additionalProperties: false }, /expected properties to be a schema object/, "/properties");
|
|
338
|
+
refuses({
|
|
339
|
+
oneOf: [{
|
|
340
|
+
type: "object", properties: { type: { const: "ok" }, value: null },
|
|
341
|
+
required: ["type", "value"], additionalProperties: false,
|
|
342
|
+
}],
|
|
343
|
+
}, /expected value to be a schema object/, "/oneOf/0/properties/value");
|
|
344
|
+
});
|
|
345
|
+
test("ignores entries of required that are not names", () => {
|
|
346
|
+
refuses({
|
|
347
|
+
type: "object",
|
|
348
|
+
properties: { a: { type: "string" } },
|
|
349
|
+
required: [["a"], 7, null],
|
|
350
|
+
additionalProperties: false,
|
|
351
|
+
}, /"a" is optional/, "/properties/a");
|
|
352
|
+
});
|
|
353
|
+
test("refuses an unconstrained schema", () => {
|
|
354
|
+
refuses({ description: "anything at all" }, /an unconstrained schema has no East type/);
|
|
355
|
+
});
|
|
356
|
+
test("refuses an untagged oneOf", () => {
|
|
357
|
+
refuses({ oneOf: [{ type: "string" }, { type: "number" }] }, /an untagged union is not an East variant/, "/oneOf/0");
|
|
358
|
+
});
|
|
359
|
+
test("points into the document, not just at the root", () => {
|
|
360
|
+
refuses({
|
|
361
|
+
type: "array",
|
|
362
|
+
items: {
|
|
363
|
+
type: "object",
|
|
364
|
+
properties: { inner: { not: { type: "string" } } },
|
|
365
|
+
required: ["inner"],
|
|
366
|
+
additionalProperties: false,
|
|
367
|
+
},
|
|
368
|
+
}, /have no negation/, "/items/properties/inner/not");
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
//# sourceMappingURL=json_schema_to_type.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_schema_to_type.spec.js","sourceRoot":"","sources":["../../../src/serialization/json_schema_to_type.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EACH,SAAS,EACT,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,GAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAyC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,M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