WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8aed057

Browse files
committed
v7.3.0 🚀 - Add d.ts file
1 parent 9c5a03b commit 8aed057

17 files changed

+1649
-4113
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import Ava from "ava";
4+
import * as JSONSchema from "../src/JSONSchema.res.mjs";
5+
import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
6+
7+
Ava("Regression test", (function (t) {
8+
var jsonSchema = {
9+
$schema: "http://json-schema.org/draft-07/schema#",
10+
type: "object",
11+
properties: {
12+
page: {
13+
type: "number",
14+
minimum: 1,
15+
default: 1
16+
},
17+
limit: {
18+
type: "number",
19+
minimum: 1,
20+
default: 100
21+
}
22+
},
23+
additionalProperties: false
24+
};
25+
t.deepEqual(S$RescriptSchema.inline(JSONSchema.toRescriptSchema(jsonSchema)), "S.object(s =>\n {\n \"page\": s.field(\"page\", S.option(S.float->S.floatMin(1., ~message=\"Number must be greater than or equal to 1\"))->S.Option.getOr(%raw(\`1\`))),\n \"limit\": s.field(\"limit\", S.option(S.float->S.floatMin(1., ~message=\"Number must be greater than or equal to 1\"))->S.Option.getOr(%raw(\`100\`))),\n }\n)->S.strict");
26+
}));
27+
28+
export {
29+
30+
}
31+
/* Not a pure module */
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import Ava from "ava";
4+
import * as JSONSchema7 from "../src/JSONSchema7.res.mjs";
5+
6+
Ava("Arrayable", (function (t) {
7+
t.deepEqual(JSONSchema7.Arrayable.classify([
8+
1,
9+
2
10+
]), {
11+
TAG: "Array",
12+
_0: [
13+
1,
14+
2
15+
]
16+
});
17+
t.deepEqual(JSONSchema7.Arrayable.classify(1), {
18+
TAG: "Single",
19+
_0: 1
20+
});
21+
}));
22+
23+
Ava("Definition", (function (t) {
24+
t.deepEqual(JSONSchema7.Definition.classify({
25+
title: "foo"
26+
}), {
27+
TAG: "Schema",
28+
_0: {
29+
title: "foo"
30+
}
31+
});
32+
t.deepEqual(JSONSchema7.Definition.classify(true), {
33+
TAG: "Boolean",
34+
_0: true
35+
});
36+
}));
37+
38+
Ava("Dependency", (function (t) {
39+
t.deepEqual({
40+
title: "foo"
41+
}, {
42+
title: "foo"
43+
});
44+
t.deepEqual([
45+
"field1",
46+
"field2"
47+
], [
48+
"field1",
49+
"field2"
50+
]);
51+
}));
52+
53+
export {
54+
55+
}
56+
/* Not a pure module */

0 commit comments

Comments
 (0)