pub struct VariableSchema { /* private fields */ }Expand description
Variable schema for workflow variables using JSON Schema format.
This allows flows to declare required variables with their types, default values, descriptions, secret annotations, and environment variable mappings.
Example:
variables:
type: object
properties:
api_key:
type: string
is_secret: true
env_var: "OPENAI_API_KEY"
description: "OpenAI API key"
temperature:
type: number
default: 0.7
minimum: 0
maximum: 2
required: ["api_key"]Implementations§
Source§impl VariableSchema
impl VariableSchema
pub fn secrets(&self) -> &Secrets
Sourcepub fn env_var_name(&self, variable_name: &str) -> Option<&str>
pub fn env_var_name(&self, variable_name: &str) -> Option<&str>
Get the environment variable name for a given variable, if annotated.
Sourcepub fn env_var_map(&self) -> &HashMap<String, String>
pub fn env_var_map(&self) -> &HashMap<String, String>
Get the full mapping of variable names to environment variable names.
Sourcepub fn required_variables(&self) -> impl Iterator<Item = &str> + '_
pub fn required_variables(&self) -> impl Iterator<Item = &str> + '_
Get the list of required variables.
Sourcepub fn default_value(&self, variable_name: &str) -> Option<ValueRef>
pub fn default_value(&self, variable_name: &str) -> Option<ValueRef>
Get the default value for a variable, if specified.
Sourcepub fn validate_variables(
&self,
variables: &HashMap<String, Value>,
) -> Result<(), VariableValidationError>
pub fn validate_variables( &self, variables: &HashMap<String, Value>, ) -> Result<(), VariableValidationError>
Validate that provided variable values match the schema requirements.
Trait Implementations§
Source§impl Clone for VariableSchema
impl Clone for VariableSchema
Source§fn clone(&self) -> VariableSchema
fn clone(&self) -> VariableSchema
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 VariableSchema
impl Debug for VariableSchema
Source§impl Default for VariableSchema
impl Default for VariableSchema
Source§fn default() -> VariableSchema
fn default() -> VariableSchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for VariableSchema
impl<'de> Deserialize<'de> for VariableSchema
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 From<SchemaRef> for VariableSchema
impl From<SchemaRef> for VariableSchema
Source§impl From<VariableSchema> for SchemaRef
impl From<VariableSchema> for SchemaRef
Source§fn from(var_schema: VariableSchema) -> Self
fn from(var_schema: VariableSchema) -> Self
Converts to this type from the input type.
Source§impl JsonSchema for VariableSchema
impl JsonSchema for VariableSchema
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for VariableSchema
impl PartialEq for VariableSchema
Source§impl Serialize for VariableSchema
impl Serialize for VariableSchema
impl StructuralPartialEq for VariableSchema
Auto Trait Implementations§
impl Freeze for VariableSchema
impl RefUnwindSafe for VariableSchema
impl Send for VariableSchema
impl Sync for VariableSchema
impl Unpin for VariableSchema
impl UnsafeUnpin for VariableSchema
impl UnwindSafe for VariableSchema
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