Struct reflectapi_schema::Field
source · pub struct Field {
pub name: String,
pub serde_name: String,
pub description: String,
pub type_ref: TypeReference,
pub required: bool,
pub flattened: bool,
pub transform_callback: String,
pub transform_callback_fn: Option<fn(_: &mut TypeReference, _: &Typespace)>,
}
Fields§
§name: String
§serde_name: String
§description: String
§type_ref: TypeReference
Type of a field
required: bool
required and not nullable:
- field always present and not null / none
required and nullable:
- Rust: Option
, do not skip serializing if None - TypeScript: T | null, do not skip serializing if null
not required and not nullable:
- Rust: Option
, skip serializing if None - TypeScript: T | undefined, skip serializing if undefined
not required and nullable: serializers and deserializers are required to differentiate between missing fields and null / none fields
- Rust: Patch
(Patch is enum with Missing, None and Some variants) - TypeScript: T | null | undefined
Default is false
flattened: bool
If serde flatten attribute is set on a field Default is false
transform_callback: String
§transform_callback_fn: Option<fn(_: &mut TypeReference, _: &Typespace)>
Implementations§
source§impl Field
impl Field
pub fn new(name: String, ty: TypeReference) -> Self
pub fn name(&self) -> &str
pub fn serde_name(&self) -> &str
pub fn description(&self) -> &str
pub fn type_ref(&self) -> &TypeReference
pub fn required(&self) -> bool
pub fn flattened(&self) -> bool
pub fn transform_callback(&self) -> &str
pub fn transform_callback_fn( &self ) -> Option<fn(_: &mut TypeReference, _: &Typespace)>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Field
impl<'de> Deserialize<'de> for Field
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 Field
impl PartialEq for Field
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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