forked from microsoft/typespec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtuples.test.ts
36 lines (35 loc) · 858 Bytes
/
tuples.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { deepStrictEqual } from "assert";
import { describe, it } from "vitest";
import { emitSchema } from "./utils.js";
describe("jsonschema: tuples", () => {
it("emit tuples as items", async () => {
const schemas = await emitSchema(`
model Foo {
a: [string, int32]
}
`);
deepStrictEqual(schemas, {
"Foo.json": {
$id: "Foo.json",
$schema: "https://json-schema.org/draft/2020-12/schema",
type: "object",
required: ["a"],
properties: {
a: {
type: "array",
prefixItems: [
{
type: "string",
},
{
type: "integer",
minimum: -2147483648,
maximum: 2147483647,
},
],
},
},
},
});
});
});