File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -308,6 +308,7 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
308308 id : false ,
309309 } ,
310310 disableUnique : buildSchemaOptions . disableUnique ,
311+ draftsEnabled : buildSchemaOptions . draftsEnabled ,
311312 } ,
312313 ) ,
313314 } ;
@@ -336,6 +337,7 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
336337 options : { _id : false , id : false } ,
337338 allowIDField : true ,
338339 disableUnique : buildSchemaOptions . disableUnique ,
340+ draftsEnabled : buildSchemaOptions . draftsEnabled ,
339341 } ,
340342 ) ] ,
341343 } ;
@@ -358,6 +360,7 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
358360 id : false ,
359361 } ,
360362 disableUnique : buildSchemaOptions . disableUnique ,
363+ draftsEnabled : buildSchemaOptions . draftsEnabled ,
361364 } ,
362365 ) ,
363366 } ;
@@ -376,6 +379,10 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
376379 } ) ,
377380 } ;
378381
382+ if ( buildSchemaOptions . draftsEnabled || ! field . required ) {
383+ baseSchema . enum . push ( null ) ;
384+ }
385+
379386 schema . add ( {
380387 [ field . name ] : localizeSchema (
381388 field ,
You can’t perform that action at this time.
0 commit comments