File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -284,11 +284,8 @@ const FormElicitationCapabilitySchema = z.intersection(
284284const ElicitationCapabilitySchema = z . preprocess (
285285 value => {
286286 if ( value && typeof value === 'object' && ! Array . isArray ( value ) ) {
287- const recordValue = value as Record < string , unknown > ;
288- const hasForm = Object . prototype . hasOwnProperty . call ( recordValue , 'form' ) ;
289- const hasUrl = Object . prototype . hasOwnProperty . call ( recordValue , 'url' ) ;
290- if ( ! hasForm && ! hasUrl ) {
291- return { ...recordValue , form : { } } ;
287+ if ( Object . keys ( value as Record < string , unknown > ) . length === 0 ) {
288+ return { form : { } } ;
292289 }
293290 }
294291 return value ;
@@ -298,7 +295,7 @@ const ElicitationCapabilitySchema = z.preprocess(
298295 form : FormElicitationCapabilitySchema . optional ( ) ,
299296 url : AssertObjectSchema . optional ( )
300297 } ) ,
301- z . record ( z . string ( ) , z . unknown ( ) )
298+ z . record ( z . string ( ) , z . unknown ( ) ) . optional ( )
302299 )
303300) ;
304301
You can’t perform that action at this time.
0 commit comments