Skip to content

Commit 1d47cb1

Browse files
committed
scrap the manual treatment of the date scalar and treat it only as a user-defined scalar
1 parent 957cf58 commit 1d47cb1

File tree

3 files changed

+0
-32
lines changed

3 files changed

+0
-32
lines changed

graphql-api-generator/generator.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ def run(schema: GraphQLSchema, config: dict):
7272
if config.get('generation').get('generate_datetime'):
7373
datetime_control(schema)
7474

75-
# TODO: Remove this when we scrap the Date scalar
76-
# check if Date exists, or should be added
77-
if config.get('generation').get('generate_date'):
78-
date_control(schema)
79-
8075
# add reverse edges for traversal
8176
if config.get('generation').get('reverse_edges'):
8277
schema = add_reverse_edges(schema)
@@ -278,20 +273,6 @@ def datetime_control(schema):
278273
raise Exception('DateTime could not be added as scalar!')
279274

280275

281-
# TODO: Remove this when we scrap the Date scalar
282-
def date_control(schema):
283-
type_names = set(schema.type_map.keys())
284-
if 'Date' in type_names:
285-
if not is_scalar_type(schema.type_map['Date']):
286-
raise Exception('Date exists but is not scalar type: ' + schema.type_map['Date'])
287-
else:
288-
schema.type_map['Date'] = GraphQLScalarType('Date')
289-
if not is_scalar_type(schema.type_map['Date']):
290-
raise Exception('Date could not be added as scalar!')
291-
292-
return False
293-
294-
295276
if __name__ == '__main__':
296277
parser = argparse.ArgumentParser()
297278
parser.add_argument('--input', type=str, required=True,

graphql-api-generator/resources/config.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ generation:
1212
add_mutation_type: true
1313
# add id field to all schema types
1414
field_for_id: true
15-
# add the Data scalar
16-
generate_date: true
1715
# add creation date and last update date field(s) to all schema types
1816
generate_datetime: true
1917
field_for_creation_date: true

graphql-api-generator/utils/utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -487,17 +487,6 @@ def add_scalar_filters(schema: GraphQLSchema, config: dict):
487487
' _neq: Boolean ' \
488488
'} '
489489

490-
# TODO: Scrap this when we remove the Date scalar
491-
# Date (behaves like a string)
492-
if config.get('generation').get('generate_date'):
493-
manually_handled_scalars.append('Date')
494-
make += 'input _DateFilter {' \
495-
' _eq: Date ' \
496-
' _neq: Date ' \
497-
' _in: [Date] ' \
498-
' _nin: [Date] ' \
499-
'} '
500-
501490
# DateTime (behaves like a integer)
502491
if config.get('generation').get('generate_datetime'):
503492
manually_handled_scalars.append('DateTime')

0 commit comments

Comments
 (0)