File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
21
21
22
22
## BREAKING
23
23
- ** ` InputValueDefinition::is_required() ` returns false if it has a default value - [ goto-bus-stop] , [ pull/798] **
24
- Now ` argument.is_required() == true ` only if the type is non-null and there is no
25
- default value, meaning a value must be provided when it's used.
24
+ - Now ` argument.is_required() == true ` only if the type is non-null and there is no
25
+ default value, meaning a value must be provided when it's used.
26
26
27
27
## Features
28
28
- ** Implement ` fmt::Display ` for ` ComponentName ` - [ goto-bus-stop] , [ pull/795] **
29
+ - ** Add ` FieldDefinition::argument_by_name ` and ` DirectiveDefinition::argument_by_name ` - [ goto-bus-stop] , [ pull/FIXME] **
30
+ - These methods return an argument definition by name, or ` None ` .
29
31
30
32
[ goto-bus-stop ] : https://github.com/goto-bus-stop]
31
33
[ pull/795 ] : https://github.com/apollographql/apollo-rs/pull/795
Original file line number Diff line number Diff line change @@ -459,6 +459,11 @@ impl FragmentDefinition {
459
459
}
460
460
461
461
impl DirectiveDefinition {
462
+ /// Returns the definition of an argument by a given name.
463
+ pub fn argument_by_name ( & self , name : & str ) -> Option < & Node < InputValueDefinition > > {
464
+ self . arguments . iter ( ) . find ( |argument| argument. name == name)
465
+ }
466
+
462
467
serialize_method ! ( ) ;
463
468
}
464
469
@@ -624,6 +629,7 @@ impl FromIterator<Directive> for DirectiveList {
624
629
}
625
630
626
631
impl Directive {
632
+ /// Returns the value provided to the named argument.
627
633
pub fn argument_by_name ( & self , name : & str ) -> Option < & Node < Value > > {
628
634
self . arguments
629
635
. iter ( )
@@ -836,6 +842,11 @@ impl Type {
836
842
}
837
843
838
844
impl FieldDefinition {
845
+ /// Returns the definition of an argument by a given name.
846
+ pub fn argument_by_name ( & self , name : & str ) -> Option < & Node < InputValueDefinition > > {
847
+ self . arguments . iter ( ) . find ( |argument| argument. name == name)
848
+ }
849
+
839
850
serialize_method ! ( ) ;
840
851
}
841
852
You can’t perform that action at this time.
0 commit comments