File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 3535 },
3636 "dependencies" : {
3737 "@apidevtools/json-schema-ref-parser" : " ^9.0.9" ,
38- "json-schema-walker" : " ^0 .0.4 " ,
38+ "json-schema-walker" : " ^1 .0.0 " ,
3939 "openapi-types" : " ^12.0.0" ,
4040 "yargs" : " ^17.5.1"
4141 },
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