File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -89,9 +89,37 @@ class Convertor {
8989 }
9090 }
9191
92+ const convertDefaultValues = ( ) => {
93+ if ( schema . type === 'boolean' ) {
94+ if ( schema . default === 'true' || schema . default === 'false' ) {
95+ if ( schema . default === 'true' )
96+ schema . default = true
97+ else
98+ schema . default = false
99+ }
100+ }
101+
102+ if ( schema . type === 'number' || schema . type === 'integer' ) {
103+ if ( typeof schema . default === 'string' ) {
104+ schema . default = parseInt ( schema . default , 10 )
105+ }
106+ }
107+
108+ if ( schema . type === 'array' && schema . items === undefined ) {
109+ schema . items = { nullable : true }
110+ }
111+
112+ if ( schema . type === 'string' ) {
113+ if ( Object . keys ( schema ) . indexOf ( 'default' ) ) {
114+ schema . default = `${ schema . default } `
115+ }
116+ }
117+ }
118+
92119 convertNull ( )
93120 convertTypeArrays ( )
94121 bannedWordsRemoval ( )
122+ convertDefaultValues ( )
95123
96124 if ( this . specialProperties . indexOf ( parentKeyword ) !== - 1 ) {
97125 if ( this . ofProperties . indexOf ( parentKeyword ) !== - 1 ) {
You can’t perform that action at this time.
0 commit comments