Skip to content

Commit 3db6b3a

Browse files
committed
make generated DateTime appear as a user-defined scalar during output
1 parent faeb8a9 commit 3db6b3a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graphql-api-generator/generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ def datetime_control(schema):
269269
if not is_scalar_type(schema.type_map['DateTime']):
270270
raise Exception('DateTime exists but is not scalar type: ' + schema.type_map['DateTime'])
271271
else:
272-
schema.type_map['DateTime'] = GraphQLScalarType('DateTime')
272+
# ast_node definition ensures that DateTime appears as a user-defined scalar
273+
schema.type_map['DateTime'] = GraphQLScalarType('DateTime', ast_node=ScalarTypeDefinitionNode())
273274
if not is_scalar_type(schema.type_map['DateTime']):
274275
raise Exception('DateTime could not be added as scalar!')
275276

0 commit comments

Comments
 (0)