Skip to content

Commit

Permalink
fix: incorrect impl for array / tuple simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 6, 2023
1 parent b007d8e commit ab00aa9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "schemastery",
"description": "Type driven schema validator",
"version": "3.14.0",
"version": "3.14.1",
"main": "lib/index.cjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ declare global {
default(value: T): Schema<S, T>
comment(text: string): Schema<S, T>
description(text: string): Schema<S, T>
disabled(): Schema<S, T>
collapse(): Schema<S, T>
disabled(value?: boolean): Schema<S, T>
collapse(value?: boolean): Schema<S, T>
deprecated(): Schema<S, T>
experimental(): Schema<S, T>
pattern(regexp: RegExp): Schema<S, T>
Expand Down Expand Up @@ -290,11 +290,11 @@ Schema.prototype.simplify = function simplify(this: Schema, value) {
return result
} else if (this.type === 'array' || this.type === 'tuple') {
const result: any[] = []
for (const key of value) {
const schema = this.type === 'array' ? this.inner : this.list![key]
const item = schema ? schema.simplify(value[key]) : value[key]
;(value as any[]).forEach((value, index) => {
const schema = this.type === 'array' ? this.inner : this.list![index]
const item = schema ? schema.simplify(value) : value
result.push(item)
}
})
return result
} else if (this.type === 'intersect') {
const result: Dict = {}
Expand Down
2 changes: 1 addition & 1 deletion packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"vue": "^3"
},
"dependencies": {
"schemastery": "^3.14.0"
"schemastery": "^3.14.1"
}
}

0 comments on commit ab00aa9

Please sign in to comment.