Skip to content

Commit d82c190

Browse files
authored
Merge pull request #459 from chrisfilo/fix/schema_val
Schema validator fixes
2 parents cd5f058 + b6cfff0 commit d82c190

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

utils/issues/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ var issues = {
8080
var severityMap = config.interpret(codes, options.config);
8181

8282
// organize by severity
83-
for (var key in categorized) {
84-
issue = categorized[key];
85-
issue.code = key;
83+
for (var code in categorized) {
84+
issue = categorized[code];
85+
issue.code = code;
8686

8787
if (severityMap.hasOwnProperty(issue.code)) {
8888
issue.severity = severityMap[issue.code];
@@ -93,7 +93,13 @@ var issues = {
9393
}
9494

9595
if (issue.severity === 'error') {
96-
errors.push(issue);
96+
// Schema validation issues will yield the JSON file invalid, we should display them first to attract
97+
// user attention.
98+
if (code == 55) {
99+
errors.unshift(issue);
100+
} else {
101+
errors.push(issue);
102+
}
97103
} else if (issue.severity === 'warning' && !options.ignoreWarnings) {
98104
warnings.push(issue);
99105
} else if (issue.severity === 'ignore') {

utils/issues/list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ module.exports = {
280280
55: {
281281
key: 'JSON_SCHEMA_VALIDATION_ERROR',
282282
severity: 'error',
283-
reason: 'JSON file is not formatted according the schema.'
283+
reason: 'Invalid JSON file. The file is not formatted according the schema.'
284284
},
285285
56: {
286286
key: 'Participants age 89 or higher',

validators/schemas/bold.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,5 @@
3333
"TaskName": {
3434
"type": "string"
3535
}
36-
},
37-
"required": [
38-
"TaskName",
39-
"RepetitionTime"
40-
]
41-
36+
}
4237
}

0 commit comments

Comments
 (0)