reactive_graph/client/types/extension/
args.rs

1use clap::Args;
2use reactive_graph_client::types::common::variables::type_id::variables::TypeIdVariables;
3use reactive_graph_graph::ExtensionTypeId;
4use serde_json::Value;
5
6/// The property type.
7#[derive(Args, Debug, Clone)]
8pub(crate) struct ExtensionDefinitionArgs {
9    /// The component type.
10    #[clap(flatten)]
11    pub ty: ExtensionTypeIdArgs,
12
13    /// Textual description of the extension.
14    pub description: String,
15
16    /// The extension as JSON representation.
17    pub extension: Value,
18}
19
20/// The extension type.
21#[derive(Args, Debug, Clone)]
22pub(crate) struct ExtensionTypeIdArgs {
23    /// The extension namespace.
24    pub extension_namespace: String,
25
26    /// The extension name.
27    pub extension_name: String,
28}
29
30impl From<ExtensionTypeIdArgs> for ExtensionTypeId {
31    fn from(ty: ExtensionTypeIdArgs) -> Self {
32        ExtensionTypeId::new_from_type(ty.extension_namespace, ty.extension_name)
33    }
34}
35
36impl From<&ExtensionTypeIdArgs> for TypeIdVariables {
37    fn from(ty: &ExtensionTypeIdArgs) -> Self {
38        let ty: ExtensionTypeId = ty.clone().into();
39        ty.into()
40    }
41}