Skip to content

Commit

Permalink
Sub schema array result bug fixed.
Browse files Browse the repository at this point in the history
Incremented patch version for release.
  • Loading branch information
mbrich committed Jun 14, 2024
1 parent 1bf2867 commit 70e4b5c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.11.0] - 2024-05-13
## [0.11.1] - 2024-06-14
* Fixed sub-schema array processing not bubbling up their error state to the final verification result. Schema elements that failed to verify would not be added to the verified output, but would not report the failure.

## [0.11.0] - 2024-06-13
* Added support for arrays + recursive schemas together.
* Fixed type error caused by generic type mismatch.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@toreda/verify",
"version": "0.11.0",
"version": "0.11.1",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"repository": "https://github.com/toreda/verify",
Expand Down
17 changes: 12 additions & 5 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,22 @@ export class Schema<DataT, InputT extends SchemaData<DataT>, TransformedT = Inpu
tracer.child(`${field.name}[${i}]`),
base
);
i++;

if (result.ok()) {
data.push(result.data);
if (!result.ok()) {
fate.setErrorCode(result.errorCode());
break;
}

i++;
data.push(result.data);
}

fate.data = data;
return fate.setSuccess(true);
if (i === values.length) {
fate.setSuccess(true);
fate.data = data;
}

return fate;
}

public async verifyFieldValue(
Expand Down

0 comments on commit 70e4b5c

Please sign in to comment.