reactive_graph_client/schema_graphql/instances/property_instance/
property_instance.rs1use 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 pub name: String,
14
15 pub type_: Option<PropertyType>,
17
18 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 })
36 .collect()
37 }
38}
39
40impl fmt::Display for PropertyInstances {
41 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
42 writeln!(f)
43 }
44}