@typeschema/class-validator
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -55,2 +55,11 @@ "use strict"; | ||
}); | ||
function getIssues(error, parentPath) { | ||
const path = [ | ||
...parentPath, | ||
Number.isInteger(+error.property) ? +error.property : error.property | ||
]; | ||
return Object.values(error.constraints ?? {}).map((message) => ({ message, path })).concat( | ||
error.children?.flatMap((childError) => getIssues(childError, path)) ?? [] | ||
); | ||
} | ||
var validationAdapter = async (schema) => { | ||
@@ -68,6 +77,3 @@ const { validate: validate2 } = await importValidationModule(); | ||
return { | ||
issues: errors.map((error) => ({ | ||
message: error.toString(), | ||
path: [error.property] | ||
})), | ||
issues: errors.flatMap((error) => getIssues(error, [])), | ||
success: false | ||
@@ -74,0 +80,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"//version": "This field is manually maintained.", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"//description": "This field is manually maintained.", | ||
@@ -8,0 +8,0 @@ "description": "Reusable adapter for class-validator classes", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12662
170