@@ -17,11 +17,11 @@ export function getBlankObject(schema) {
1717 else if ( type === 'object' )
1818 keys [ key ] = getBlankObject ( value ) ;
1919 else if ( type === 'boolean' )
20- keys [ key ] = false ;
20+ keys [ key ] = schema . default || false ;
2121 else if ( type === 'integer' || type === 'number' )
22- keys [ key ] = null ;
22+ keys [ key ] = schema . default || null ;
2323 else // string etc.
24- keys [ key ] = '' ;
24+ keys [ key ] = schema . default || '' ;
2525 }
2626
2727 return keys ;
@@ -42,11 +42,11 @@ export function getBlankArray(schema) {
4242 else if ( type === 'object' )
4343 items . push ( getBlankObject ( schema . items ) ) ;
4444 else if ( type === 'boolean' )
45- items . push ( false ) ;
45+ items . push ( schema . default || false ) ;
4646 else if ( type === 'integer' || type === 'number' )
47- items . push ( null ) ;
47+ items . push ( schema . default || null ) ;
4848 else // string, etc.
49- items . push ( '' ) ;
49+ items . push ( schema . default || '' ) ;
5050
5151 return items ;
5252}
@@ -65,11 +65,11 @@ export function getBlankData(schema) {
6565 else if ( type === 'object' )
6666 return getBlankObject ( schema ) ;
6767 else if ( type === 'boolean' )
68- return false ;
68+ return schema . default || false ;
6969 else if ( type === 'integer' || type === 'number' )
70- return null ;
70+ return schema . default || null ;
7171 else // string, etc.
72- return '' ;
72+ return schema . default || '' ;
7373}
7474
7575
0 commit comments