Skip to content

Commit 9f63b61

Browse files
committed
Start with documentation schema validation. Refs #398
1 parent 29baa47 commit 9f63b61

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
"disparity": "^2.0.0",
2525
"doctrine": "^1.1.0",
2626
"documentation-theme-utils": "^3.0.0",
27-
"lodash": "^4.11.1",
2827
"events": "^1.1.0",
2928
"extend": "^3.0.0",
3029
"get-comments": "^1.0.1",
3130
"git-url-parse": "^6.0.1",
3231
"highlight.js": "^9.1.0",
3332
"js-yaml": "^3.3.1",
33+
"lodash": "^4.11.1",
3434
"mdast-util-inject": "^1.1.0",
3535
"micromatch": "^2.1.6",
3636
"mime": "^1.3.4",
@@ -58,7 +58,9 @@
5858
"chdir": "0.0.0",
5959
"eslint": "^2.0.0",
6060
"fs-extra": "^0.30.0",
61+
"documentation-schema": "0.0.1",
6162
"glob": "^7.0.0",
63+
"json-schema": "0.2.2",
6264
"mock-fs": "^3.5.0",
6365
"tap": "^5.4.4",
6466
"tmp": "0.0.28"

test/test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict';
22

33
var test = require('tap').test,
4+
documentationSchema = require('documentation-schema'),
5+
validate = require('json-schema'),
46
documentation = require('../'),
57
outputMarkdown = require('../lib/output/markdown.js'),
68
outputMarkdownAST = require('../lib/output/markdown_ast.js'),
@@ -147,6 +149,11 @@ test('outputs', function (ttt) {
147149

148150
tt.test('JSON', function (t) {
149151
normalize(result);
152+
result.forEach(function (comment) {
153+
validate(comment, documentationSchema.jsonSchema).errors.forEach(function (error) {
154+
t.ifError(error);
155+
});
156+
});
150157
var outputfile = file.replace('.input.js', '.output.json');
151158
if (UPDATE) {
152159
fs.writeFileSync(outputfile, JSON.stringify(result, null, 2));

0 commit comments

Comments
 (0)