pub struct ArgumentDefinition {
pub name: String,
pub arg_type: FieldType,
pub nullable: bool,
pub default_value: Option<Value>,
pub description: Option<String>,
pub deprecation: Option<DeprecationInfo>,
}Expand description
Query/mutation/subscription argument definition.
Fields§
§name: StringArgument name.
arg_type: FieldTypeArgument type.
nullable: boolIs this argument optional?
default_value: Option<Value>Default value (JSON representation).
description: Option<String>Description.
deprecation: Option<DeprecationInfo>Deprecation information (from @deprecated directive). When set, this argument is marked as deprecated in the schema. Per GraphQL spec, deprecated arguments should still be accepted but clients are encouraged to migrate to alternatives.
Implementations§
Source§impl ArgumentDefinition
impl ArgumentDefinition
Sourcepub fn new(name: impl Into<String>, arg_type: FieldType) -> Self
pub fn new(name: impl Into<String>, arg_type: FieldType) -> Self
Create a new required argument.
Sourcepub fn optional(name: impl Into<String>, arg_type: FieldType) -> Self
pub fn optional(name: impl Into<String>, arg_type: FieldType) -> Self
Create a new optional argument.
Sourcepub fn deprecated(self, reason: Option<String>) -> Self
pub fn deprecated(self, reason: Option<String>) -> Self
Mark this argument as deprecated.
§Example
use fraiseql_core::schema::{ArgumentDefinition, FieldType};
let arg = ArgumentDefinition::optional("oldLimit", FieldType::Int)
.deprecated(Some("Use 'first' instead".to_string()));
assert!(arg.is_deprecated());Sourcepub fn is_deprecated(&self) -> bool
pub fn is_deprecated(&self) -> bool
Check if this argument is deprecated.
Sourcepub fn deprecation_reason(&self) -> Option<&str>
pub fn deprecation_reason(&self) -> Option<&str>
Get the deprecation reason if deprecated.
Trait Implementations§
Source§impl Clone for ArgumentDefinition
impl Clone for ArgumentDefinition
Source§fn clone(&self) -> ArgumentDefinition
fn clone(&self) -> ArgumentDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ArgumentDefinition
impl Debug for ArgumentDefinition
Source§impl<'de> Deserialize<'de> for ArgumentDefinition
impl<'de> Deserialize<'de> for ArgumentDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ArgumentDefinition
impl PartialEq for ArgumentDefinition
Source§impl Serialize for ArgumentDefinition
impl Serialize for ArgumentDefinition
impl StructuralPartialEq for ArgumentDefinition
Auto Trait Implementations§
impl Freeze for ArgumentDefinition
impl RefUnwindSafe for ArgumentDefinition
impl Send for ArgumentDefinition
impl Sync for ArgumentDefinition
impl Unpin for ArgumentDefinition
impl UnsafeUnpin for ArgumentDefinition
impl UnwindSafe for ArgumentDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more