@@ -291,11 +291,12 @@ def test_builds_a_schema_with_an_enum():
291
291
assert isinstance (clientFoodEnum , GraphQLEnumType )
292
292
293
293
assert clientFoodEnum .get_values () == [
294
- GraphQLEnumValue (name = 'VEGETABLES' , value = 'VEGETABLES' , description = 'Foods that are vegetables.' ),
295
- GraphQLEnumValue (name = 'FRUITS' , value = 'FRUITS' , description = 'Foods that are fruits.' ),
296
- GraphQLEnumValue (name = 'OILS' , value = 'OILS' , description = 'Foods that are oils.' ),
297
- GraphQLEnumValue (name = 'DAIRY' , value = 'DAIRY' , description = 'Foods that are dairy.' ),
298
- GraphQLEnumValue (name = 'MEAT' , value = 'MEAT' , description = 'Foods that are meat.' )
294
+ GraphQLEnumValue (name = 'VEGETABLES' , value = 'VEGETABLES' , description = 'Foods that are vegetables.' ,
295
+ deprecation_reason = None ),
296
+ GraphQLEnumValue (name = 'FRUITS' , value = 'FRUITS' , description = 'Foods that are fruits.' , deprecation_reason = None ),
297
+ GraphQLEnumValue (name = 'OILS' , value = 'OILS' , description = 'Foods that are oils.' , deprecation_reason = None ),
298
+ GraphQLEnumValue (name = 'DAIRY' , value = 'DAIRY' , description = 'Foods that are dairy.' , deprecation_reason = None ),
299
+ GraphQLEnumValue (name = 'MEAT' , value = 'MEAT' , description = 'Foods that are meat.' , deprecation_reason = None )
299
300
]
300
301
301
302
@@ -381,6 +382,40 @@ def test_builds_a_schema_with_field_arguments_with_default_values():
381
382
_test_schema (schema )
382
383
383
384
385
+ def test_builds_a_schema_aware_of_deprecation ():
386
+ schema = GraphQLSchema (
387
+ query = GraphQLObjectType (
388
+ name = 'Simple' ,
389
+ description = 'This is a simple type' ,
390
+ fields = OrderedDict ([
391
+ ('shinyString' , GraphQLField (
392
+ type = GraphQLString ,
393
+ description = 'This is a shiny string field'
394
+ )),
395
+ ('deprecatedString' , GraphQLField (
396
+ type = GraphQLString ,
397
+ description = 'This is a deprecated string field' ,
398
+ deprecation_reason = 'Use shinyString'
399
+ )),
400
+ ('color' , GraphQLField (
401
+ type = GraphQLEnumType (
402
+ name = 'Color' ,
403
+ values = OrderedDict ([
404
+ ('RED' , GraphQLEnumValue (description = 'So rosy' )),
405
+ ('GREEN' , GraphQLEnumValue (description = 'So grassy' )),
406
+ ('BLUE' , GraphQLEnumValue (description = 'So calming' )),
407
+ ('MAUVE' , GraphQLEnumValue (description = 'So sickening' ,
408
+ deprecation_reason = 'No longer in fashion' )),
409
+ ])
410
+ )
411
+ ))
412
+ ])
413
+ )
414
+ )
415
+
416
+ _test_schema (schema )
417
+
418
+
384
419
def test_cannot_use_client_schema_for_general_execution ():
385
420
customScalar = GraphQLScalarType (
386
421
name = 'CustomScalar' ,
0 commit comments