Skip to content

Commit 2dec9c4

Browse files
authored
feat: add InputObjectDefinition::is_one_of (#1176)
1 parent fe110fb commit 2dec9c4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cynic-parser/src/type_system/extensions.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{borrow::Cow, fmt};
22

3-
use crate::common::OperationType;
3+
use crate::{common::OperationType, type_system::InputObjectDefinition};
44

55
use super::{Argument, Description, Directive, RootOperationTypeDefinition, SchemaDefinition};
66

@@ -47,3 +47,10 @@ impl<'a> Directive<'a> {
4747
self.arguments().find(|arg| arg.name() == name)
4848
}
4949
}
50+
51+
impl<'a> InputObjectDefinition<'a> {
52+
pub fn is_one_of(&self) -> bool {
53+
self.directives()
54+
.any(|directive| directive.name() == "oneOf")
55+
}
56+
}

0 commit comments

Comments
 (0)