Skip to main content
Sign in
Snippets Groups Projects
Commit f98e2b47 authored by Anthony's avatar Anthony
Browse files

fix random order with examples

parent 95ba7412
Branches
Tags
No related merge requests found
......@@ -353,9 +353,18 @@ Schema.getExamples = function(filePath, schema){
return fs.readFileAsync(entry).then(example => {
var data = JSON.parse(example.toString());
var valid = validate(data);
if (valid) {examples.push(data);} else {logger.error(entry+' is an invalid Example');}
if (valid) {examples.push({ filename: entry, data: data });} else {logger.error(entry+' is an invalid Example');}
});
}).then(() => {
// Sort according to filenames in order not to have random prints
examples.sort(function(a, b) {
return a.filename > b.filename ? 1 : -1;
});
logger.error(examples);
examples = examples.map(function(element) {return element.data; });
schema.examples=examples;
return schema;
});
}).then(() => {schema.examples=examples; return schema; } );
} else {return schema;}
});
};
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment