summaryrefslogtreecommitdiff
path: root/makima/src/daemon/chain/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/daemon/chain/parser.rs')
-rw-r--r--makima/src/daemon/chain/parser.rs29
1 files changed, 24 insertions, 5 deletions
diff --git a/makima/src/daemon/chain/parser.rs b/makima/src/daemon/chain/parser.rs
index 0f16710..3851d1f 100644
--- a/makima/src/daemon/chain/parser.rs
+++ b/makima/src/daemon/chain/parser.rs
@@ -20,6 +20,27 @@ pub enum ParseError {
ValidationError(String),
}
+/// Repository definition in a chain.
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct RepositoryDefinition {
+ /// Name of the repository
+ pub name: String,
+ /// Repository URL (for remote repos)
+ pub repository_url: Option<String>,
+ /// Local path (for local repos)
+ pub local_path: Option<String>,
+ /// Source type: remote, local, or managed
+ #[serde(default = "default_source_type")]
+ pub source_type: String,
+ /// Whether this is the primary repository
+ #[serde(default)]
+ pub is_primary: bool,
+}
+
+fn default_source_type() -> String {
+ "remote".to_string()
+}
+
/// Chain definition parsed from YAML.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChainDefinition {
@@ -27,11 +48,9 @@ pub struct ChainDefinition {
pub name: String,
/// Optional description
pub description: Option<String>,
- /// Repository URL (optional - contracts may have their own repos)
- #[serde(alias = "repo")]
- pub repository_url: Option<String>,
- /// Local path for repository
- pub local_path: Option<String>,
+ /// Repositories for this chain
+ #[serde(default)]
+ pub repositories: Vec<RepositoryDefinition>,
/// Contracts in this chain
pub contracts: Vec<ContractDefinition>,
/// Loop configuration