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) -> SchemaGenerationRequest
pub fn from_example(example: Value) -> SchemaGenerationRequest
Create a new request with one example.
Sourcepub fn from_examples(examples: Vec<Value>) -> SchemaGenerationRequest
pub fn from_examples(examples: Vec<Value>) -> SchemaGenerationRequest
Create from multiple examples.
Sourcepub fn with_description(
self,
desc: impl Into<String>,
) -> SchemaGenerationRequest
pub fn with_description( self, desc: impl Into<String>, ) -> SchemaGenerationRequest
Add a description.
Sourcepub fn strict(self) -> SchemaGenerationRequest
pub fn strict(self) -> SchemaGenerationRequest
Set strict mode.
Sourcepub fn with_name(self, name: impl Into<String>) -> SchemaGenerationRequest
pub fn with_name(self, name: impl Into<String>) -> SchemaGenerationRequest
Set name.
Sourcepub fn add_example(self, example: Value) -> SchemaGenerationRequest
pub fn add_example(self, example: Value) -> SchemaGenerationRequest
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<SchemaGenerationRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SchemaGenerationRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SchemaGenerationRequest
impl Serialize for SchemaGenerationRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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 UnsafeUnpin 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