Skip to content

Commit

Permalink
allow only string and undefined in IsDifferentValue decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
Elijah Baldwin committed Mar 5, 2024
1 parent 2479706 commit 09c37b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 558 deletions.
9 changes: 3 additions & 6 deletions chain-api/src/validators/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,10 @@ export function IsDifferentValue(property: string, validationOptions?: Validatio
const [relatedPropertyName] = args.constraints;
const relatedValue = args.object[relatedPropertyName];
if (
typeof value === "object" ||
typeof value === "function" ||
typeof relatedValue === "object" ||
typeof relatedValue === "function" ||
typeof value !== typeof relatedValue
(typeof value !== "string" && value !== undefined) ||
(typeof relatedValue !== "string" && relatedValue !== undefined)
) {
throw new NotImplementedError("IsDifferentValue only works with plain objects");
throw new NotImplementedError("IsDifferentValue only works with string or undefined");
}
return value !== relatedValue;
}
Expand Down
Loading

0 comments on commit 09c37b6

Please sign in to comment.