pub struct JsonSchema {
pub type: TypeTrue,
pub items: Option<Value>,
pub properties: Option<Value>,
pub description: Option<String>,
pub required: Option<Vec<String>>,
pub value: Option<String>,
pub target: Option<String>,
pub enum: Option<Vec<String>>,
}
Fields§
§type: TypeTrue
This is the type of output you’d like. string
, number
, integer
, boolean
are the primitive types and should be obvious. array
and object
are more interesting and quite powerful. They allow you to define nested structures. For array
, you can define the schema of the items in the array using the items
property. For object
, you can define the properties of the object using the properties
property.
items: Option<Value>
This is required if the type is "array". This is the schema of the items in the array. This is of type JsonSchema. However, Swagger doesn’t support circular references.
properties: Option<Value>
This is required if the type is "object". This specifies the properties of the object. This is a map of string to JsonSchema. However, Swagger doesn’t support circular references.
description: Option<String>
This is the description to help the model understand what it needs to output.
required: Option<Vec<String>>
This is a list of properties that are required. This only makes sense if the type is "object".
value: Option<String>
This the value that will be used in filling the property.
target: Option<String>
This the target variable that will be filled with the value of this property.
enum: Option<Vec<String>>
This array specifies the allowed values that can be used to restrict the output of the model.
Implementations§
Source§impl JsonSchema
impl JsonSchema
pub fn new(type: TypeTrue) -> JsonSchema
Trait Implementations§
Source§impl Clone for JsonSchema
impl Clone for JsonSchema
Source§fn clone(&self) -> JsonSchema
fn clone(&self) -> JsonSchema
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more