Skip to content

Commit ab00aa9

Browse files
committed
fix: incorrect impl for array / tuple simplification
1 parent b007d8e commit ab00aa9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "schemastery",
33
"description": "Type driven schema validator",
4-
"version": "3.14.0",
4+
"version": "3.14.1",
55
"main": "lib/index.cjs",
66
"module": "lib/index.mjs",
77
"typings": "lib/index.d.ts",

packages/core/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ declare global {
108108
default(value: T): Schema<S, T>
109109
comment(text: string): Schema<S, T>
110110
description(text: string): Schema<S, T>
111-
disabled(): Schema<S, T>
112-
collapse(): Schema<S, T>
111+
disabled(value?: boolean): Schema<S, T>
112+
collapse(value?: boolean): Schema<S, T>
113113
deprecated(): Schema<S, T>
114114
experimental(): Schema<S, T>
115115
pattern(regexp: RegExp): Schema<S, T>
@@ -290,11 +290,11 @@ Schema.prototype.simplify = function simplify(this: Schema, value) {
290290
return result
291291
} else if (this.type === 'array' || this.type === 'tuple') {
292292
const result: any[] = []
293-
for (const key of value) {
294-
const schema = this.type === 'array' ? this.inner : this.list![key]
295-
const item = schema ? schema.simplify(value[key]) : value[key]
293+
;(value as any[]).forEach((value, index) => {
294+
const schema = this.type === 'array' ? this.inner : this.list![index]
295+
const item = schema ? schema.simplify(value) : value
296296
result.push(item)
297-
}
297+
})
298298
return result
299299
} else if (this.type === 'intersect') {
300300
const result: Dict = {}

packages/form/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"vue": "^3"
2424
},
2525
"dependencies": {
26-
"schemastery": "^3.14.0"
26+
"schemastery": "^3.14.1"
2727
}
2828
}

0 commit comments

Comments
 (0)