Skip to content

Commit

Permalink
fix(validator): fix for correctly validating boolean properties (fals…
Browse files Browse the repository at this point in the history
…e property does not fail required check anymore)
  • Loading branch information
ValiDraganescu committed Apr 24, 2020
1 parent e30f143 commit 8c3ddd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-openapi-router",
"version": "2.0.6",
"version": "2.0.7",
"description": "Multi purpose yet simple nodejs router with OpenAPI 3 compatibility for REST APIs",
"author": {
"name": "Vali Draganescu",
Expand Down
2 changes: 1 addition & 1 deletion src/validator/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const validateIsRequired = (
modelName: string,
modelKey: string
): string | null => {
if (propMeta.isRequired && !propertyValue) {
if (propMeta.isRequired && (propertyValue === undefined || propertyValue === null)) {
return `${modelName}.${modelKey} is required`;
}
return null;
Expand Down

0 comments on commit 8c3ddd5

Please sign in to comment.