Add deprecationReason to GraphQLDocumentation
This commit is contained in:
parent
f43c6036eb
commit
398598e6fd
3 changed files with 6 additions and 2 deletions
|
@ -57,6 +57,7 @@ main() async {
|
||||||
class Todo extends Model {
|
class Todo extends Model {
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
|
@GraphQLDocumentation(deprecationReason: 'Booleans are just *sooo* 2015!')
|
||||||
bool completed;
|
bool completed;
|
||||||
|
|
||||||
Todo({this.text, this.completed});
|
Todo({this.text, this.completed});
|
||||||
|
|
|
@ -101,6 +101,7 @@ class GraphExceptionErrorLocation {
|
||||||
/// A metadata annotation used to provide documentation to `package:graphql_server`.
|
/// A metadata annotation used to provide documentation to `package:graphql_server`.
|
||||||
class GraphQLDocumentation {
|
class GraphQLDocumentation {
|
||||||
final String description;
|
final String description;
|
||||||
|
final String deprecationReason;
|
||||||
|
|
||||||
const GraphQLDocumentation({this.description});
|
const GraphQLDocumentation({this.description, this.deprecationReason});
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,8 +163,10 @@ String _getDeprecationReason(List<InstanceMirror> metadata) {
|
||||||
if (expires == deprecated.expires) {
|
if (expires == deprecated.expires) {
|
||||||
return 'Expires after $expires';
|
return 'Expires after $expires';
|
||||||
} else {
|
} else {
|
||||||
deprecated.expires;
|
return deprecated.expires;
|
||||||
}
|
}
|
||||||
|
} else if (obj.reflectee is GraphQLDocumentation) {
|
||||||
|
return (obj.reflectee as GraphQLDocumentation).deprecationReason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue