reactive_graph_client/schema_graphql/instances/property_instance/
property_instance.rs

1use crate::PropertyType;
2use crate::schema_graphql::scalar::Json;
3use std::fmt;
4use std::fmt::Formatter;
5
6#[derive(cynic::QueryFragment, Clone, Debug)]
7#[cynic(
8    schema_path = "../../schema/graphql/reactive-graph-schema.graphql",
9    schema_module = "crate::schema_graphql::schema"
10)]
11pub struct PropertyInstance {
12    /// The name of the extension.
13    pub name: String,
14
15    /// Textual description of the extension.
16    pub type_: Option<PropertyType>,
17
18    /// The extension as JSON representation.
19    pub value: Json,
20}
21
22#[derive(Clone, Debug)]
23pub struct PropertyInstances(pub Vec<PropertyInstance>);
24
25impl From<PropertyInstances> for reactive_graph_graph::PropertyInstances {
26    fn from(property_instances: PropertyInstances) -> Self {
27        property_instances
28            .0
29            .into_iter()
30            .map(|property_instance| {
31                let value: serde_json::Value = property_instance.value.into();
32                (property_instance.name, value)
33                // let x = property_instance.into();
34                // x
35            })
36            .collect()
37    }
38}
39
40impl fmt::Display for PropertyInstances {
41    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
42        writeln!(f)
43    }
44}