File tree Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -765,12 +765,6 @@ function buildValue (location, input) {
765765 let funcName
766766
767767 if ( 'const' in schema ) {
768- if ( nullable ) {
769- code += `
770- json += ${ input } === null ? 'null' : '${ JSON . stringify ( schema . const ) } '
771- `
772- return code
773- }
774768 code += `json += '${ JSON . stringify ( schema . const ) } '`
775769 return code
776770 }
Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ test('schema with const and null as type', (t) => {
238238 foo : null
239239 } )
240240
241- t . equal ( output , '{"foo":null }' )
241+ t . equal ( output , '{"foo":"baz" }' )
242242 t . ok ( validate ( JSON . parse ( output ) ) , 'valid schema' )
243243
244244 const output2 = stringify ( { foo : 'baz' } )
@@ -262,7 +262,7 @@ test('schema with const as nullable', (t) => {
262262 foo : null
263263 } )
264264
265- t . equal ( output , '{"foo":null }' )
265+ t . equal ( output , '{"foo":"baz" }' )
266266 t . ok ( validate ( JSON . parse ( output ) ) , 'valid schema' )
267267
268268 const output2 = stringify ( {
You can’t perform that action at this time.
0 commit comments