Add deprecationReason to GraphQLDocumentation

This commit is contained in:
Tobe O 2018-08-03 17:51:30 -04:00
parent f43c6036eb
commit 398598e6fd
3 changed files with 6 additions and 2 deletions

View file

@ -57,6 +57,7 @@ main() async {
class Todo extends Model {
String text;
@GraphQLDocumentation(deprecationReason: 'Booleans are just *sooo* 2015!')
bool completed;
Todo({this.text, this.completed});

View file

@ -101,6 +101,7 @@ class GraphExceptionErrorLocation {
/// A metadata annotation used to provide documentation to `package:graphql_server`.
class GraphQLDocumentation {
final String description;
final String deprecationReason;
const GraphQLDocumentation({this.description});
const GraphQLDocumentation({this.description, this.deprecationReason});
}

View file

@ -163,8 +163,10 @@ String _getDeprecationReason(List<InstanceMirror> metadata) {
if (expires == deprecated.expires) {
return 'Expires after $expires';
} else {
deprecated.expires;
return deprecated.expires;
}
} else if (obj.reflectee is GraphQLDocumentation) {
return (obj.reflectee as GraphQLDocumentation).deprecationReason;
}
}