Skip to content

Commit

Permalink
More test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrich committed May 15, 2024
1 parent baf3725 commit 683eae6
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 54 deletions.
7 changes: 4 additions & 3 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export class Schema<DataT, InputT extends SchemaData<DataT>, VerifiedT = InputT>
*/
public async verifyValue(init: SchemaVerifyValue): Promise<Fate<DataT | SchemaData<unknown>>> {
const fate = new Fate<DataT | SchemaData<unknown>>();
const currPath = init.path.mkChild(init.fieldId);

if (this.isBuiltIn(init.fieldType)) {
if (this.valueIsBuiltInType(init.fieldType, init.value)) {
Expand All @@ -230,7 +231,7 @@ export class Schema<DataT, InputT extends SchemaData<DataT>, VerifiedT = InputT>
return fate.setErrorCode(
schemaError(
`field_does_not_support_value_type:${valueTypeLabel(init.value)}`,
init.path.getValue()
currPath.getValue()
)
);
}
Expand All @@ -241,7 +242,7 @@ export class Schema<DataT, InputT extends SchemaData<DataT>, VerifiedT = InputT>
init.fieldId,
init.fieldType,
init.value as SchemaData<DataT>,
init.path,
currPath,
init.base
);
}
Expand All @@ -252,7 +253,7 @@ export class Schema<DataT, InputT extends SchemaData<DataT>, VerifiedT = InputT>
}

return fate.setErrorCode(
schemaError(`field_does_not_support_type:${init.fieldType}`, init.path.getValue())
schemaError(`field_does_not_support_type:${init.fieldType}`, currPath.getValue())
);
}

Expand Down
Loading

0 comments on commit 683eae6

Please sign in to comment.