Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-plan/src/dsl/expr/anonymous/json_schema.rs
8424 views
1
use std::sync::Arc;
2
3
use polars_core::series::Series;
4
5
use super::{AnonymousAgg, AnonymousColumnsUdf, SpecialEq};
6
use crate::dsl::LazySerde;
7
8
impl<T: schemars::JsonSchema> schemars::JsonSchema for SpecialEq<Arc<T>> {
9
fn schema_name() -> std::borrow::Cow<'static, str> {
10
T::schema_name()
11
}
12
13
fn schema_id() -> std::borrow::Cow<'static, str> {
14
T::schema_id()
15
}
16
17
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
18
T::json_schema(generator)
19
}
20
}
21
22
impl<T: schemars::JsonSchema + Clone> schemars::JsonSchema for LazySerde<T> {
23
fn schema_name() -> std::borrow::Cow<'static, str> {
24
T::schema_name()
25
}
26
27
fn schema_id() -> std::borrow::Cow<'static, str> {
28
T::schema_id()
29
}
30
31
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
32
Vec::<u8>::json_schema(generator)
33
}
34
}
35
36
impl schemars::JsonSchema for SpecialEq<Series> {
37
fn schema_name() -> std::borrow::Cow<'static, str> {
38
Series::schema_name()
39
}
40
41
fn schema_id() -> std::borrow::Cow<'static, str> {
42
Series::schema_id()
43
}
44
45
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
46
Series::json_schema(generator)
47
}
48
}
49
50
impl schemars::JsonSchema for SpecialEq<Arc<dyn AnonymousAgg>> {
51
fn schema_name() -> std::borrow::Cow<'static, str> {
52
"AnonymousAgg".into()
53
}
54
55
fn schema_id() -> std::borrow::Cow<'static, str> {
56
std::borrow::Cow::Borrowed(concat!(module_path!(), "::", "AnonymousAgg"))
57
}
58
59
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
60
Vec::<u8>::json_schema(generator)
61
}
62
}
63
64
impl schemars::JsonSchema for SpecialEq<Arc<dyn AnonymousColumnsUdf>> {
65
fn schema_name() -> std::borrow::Cow<'static, str> {
66
"AnonymousColumnsUdf".into()
67
}
68
69
fn schema_id() -> std::borrow::Cow<'static, str> {
70
std::borrow::Cow::Borrowed(concat!(module_path!(), "::", "AnonymousColumnsUdf"))
71
}
72
73
fn json_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
74
Vec::<u8>::json_schema(generator)
75
}
76
}
77
78