@@ -23,24 +23,20 @@ def test_mix_n_match_records_schema(self):
2323 ]
2424 expected_schema = {
2525 'type' : ['null' , 'object' ],
26- 'properties' : {
27- 'a' : {'type' : { 'null' , 'integer' , ' string', 'boolean' } },
28- 'b' : {'type' : ['null' , 'string' ]},
29- 'c ' : {'type' : { 'null' , 'integer' , ' string'}, 'format' : 'singer.decimal' },
30- 'd ' : {
31- 'type' : { 'null' , 'array' , 'object' },
32- 'items ' : {'type ' : { 'null' , 'integer ' , 'string' }} ,
33- 'properties ' : {'one ' : {'type' : ['null' , 'integer' ]},
34- 'two' : {'type' : ['null' , 'string' ]}}
35-
36- }
37- }
26+ 'properties' : {'a' : { 'anyOf' : [{ 'type' : [ 'null' , 'integer' ]},
27+ {'type' : [ 'null' , 'string' ] },
28+ {'type' : ['null' , 'boolean' ]} ]},
29+ 'b ' : {'type' : [ 'null' , 'string' ] },
30+ 'c ' : {'anyOf' : [{ 'type' : [ 'null' , 'integer' ]},
31+ { 'type' : [ 'null' , 'string' ] , 'format' : 'singer.decimal' }] },
32+ 'd ' : {'anyOf ' : [{ 'type' : [ 'null ' , 'array' ] ,
33+ 'items ' : {'anyOf ' : [ {'type' : ['null' , 'integer' ]},
34+ {'type' : ['null' , 'string' ]}]}},
35+ { 'type' : [ 'null' , 'object' ],
36+ 'properties' : { 'one' : { 'type' : [ 'null' , 'integer' ]},
37+ 'two' : { 'type' : [ 'null' , 'string' ]}}}]} }
3838 }
3939 actual_schema = generate_schema (records )
40- actual_schema ['properties' ]['a' ]['type' ] = set (actual_schema ['properties' ]['a' ]['type' ])
41- actual_schema ['properties' ]['c' ]['type' ] = set (actual_schema ['properties' ]['c' ]['type' ])
42- actual_schema ['properties' ]['d' ]['type' ] = set (actual_schema ['properties' ]['d' ]['type' ])
43- actual_schema ['properties' ]['d' ]['items' ]['type' ] = set (actual_schema ['properties' ]['d' ]['items' ]['type' ])
4440 self .assertEqual (expected_schema , actual_schema )
4541
4642 def test_nested_structue_schema (self ):
0 commit comments