json_schema
json_schema copied to clipboard
Incorrect result of ValidationResults.toString()
Type
Bug
Details
The result of ValidationResults.toString() is incorrect due to wrong order in conditional operators.
class ValidationResults {
@override
String toString() {
return '${errors.isEmpty ? 'VALID' : 'INVALID'}${errors.isEmpty ? ', Errors: $errors' : ''}${warnings.isEmpty ? ', Warnings: $warnings' : ''}';
}
}
Possible Solution
class ValidationResults {
@override
String toString() {
return '${errors.isEmpty ? 'VALID' : 'INVALID'}${errors.isEmpty ? '' : ', Errors: $errors'}${warnings.isEmpty ? '' : ', Warnings: $warnings'}';
}
}