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 ae338ae

Browse files
committed
v6.0.0 πŸš€
1 parent 9ada3d1 commit ae338ae

File tree

9 files changed

+242
-224
lines changed

9 files changed

+242
-224
lines changed

β€Ž__tests__/GhIssue8_test.resβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ test("Regression test", t => {
2525
jsonSchema->JSONSchema.toRescriptSchema->S.inline,
2626
`S.object(s =>
2727
{
28-
"page": s.field("page", S.option(S.float->S.Float.min(1., ~message="Number must be greater than or equal to 1"))->S.Option.getOr(%raw(\`1\`))),
29-
"limit": s.field("limit", S.option(S.float->S.Float.min(1., ~message="Number must be greater than or equal to 1"))->S.Option.getOr(%raw(\`100\`))),
28+
"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\`))),
29+
"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\`))),
3030
}
3131
)->S.Object.strict`,
3232
)

β€Ž__tests__/JSONSchema_test.resβ€Ž

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test("Schema of string schema", t => {
1919
})
2020

2121
test("Schema of string schema with Email refinement", t => {
22-
let schema = S.string->S.String.email
22+
let schema = S.string->S.email
2323

2424
t->Assert.deepEqual(
2525
JSONSchema.make(schema),
@@ -34,7 +34,7 @@ test("Schema of string schema with Email refinement", t => {
3434
})
3535

3636
test("Schema of string schema with Url refinement", t => {
37-
let schema = S.string->S.String.url
37+
let schema = S.string->S.url
3838

3939
t->Assert.deepEqual(
4040
JSONSchema.make(schema),
@@ -49,7 +49,7 @@ test("Schema of string schema with Url refinement", t => {
4949
})
5050

5151
test("Schema of string schema with Datetime refinement", t => {
52-
let schema = S.string->S.String.datetime
52+
let schema = S.string->S.datetime
5353

5454
t->Assert.deepEqual(
5555
JSONSchema.make(schema),
@@ -64,7 +64,7 @@ test("Schema of string schema with Datetime refinement", t => {
6464
})
6565

6666
test("Schema of string schema uses the last refinement for format", t => {
67-
let schema = S.string->S.String.email->S.String.datetime
67+
let schema = S.string->S.email->S.datetime
6868

6969
t->Assert.deepEqual(
7070
JSONSchema.make(schema),
@@ -79,7 +79,7 @@ test("Schema of string schema uses the last refinement for format", t => {
7979
})
8080

8181
test("Schema of string schema with Cuid refinement", t => {
82-
let schema = S.string->S.String.cuid
82+
let schema = S.string->S.cuid
8383

8484
t->Assert.deepEqual(
8585
JSONSchema.make(schema),
@@ -93,7 +93,7 @@ test("Schema of string schema with Cuid refinement", t => {
9393
})
9494

9595
test("Schema of string schema with Uuid refinement", t => {
96-
let schema = S.string->S.String.uuid
96+
let schema = S.string->S.uuid
9797

9898
t->Assert.deepEqual(
9999
JSONSchema.make(schema),
@@ -108,7 +108,7 @@ test("Schema of string schema with Uuid refinement", t => {
108108
})
109109

110110
test("Schema of string schema with Pattern refinement", t => {
111-
let schema = S.string->S.String.pattern(%re("/abc/g"))
111+
let schema = S.string->S.pattern(%re("/abc/g"))
112112

113113
t->Assert.deepEqual(
114114
JSONSchema.make(schema),
@@ -123,7 +123,7 @@ test("Schema of string schema with Pattern refinement", t => {
123123
})
124124

125125
test("Schema of string schema with Min refinement", t => {
126-
let schema = S.string->S.String.min(1)
126+
let schema = S.string->S.stringMinLength(1)
127127

128128
t->Assert.deepEqual(
129129
JSONSchema.make(schema),
@@ -138,7 +138,7 @@ test("Schema of string schema with Min refinement", t => {
138138
})
139139

140140
test("Schema of string schema with Max refinement", t => {
141-
let schema = S.string->S.String.max(1)
141+
let schema = S.string->S.stringMaxLength(1)
142142

143143
t->Assert.deepEqual(
144144
JSONSchema.make(schema),
@@ -153,7 +153,7 @@ test("Schema of string schema with Max refinement", t => {
153153
})
154154

155155
test("Schema of string schema with Length refinement", t => {
156-
let schema = S.string->S.String.length(1)
156+
let schema = S.string->S.stringLength(1)
157157

158158
t->Assert.deepEqual(
159159
JSONSchema.make(schema),
@@ -169,7 +169,7 @@ test("Schema of string schema with Length refinement", t => {
169169
})
170170

171171
test("Schema of string schema with both Min and Max refinements", t => {
172-
let schema = S.string->S.String.min(1)->S.String.max(4)
172+
let schema = S.string->S.stringMinLength(1)->S.stringMaxLength(4)
173173

174174
t->Assert.deepEqual(
175175
JSONSchema.make(schema),
@@ -194,7 +194,7 @@ test("Schema of int schema", t => {
194194
})
195195

196196
test("Schema of int schema with Min refinement", t => {
197-
let schema = S.int->S.Int.min(1)
197+
let schema = S.int->S.intMin(1)
198198

199199
t->Assert.deepEqual(
200200
JSONSchema.make(schema),
@@ -209,7 +209,7 @@ test("Schema of int schema with Min refinement", t => {
209209
})
210210

211211
test("Schema of int schema with Max refinement", t => {
212-
let schema = S.int->S.Int.max(1)
212+
let schema = S.int->S.intMax(1)
213213

214214
t->Assert.deepEqual(
215215
JSONSchema.make(schema),
@@ -224,7 +224,7 @@ test("Schema of int schema with Max refinement", t => {
224224
})
225225

226226
test("Schema of int schema with Port refinement", t => {
227-
let schema = S.int->S.Int.port
227+
let schema = S.int->S.port
228228

229229
t->Assert.deepEqual(
230230
JSONSchema.make(schema),
@@ -247,7 +247,7 @@ test("Schema of float schema", t => {
247247
})
248248

249249
test("Schema of float schema with Min refinement", t => {
250-
let schema = S.float->S.Float.min(1.)
250+
let schema = S.float->S.floatMin(1.)
251251

252252
t->Assert.deepEqual(
253253
JSONSchema.make(schema),
@@ -262,7 +262,7 @@ test("Schema of float schema with Min refinement", t => {
262262
})
263263

264264
test("Schema of float schema with Max refinement", t => {
265-
let schema = S.float->S.Float.max(1.)
265+
let schema = S.float->S.floatMax(1.)
266266

267267
t->Assert.deepEqual(
268268
JSONSchema.make(schema),
@@ -452,7 +452,7 @@ test("Schema of strings array schema", t => {
452452
})
453453

454454
test("Schema of array schema with Min refinement", t => {
455-
let schema = S.array(S.string)->S.Array.min(1)
455+
let schema = S.array(S.string)->S.arrayMinLength(1)
456456

457457
t->Assert.deepEqual(
458458
JSONSchema.make(schema),
@@ -468,7 +468,7 @@ test("Schema of array schema with Min refinement", t => {
468468
})
469469

470470
test("Schema of array schema with Max refinement", t => {
471-
let schema = S.array(S.string)->S.Array.max(1)
471+
let schema = S.array(S.string)->S.arrayMaxLength(1)
472472

473473
t->Assert.deepEqual(
474474
JSONSchema.make(schema),
@@ -484,7 +484,7 @@ test("Schema of array schema with Max refinement", t => {
484484
})
485485

486486
test("Schema of array schema with Length refinement", t => {
487-
let schema = S.array(S.string)->S.Array.length(1)
487+
let schema = S.array(S.string)->S.arrayLength(1)
488488

489489
t->Assert.deepEqual(
490490
JSONSchema.make(schema),
@@ -862,7 +862,7 @@ test("Unknown schema doesn't affect final schema", t => {
862862
})
863863

864864
test("JSON schema doesn't affect final schema", t => {
865-
let schema = S.json
865+
let schema = S.json(~validate=false)
866866

867867
t->Assert.deepEqual(
868868
JSONSchema.make(schema),

β€Žonline/package-lock.jsonβ€Ž

Lines changed: 23 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žonline/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"react-dom": "18.2.0",
1818
"rescript": "11.1.1",
1919
"rescript-json-schema": "./vendor/rescript-json-schema",
20-
"rescript-schema": "6.3.0"
20+
"rescript-schema": "7.0.0"
2121
},
2222
"devDependencies": {
2323
"@jihchi/vite-plugin-rescript": "^5.3.1",

β€Žpackage-lock.jsonβ€Ž

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackage.jsonβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rescript-json-schema",
3-
"version": "5.0.0",
3+
"version": "6.0.0",
44
"description": "Typesafe JSON Schema for ReScript",
55
"keywords": [
66
"rescript",
@@ -42,11 +42,11 @@
4242
"@dzakh/rescript-ava": "3.0.0",
4343
"ava": "5.2.0",
4444
"rescript": "11.1.1",
45-
"rescript-schema": "6.3.0",
45+
"rescript-schema": "7.0.0",
4646
"c8": "8.0.1"
4747
},
4848
"peerDependencies": {
4949
"rescript": "11.x",
50-
"rescript-schema": "6.x"
50+
"rescript-schema": "7.x"
5151
}
5252
}
File renamed without changes.

0 commit comments

Comments
Β (0)