Skip to content

Commit 03bd708

Browse files
committed
Extra test case for #6
1 parent be3d58f commit 03bd708

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

test/subschema.test.js

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use strict';
2+
3+
const convert = require('../');
4+
const should = require('should');
5+
6+
it('strips $id from all subschemas not just root`', () => {
7+
const schema = {
8+
$id: "https://foo/bla",
9+
$schema: "http://json-schema.org/draft-06/schema#",
10+
type: "object",
11+
properties: {
12+
foo: {
13+
$id: "/properties/foo",
14+
type: "array",
15+
items: {
16+
$id: "/properties/foo/items",
17+
type: "object",
18+
properties: {
19+
id: {
20+
$id: "/properties/foo/items/properties/id",
21+
type: "string",
22+
}
23+
}
24+
}
25+
}
26+
}
27+
};
28+
29+
const result = convert(schema);
30+
31+
should(result).deepEqual({
32+
type: "object",
33+
properties: {
34+
foo: {
35+
type: "array",
36+
items: {
37+
type: "object",
38+
properties: {
39+
id: {
40+
type: "string",
41+
}
42+
}
43+
}
44+
}
45+
}
46+
});
47+
});

0 commit comments

Comments
 (0)