File tree 2 files changed +29
-1
lines changed
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 35
35
},
36
36
"dependencies" : {
37
37
"@apidevtools/json-schema-ref-parser" : " ^9.0.9" ,
38
- "json-schema-walker" : " ^0 .0.4 " ,
38
+ "json-schema-walker" : " ^1 .0.0 " ,
39
39
"openapi-types" : " ^12.0.0" ,
40
40
"yargs" : " ^17.5.1"
41
41
},
Original file line number Diff line number Diff line change
1
+ import convert from '../src' ;
2
+
3
+ it ( 'supports default values of null' , async ( { expect } ) => {
4
+ const schema = {
5
+ $schema : 'http://json-schema.org/draft-04/schema#' ,
6
+ type : 'object' ,
7
+ properties : {
8
+ nullableStringWithDefault : {
9
+ default : null ,
10
+ oneOf : [ { type : 'string' } , { type : 'null' } ] ,
11
+ }
12
+ }
13
+ } ;
14
+
15
+ const result = await convert ( schema ) ;
16
+
17
+ const expected = {
18
+ type : 'object' ,
19
+ properties : {
20
+ nullableStringWithDefault : {
21
+ default : null ,
22
+ oneOf : [ { type : 'string' } , { nullable : true } ] ,
23
+ }
24
+ }
25
+ } ;
26
+
27
+ expect ( result ) . toEqual ( expected ) ;
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments