pub struct SchemaGenerationRequest {
pub examples: Vec<Value>,
pub description: Option<String>,
pub strict: bool,
pub name: Option<String>,
}Expand description
Request to generate a schema from examples.
Fields§
§examples: Vec<Value>Example values to infer schema from.
description: Option<String>Optional description of what the schema represents.
strict: boolWhether to generate strict schema (no additional properties).
name: Option<String>Optional name for the schema.
Implementations§
Source§impl SchemaGenerationRequest
impl SchemaGenerationRequest
Sourcepub fn from_example(example: Value) -> Self
pub fn from_example(example: Value) -> Self
Create a new request with one example.
Sourcepub fn from_examples(examples: Vec<Value>) -> Self
pub fn from_examples(examples: Vec<Value>) -> Self
Create from multiple examples.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Add a description.
Sourcepub fn add_example(self, example: Value) -> Self
pub fn add_example(self, example: Value) -> Self
Add another example.
Trait Implementations§
Source§impl Clone for SchemaGenerationRequest
impl Clone for SchemaGenerationRequest
Source§fn clone(&self) -> SchemaGenerationRequest
fn clone(&self) -> SchemaGenerationRequest
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 SchemaGenerationRequest
impl Debug for SchemaGenerationRequest
Source§impl<'de> Deserialize<'de> for SchemaGenerationRequest
impl<'de> Deserialize<'de> for SchemaGenerationRequest
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
Auto Trait Implementations§
impl Freeze for SchemaGenerationRequest
impl RefUnwindSafe for SchemaGenerationRequest
impl Send for SchemaGenerationRequest
impl Sync for SchemaGenerationRequest
impl Unpin for SchemaGenerationRequest
impl UnwindSafe for SchemaGenerationRequest
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