SchemaDiff has no special/helpful handling for directives like @deprecated
See original GitHub issueVersion 11.0
Currently, SchemaDiff does not make any distinctions for changes which involve @deprecated
directives. This may be intended, but I was considering a use case where this is important information for an automated service registry. For example, the following change generates no meaningful events:
type Query { foo: TypeA }
-type TypeA { abc: String xyz: Int }
---
type Query { foo: TypeA }
+type TypeA { abc: String @deprecated xyz: Int }
Output:
14:22:26.799 [main] INFO - Infos count: 9
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg='Examining operation 'Query' ...', level=INFO, category=null, typeName='Query', typeKind=Operation, fieldName=null}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg='Examining type 'Query' ...', level=INFO, category=null, typeName='Query', typeKind=Object, fieldName=null}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'Query.foo' ...', level=INFO, category=null, typeName='Query', typeKind=Object, fieldName=foo}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg='Examining type 'TypeA' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=null}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.abc' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=abc}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.xyz' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=xyz}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.abc' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=abc}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.xyz' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=xyz}
14:22:26.807 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'Query.foo' ...', level=INFO, category=null, typeName='Query', typeKind=Object, fieldName=foo}
14:22:26.808 [main] WARN - Danger count: 0
14:22:26.808 [main] ERROR - Breakage count: 0
In addition, it would be desirable to see a special handling of a breaking change involving a deprecated field. In the case of the automated service registry I mentioned, it’s possible to allow such a breaking change only if the service had deprecated the field in a previous version. For example:
type Query { foo: TypeA }
-type TypeA { abc: String @deprecated xyz: Int }
---
type Query { foo: TypeA }
+type TypeA { xyz: Int }
Reports only a standard BREAKING
change
14:29:52.811 [main] INFO - Infos count: 8
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg='Examining operation 'Query' ...', level=INFO, category=null, typeName='Query', typeKind=Operation, fieldName=null}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg='Examining type 'Query' ...', level=INFO, category=null, typeName='Query', typeKind=Object, fieldName=null}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'Query.foo' ...', level=INFO, category=null, typeName='Query', typeKind=Object, fieldName=foo}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg='Examining type 'TypeA' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=null}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.abc' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=abc}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.xyz' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=xyz}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'TypeA.xyz' ...', level=INFO, category=null, typeName='TypeA', typeKind=Object, fieldName=xyz}
14:29:52.814 [main] INFO - DifferenceEvent{ reasonMsg=' Examining field 'Query.foo' ...', level=INFO, category=null, typeName='Query', typeKind=Object, fieldName=foo}
14:29:52.815 [main] WARN - Danger count: 0
14:29:52.815 [main] ERROR - Breakage count: 1
14:29:52.816 [main] ERROR - DifferenceEvent{ reasonMsg='The new API is missing the field 'TypeA.abc'', level=BREAKING, category=MISSING, typeName='TypeA', typeKind=Object, fieldName=abc}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Creating schema directives - Apollo GraphQL Docs
This is the definition for the @deprecated directive in the GraphQL spec. The directive takes one optional argument ( reason ) with a...
Read more >Deprecation - GraphQL - Dgraph
The @deprecated directive allows you to tag the schema definition of a field or enum value as deprecated with an optional reason.
Read more >Deprecating Schema | GraphQL Kotlin
GraphQL schemas supports deprecation directive on the fields (which correspond to Kotlin properties and functions), input fields and enum values ...
Read more >2021年01月_weixin_39946534的博客_CSDN博客
SchemaDiff has no special/helpful handling for directives like @deprecated. 2021-01-11. RVM Testing Setup - Original Title: It would be awesome if rvm used ......
Read more >Schema Directives – GraphQL Tools
directive @deprecated(reason: String = "No longer supported") on ... Exhaustive testing is essential, and using a typed language like ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
closing because the the referenced PR is merged.
@andimarek Opened #1610