File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ class Convertor {
6969 obj . nullable = true
7070 } else {
7171 obj . type = type
72+ if ( schema ?. default ) {
73+ obj . default = schema . default
74+ delete schema . default
75+ }
76+
7277 for ( const property of Object . keys ( schema ) ) {
7378 if ( type === 'array' && property === 'items' ) {
7479 obj . items = schema [ property ]
@@ -110,7 +115,7 @@ class Convertor {
110115 }
111116
112117 if ( schema . type === 'string' ) {
113- if ( Object . keys ( schema ) . indexOf ( 'default' ) ) {
118+ if ( Object . keys ( schema ) . indexOf ( 'default' ) !== - 1 ) {
114119 schema . default = `${ schema . default } `
115120 }
116121 }
Original file line number Diff line number Diff line change 1010 "errors" : {
1111 "type" : [" string" , " null" ],
1212 "description" : " this is an errors object" ,
13- "example" : " Error occured here"
13+ "example" : " Error occured here" ,
14+ "default" : " hello world"
1415 },
1516 "error" : {
1617 "type" : [" object" , " null" ],
3637 "type" : " string"
3738 }
3839 }
40+ },
41+ "booleanThing" : {
42+ "type" : [" null" , " boolean" ],
43+ "default" : " false"
44+ },
45+ "otherBooleanThing" : {
46+ "type" : " boolean"
3947 }
4048 }
4149}
You can’t perform that action at this time.
0 commit comments