wick_config/config/common/
metadata.rs

1#![allow(missing_docs)] // delete when we move away from the `property` crate.
2use crate::config::AssetReference;
3
4#[derive(
5  Debug,
6  Default,
7  derive_builder::Builder,
8  Clone,
9  PartialEq,
10  derive_asset_container::AssetManager,
11  property::Property,
12  serde::Serialize,
13)]
14#[property(get(public), set(private), mut(disable))]
15#[builder(setter(into))]
16#[asset(asset(AssetReference))]
17/// Metadata for the component or application.
18pub struct Metadata {
19  /// The version of the component or application.
20  #[asset(skip)]
21  pub(crate) version: String,
22  /// The authors of the component or application.
23  #[asset(skip)]
24  #[builder(default)]
25  #[serde(skip_serializing_if = "Vec::is_empty")]
26  pub(crate) authors: Vec<String>,
27  /// Any vendors associated with the component or application.
28  #[asset(skip)]
29  #[builder(default)]
30  #[serde(skip_serializing_if = "Vec::is_empty")]
31  pub(crate) vendors: Vec<String>,
32  /// A short description of the component or application.
33  #[asset(skip)]
34  #[builder(default)]
35  #[serde(skip_serializing_if = "Option::is_none")]
36  pub(crate) description: Option<String>,
37  /// Where to find documentation for the component or application.
38  #[asset(skip)]
39  #[builder(default)]
40  #[serde(skip_serializing_if = "Option::is_none")]
41  pub(crate) documentation: Option<String>,
42  /// The license(s) for the component or application.
43  #[asset(skip)]
44  #[builder(default)]
45  #[serde(skip_serializing_if = "Vec::is_empty")]
46  pub(crate) licenses: Vec<String>,
47  /// The icon for the component or application.
48  #[builder(default)]
49  #[serde(skip_serializing_if = "Option::is_none")]
50  pub(crate) icon: Option<AssetReference>,
51}
52
53impl Metadata {
54  /// Create a new [Metadata] instance from a version string.
55  pub fn new<T: Into<String>>(version: T) -> Self {
56    Self {
57      version: version.into(),
58      ..Default::default()
59    }
60  }
61}