pub enum Type {
}Variants§
String
Int
Float
Bool
Bytes
Duration
Timestamp
Uuid
Json
Null
The type of the null literal. Never appears in a field position.
List
Map
Optional
Record
Implementations§
Source§impl Type
impl Type
pub fn optional(self) -> Type
pub fn is_optional(&self) -> bool
Sourcepub fn unwrap_optional(&self) -> &Type
pub fn unwrap_optional(&self) -> &Type
Strip one level of ?.
pub fn is_numeric(&self) -> bool
pub fn record(name: Option<&str>, fields: Vec<FieldType>) -> Type
pub fn field(&self, name: &str) -> Option<&FieldType>
Sourcepub fn validate(
&self,
value: &Value,
strict: bool,
) -> Result<(), ValidationError>
pub fn validate( &self, value: &Value, strict: bool, ) -> Result<(), ValidationError>
Validate a JSON value against this type.
With strict, records reject fields they do not declare. Execution
inputs are validated strictly; worker outputs are validated leniently so
that workers can add fields without breaking older workflows.
Sourcepub fn apply_defaults(&self, value: &mut Value)
pub fn apply_defaults(&self, value: &mut Value)
Fill in declared defaults (recursively) for record fields that are absent.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
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
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Forget for Type
impl Freeze for Type
impl Move for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin for Type
impl UnwindSafe for Type
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