Skip to content

Commit

Permalink
Fixed validation forgetting about external data (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment authored May 18, 2024
1 parent 306f83a commit 781163c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/model-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function validateTypeImpl(
value: unknown,
prop: PropType,
name: string,
external: ExternalValidator = {}
external: ExternalValidator
): ErrorReport | string | undefined {
switch (prop.type) {
case 'number':
Expand Down Expand Up @@ -162,7 +162,7 @@ function validateTypeImpl(

for (let i = 0; i < arrayValue.length; i++) {
const item = arrayValue[i];
const itemError = validateType(item, prop.of, `${name}[${i}]`);
const itemError = validateTypeImpl(item, prop.of, `${name}[${i}]`, external);
if (itemError) return itemError;
}

Expand All @@ -186,7 +186,7 @@ function validateTypeImpl(
continue;
}

const subError = validateType(subValue, subProp, `${name}.${key}`);
const subError = validateTypeImpl(subValue, subProp, `${name}.${key}`, external);
if (subError) return subError;
}
if (prop.customValidate) {
Expand Down

0 comments on commit 781163c

Please sign in to comment.