pub struct SchemaEngine { /* private fields */ }Expand description
Engine for applying runtime transforms to tool schemas.
Schemars derive generates base schemas at compile time. SchemaEngine applies transforms at runtime for provider flexibility.
§Clone behavior
When cloned, custom_transforms are not carried over (they are not Clone).
Only per_tool constraints and global_strict settings are cloned.
Implementations§
Source§impl SchemaEngine
impl SchemaEngine
Sourcepub fn with_strict(self, strict: bool) -> Self
pub fn with_strict(self, strict: bool) -> Self
Enable strict mode (additionalProperties=false) globally.
Sourcepub fn constrain_field(
&mut self,
tool: &str,
json_path: Vec<String>,
c: FieldConstraint,
)
pub fn constrain_field( &mut self, tool: &str, json_path: Vec<String>, c: FieldConstraint, )
Add a field constraint for a specific tool.
The json_path is a list of property names to traverse to reach the field.
For example, ["properties", "count"] would target the “count” property.
Sourcepub fn add_transform<T: SchemaTransform + 'static>(&mut self, transform: T)
pub fn add_transform<T: SchemaTransform + 'static>(&mut self, transform: T)
Add a custom transform.
Trait Implementations§
Source§impl Clone for SchemaEngine
impl Clone for SchemaEngine
Source§impl Debug for SchemaEngine
impl Debug for SchemaEngine
Source§impl Default for SchemaEngine
impl Default for SchemaEngine
Source§fn default() -> SchemaEngine
fn default() -> SchemaEngine
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaEngine
impl !RefUnwindSafe for SchemaEngine
impl Send for SchemaEngine
impl Sync for SchemaEngine
impl Unpin for SchemaEngine
impl !UnwindSafe for SchemaEngine
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