code_analyze_core/
schema_helpers.rs1#![cfg(feature = "schemars")]
2
3use schemars::Schema;
4use serde_json::json;
5
6pub fn integer_schema(_gen: &mut schemars::SchemaGenerator) -> Schema {
9 let map = json!({
10 "type": "integer",
11 "minimum": 0
12 })
13 .as_object()
14 .expect("json! object literal is always a Value::Object")
15 .clone();
16 Schema::from(map)
17}
18
19pub fn option_integer_schema(_gen: &mut schemars::SchemaGenerator) -> Schema {
21 let map = json!({
22 "type": ["integer", "null"],
23 "minimum": 0
24 })
25 .as_object()
26 .expect("json! object literal is always a Value::Object")
27 .clone();
28 Schema::from(map)
29}
30
31pub fn option_ast_limit_schema(_gen: &mut schemars::SchemaGenerator) -> Schema {
36 let map = json!({
37 "type": ["integer", "null"],
38 "minimum": 1
39 })
40 .as_object()
41 .expect("json! object literal is always a Value::Object")
42 .clone();
43 Schema::from(map)
44}
45
46pub fn option_page_size_schema(_gen: &mut schemars::SchemaGenerator) -> Schema {
50 let map = json!({
51 "type": ["integer", "null"],
52 "minimum": 1
53 })
54 .as_object()
55 .expect("json! object literal is always a Value::Object")
56 .clone();
57 Schema::from(map)
58}