vapi_client/models/json_schema.rs
1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct JsonSchema {
16 /// 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.
17 #[serde(rename = "type")]
18 pub r#type: TypeTrue,
19 /// 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.
20 #[serde(rename = "items", skip_serializing_if = "Option::is_none")]
21 pub items: Option<serde_json::Value>,
22 /// 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.
23 #[serde(rename = "properties", skip_serializing_if = "Option::is_none")]
24 pub properties: Option<serde_json::Value>,
25 /// This is the description to help the model understand what it needs to output.
26 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
27 pub description: Option<String>,
28 /// This is a list of properties that are required. This only makes sense if the type is \"object\".
29 #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
30 pub required: Option<Vec<String>>,
31 /// This the value that will be used in filling the property.
32 #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
33 pub value: Option<String>,
34 /// This the target variable that will be filled with the value of this property.
35 #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
36 pub target: Option<String>,
37 /// This array specifies the allowed values that can be used to restrict the output of the model.
38 #[serde(rename = "enum", skip_serializing_if = "Option::is_none")]
39 pub r#enum: Option<Vec<String>>,
40}
41
42impl JsonSchema {
43 pub fn new(r#type: TypeTrue) -> JsonSchema {
44 JsonSchema {
45 r#type,
46 items: None,
47 properties: None,
48 description: None,
49 required: None,
50 value: None,
51 target: None,
52 r#enum: None,
53 }
54 }
55}
56/// 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.
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum TypeTrue {
59 #[serde(rename = "string")]
60 String,
61 #[serde(rename = "number")]
62 Number,
63 #[serde(rename = "integer")]
64 Integer,
65 #[serde(rename = "boolean")]
66 Boolean,
67 #[serde(rename = "array")]
68 Array,
69 #[serde(rename = "object")]
70 Object,
71}
72
73impl Default for TypeTrue {
74 fn default() -> TypeTrue {
75 Self::String
76 }
77}