File tree 1 file changed +47
-0
lines changed
1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments