@@ -248,10 +248,11 @@ def add_input_to_create(schema: GraphQLSchema):
248
248
if not is_db_schema_defined_type (_type ) or is_interface_type (_type ):
249
249
continue
250
250
make += f'\n extend input _InputToCreate{ _type .name } {{\n '
251
+ num_fields = 0
251
252
for field_name , field in _type .fields .items ():
252
253
if field_name == 'id' or field_name [0 ] == '_' :
253
254
continue
254
-
255
+ num_fields += 1
255
256
inner_field_type = get_named_type (field .type )
256
257
257
258
if is_enum_or_scalar (inner_field_type ):
@@ -261,6 +262,8 @@ def add_input_to_create(schema: GraphQLSchema):
261
262
connect_name = f'_InputToConnect{ capitalize (field_name )} Of{ _type .name } '
262
263
connect = copy_wrapper_structure (schema .type_map [connect_name ], field .type )
263
264
make += f' { field_name } : { connect } \n '
265
+ if num_fields == 0 :
266
+ make += f' _dummy: String \n '
264
267
make += '}\n '
265
268
schema = add_to_schema (schema , make )
266
269
return schema
@@ -392,11 +395,12 @@ def add_input_update(schema: GraphQLSchema):
392
395
for _type in schema .type_map .values ():
393
396
if not is_db_schema_defined_type (_type ) or is_interface_type (_type ):
394
397
continue
398
+ num_fields = 0
399
+ update_name = f'_InputToUpdate{ _type .name } '
395
400
for field_name , field in _type .fields .items ():
396
401
if field_name == 'id' or field_name [0 ] == '_' :
397
402
continue
398
-
399
- update_name = f'_InputToUpdate{ _type .name } '
403
+ num_fields += 1
400
404
f_type = get_nullable_type (field .type )
401
405
inner_field_type = get_named_type (f_type )
402
406
@@ -407,6 +411,8 @@ def add_input_update(schema: GraphQLSchema):
407
411
connect_name = f'_InputToConnect{ capitalize (field_name )} Of{ _type .name } '
408
412
connect = copy_wrapper_structure (schema .get_type (connect_name ), f_type )
409
413
make += f'extend input { update_name } {{ { field_name } : { connect } }} \n '
414
+ if num_fields == 0 :
415
+ make += f'extend input { update_name } {{ _dummy: String }} \n '
410
416
schema = add_to_schema (schema , make )
411
417
return schema
412
418
@@ -886,6 +892,9 @@ def get_field_directives(field_name, _type, schema):
886
892
:return string:
887
893
"""
888
894
895
+ if field_name == '_dummy' :
896
+ return ''
897
+
889
898
output = ''
890
899
891
900
# Used to make sure we don't add the same directive multiple times to the same field
0 commit comments