1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct KeywordInfo {
8 pub keyword: String,
9 pub description: String,
10 pub category: KeywordCategory,
11}
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
15pub enum KeywordCategory {
16 Declaration, ControlFlow, Query, Module, Type, Literal, Operator, Temporal, Other,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct FunctionInfo {
30 pub name: String,
31 pub signature: String,
32 pub description: String,
33 pub category: FunctionCategory,
34 pub parameters: Vec<ParameterInfo>,
35 pub return_type: String,
36 pub example: Option<String>,
37 #[serde(default = "default_true")]
39 pub implemented: bool,
40 #[serde(default)]
42 pub comptime_only: bool,
43}
44
45fn default_true() -> bool {
46 true
47}
48
49impl Default for FunctionInfo {
50 fn default() -> Self {
51 Self {
52 name: String::new(),
53 signature: String::new(),
54 description: String::new(),
55 category: FunctionCategory::Utility,
56 parameters: Vec::new(),
57 return_type: String::new(),
58 example: None,
59 implemented: true,
60 comptime_only: false,
61 }
62 }
63}
64
65#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
67pub enum FunctionCategory {
68 Simulation, Math, Array, Column, Statistics, Data, Utility, }
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79pub struct ParameterInfo {
80 pub name: String,
81 pub param_type: String,
82 pub optional: bool,
83 pub description: String,
84 #[serde(default, skip_serializing_if = "Option::is_none")]
86 pub constraints: Option<ParameterConstraints>,
87}
88
89#[derive(Debug, Clone, Serialize, Deserialize, Default)]
91pub struct ParameterConstraints {
92 #[serde(default)]
94 pub is_provider_name: bool,
95
96 #[serde(default, skip_serializing_if = "Option::is_none")]
98 pub requires_annotation: Option<String>,
99
100 #[serde(default, skip_serializing_if = "Option::is_none")]
102 pub allowed_values: Option<Vec<String>>,
103
104 #[serde(default, skip_serializing_if = "Option::is_none")]
106 pub object_properties: Option<Vec<PropertyConstraint>>,
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111pub struct PropertyConstraint {
112 pub name: String,
113 pub value_type: String,
114 pub required: bool,
115 #[serde(default, skip_serializing_if = "Option::is_none")]
117 pub constraint: Option<ParameterConstraints>,
118}
119
120#[derive(Debug, Clone, Serialize, Deserialize)]
122pub struct TypeInfo {
123 pub name: String,
124 pub description: String,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129pub struct PropertyInfo {
130 pub name: String,
131 pub property_type: String,
132 pub description: String,
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137pub struct MethodInfo {
138 pub name: String,
139 pub signature: String,
140 pub description: String,
141 pub return_type: String,
142 #[serde(default = "default_true")]
144 pub implemented: bool,
145}