Skip to content

Commit 9155b51

Browse files
committed
Added failing subschema test
1 parent 43e1872 commit 9155b51

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/nullable.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ it('adds `nullable: true` for `type: [string, null]`', () => {
1717
});
1818
});
1919

20+
21+
it('supports nullables inside sub-schemas', () => {
22+
const schema = {
23+
$schema: 'http://json-schema.org/draft-04/schema#',
24+
$oneOf: [
25+
{ type: 'string' },
26+
{ type: 'null' }
27+
]
28+
};
29+
30+
const result = convert(schema);
31+
32+
should(result).deepEqual({
33+
$oneOf: [
34+
{ type: 'string' },
35+
{ nullable: true }
36+
]
37+
});
38+
});
39+
2040
it('does not add nullable for non null types', () => {
2141
const schema = {
2242
$schema: 'http://json-schema.org/draft-04/schema#',

0 commit comments

Comments
 (0)