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: Type,
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 is a regex that will be used to validate data in question.
32 #[serde(rename = "regex", skip_serializing_if = "Option::is_none")]
33 pub regex: Option<String>,
34 /// This the value that will be used in filling the property.
35 #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
36 pub value: Option<String>,
37 /// This the target variable that will be filled with the value of this property.
38 #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
39 pub target: Option<String>,
40 /// This array specifies the allowed values that can be used to restrict the output of the model.
41 #[serde(rename = "enum", skip_serializing_if = "Option::is_none")]
42 pub r#enum: Option<Vec<String>>,
43}
44
45impl JsonSchema {
46 pub fn new(r#type: Type) -> JsonSchema {
47 JsonSchema {
48 r#type,
49 items: None,
50 properties: None,
51 description: None,
52 required: None,
53 regex: None,
54 value: None,
55 target: None,
56 r#enum: None,
57 }
58 }
59}
60/// 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.
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
62pub enum Type {
63 #[serde(rename = "string")]
64 String,
65 #[serde(rename = "number")]
66 Number,
67 #[serde(rename = "integer")]
68 Integer,
69 #[serde(rename = "boolean")]
70 Boolean,
71 #[serde(rename = "array")]
72 Array,
73 #[serde(rename = "object")]
74 Object,
75}
76
77impl Default for Type {
78 fn default() -> Type {
79 Self::String
80 }
81}
82