Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openapi.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ pub struct NodeSetArgs {
#[arg(long)]
pub path_prefix: Option<String>,

/// Codegen language for a boundary node (e.g. `go`, `python`). Boundary-only.
#[arg(long)]
pub language: Option<String>,

/// Mark the node external (an outside system the graph depends on).
#[arg(long, conflicts_with = "no_external")]
pub external: bool,
Expand Down Expand Up @@ -276,6 +280,10 @@ pub struct NodeSetArgs {
#[arg(long, conflicts_with = "path_prefix")]
pub clear_path_prefix: bool,

/// Clear the boundary language (set it null).
#[arg(long, conflicts_with = "language")]
pub clear_language: bool,

/// Clear the external kind label (set it null).
#[arg(long, conflicts_with = "external_kind")]
pub clear_external_kind: bool,
Expand Down Expand Up @@ -360,6 +368,10 @@ pub struct NodeAddArgs {
#[arg(long)]
pub path_prefix: Option<String>,

/// Codegen language for a boundary node (e.g. `go`, `python`). Boundary-only.
#[arg(long)]
pub language: Option<String>,

/// External-only: the system's protocol (e.g. `gRPC`, `HTTPS REST`).
#[arg(long)]
pub protocol: Option<String>,
Expand Down
13 changes: 13 additions & 0 deletions src/cmd/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fn op_line(op: &OpSummary) -> String {
outputs,
user_kind,
path_prefix,
language,
external,
external_kind,
protocol,
Expand Down Expand Up @@ -137,6 +138,7 @@ fn op_line(op: &OpSummary) -> String {
}
line.push_str(&scalar_line(user_kind, "user-kind"));
line.push_str(&scalar_line(path_prefix, "path-prefix"));
line.push_str(&scalar_line(language, "language"));
line.push_str(&scalar_line(external_kind, "external-kind"));
line.push_str(&scalar_line(protocol, "protocol"));
line.push_str(&scalar_line(doc_url, "doc-url"));
Expand Down Expand Up @@ -232,6 +234,7 @@ fn op_json(op: &OpSummary) -> serde_json::Value {
outputs,
user_kind,
path_prefix,
language,
external,
external_kind,
protocol,
Expand Down Expand Up @@ -259,6 +262,7 @@ fn op_json(op: &OpSummary) -> serde_json::Value {
for (key, field) in [
("user_kind", user_kind),
("path_prefix", path_prefix),
("language", language),
("external_kind", external_kind),
("protocol", protocol),
("doc_url", doc_url),
Expand Down Expand Up @@ -454,6 +458,7 @@ mod tests {
]),
user_kind: None,
path_prefix: None,
language: None,
external: None,
external_kind: None,
protocol: None,
Expand Down Expand Up @@ -540,6 +545,7 @@ mod tests {
outputs: None,
user_kind: Some(Some("subsystem".to_string())),
path_prefix: Some(Some("src/api/".to_string())),
language: Some(Some("go".to_string())),
external: Some(true),
external_kind: Some(Some("rest-api".to_string())),
protocol: None,
Expand All @@ -551,6 +557,7 @@ mod tests {
let human = render(&summary(vec![op.clone()]), OutputMode::Human);
assert!(human.contains("user-kind: subsystem"), "{human}");
assert!(human.contains("path-prefix: src/api/"), "{human}");
assert!(human.contains("language: go"), "{human}");
assert!(human.contains("external: true"), "{human}");
assert!(human.contains("external-kind: rest-api"), "{human}");
assert!(human.contains("verification: responds in 50ms"), "{human}");
Expand All @@ -559,6 +566,7 @@ mod tests {
serde_json::from_str(&render(&summary(vec![op]), OutputMode::Json)).unwrap();
assert_eq!(v["ops"][0]["user_kind"], "subsystem");
assert_eq!(v["ops"][0]["path_prefix"], "src/api/");
assert_eq!(v["ops"][0]["language"], "go");
assert_eq!(v["ops"][0]["external"], true);
assert_eq!(v["ops"][0]["external_kind"], "rest-api");
assert_eq!(v["ops"][0]["verifications"][0], "responds in 50ms");
Expand All @@ -575,6 +583,7 @@ mod tests {
outputs: None,
user_kind: Some(None),
path_prefix: None,
language: None,
external: None,
external_kind: None,
protocol: Some(Some("gRPC".to_string())),
Expand Down Expand Up @@ -636,6 +645,7 @@ mod tests {
outputs: None,
user_kind: None,
path_prefix: None,
language: None,
external: None,
external_kind: None,
protocol: None,
Expand Down Expand Up @@ -694,6 +704,7 @@ mod tests {
outputs: None,
user_kind: None,
path_prefix: None,
language: None,
external: None,
external_kind: None,
protocol: None,
Expand All @@ -711,6 +722,7 @@ mod tests {
outputs: None,
user_kind: None,
path_prefix: None,
language: None,
external: None,
external_kind: None,
protocol: None,
Expand Down Expand Up @@ -739,6 +751,7 @@ mod tests {
outputs: None,
user_kind: None,
path_prefix: None,
language: None,
external: None,
external_kind: None,
protocol: None,
Expand Down
13 changes: 13 additions & 0 deletions src/cmd/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub fn add(args: NodeAddArgs, mode: OutputMode) -> Result<(), CliError> {
config: parse_ports(&args.config)?,
user_kind: args.user_kind.as_deref(),
path_prefix: args.path_prefix.as_deref(),
language: args.language.as_deref(),
description: args.description.as_deref(),
constraints: args.constraints.clone(),
is_external: args.external,
Expand Down Expand Up @@ -92,6 +93,7 @@ pub fn set(args: NodeSetArgs, mode: OutputMode) -> Result<(), CliError> {
// Scalars: a blank value is "untouched", mirroring `--description ""`.
user_kind: blank_to_none(args.user_kind.as_deref()),
path_prefix: blank_to_none(args.path_prefix.as_deref()),
language: blank_to_none(args.language.as_deref()),
// --external / --no-external toggle is_external; neither = untouched.
is_external: toggle_flag(args.external, args.no_external),
external_kind: blank_to_none(args.external_kind.as_deref()),
Expand All @@ -102,6 +104,7 @@ pub fn set(args: NodeSetArgs, mode: OutputMode) -> Result<(), CliError> {
clear_description: args.clear_description,
clear_user_kind: args.clear_user_kind,
clear_path_prefix: args.clear_path_prefix,
clear_language: args.clear_language,
clear_external_kind: args.clear_external_kind,
clear_protocol: args.clear_protocol,
clear_doc_url: args.clear_doc_url,
Expand Down Expand Up @@ -198,6 +201,7 @@ fn render_updated(u: &NodeUpdated, mode: OutputMode) -> String {
for (key, field) in [
("user_kind", &u.user_kind),
("path_prefix", &u.path_prefix),
("language", &u.language),
("external_kind", &u.external_kind),
("protocol", &u.protocol),
("doc_url", &u.doc_url),
Expand Down Expand Up @@ -237,6 +241,7 @@ fn render_updated(u: &NodeUpdated, mode: OutputMode) -> String {
}
fields.extend(scalar_label(&u.user_kind, "user-kind"));
fields.extend(scalar_label(&u.path_prefix, "path-prefix"));
fields.extend(scalar_label(&u.language, "language"));
fields.extend(scalar_label(&u.external_kind, "external-kind"));
fields.extend(scalar_label(&u.protocol, "protocol"));
fields.extend(scalar_label(&u.doc_url, "doc-url"));
Expand Down Expand Up @@ -433,6 +438,7 @@ mod tests {
constraints: None,
user_kind: None,
path_prefix: None,
language: None,
is_external: None,
external_kind: None,
protocol: None,
Expand All @@ -453,6 +459,7 @@ mod tests {
constraints: None,
user_kind: None,
path_prefix: None,
language: None,
is_external: None,
external_kind: None,
protocol: None,
Expand All @@ -478,6 +485,7 @@ mod tests {
constraints: Some(vec!["c".to_string()]),
user_kind: None,
path_prefix: None,
language: None,
is_external: None,
external_kind: None,
protocol: None,
Expand All @@ -500,6 +508,7 @@ mod tests {
constraints: Some(vec![]),
user_kind: None,
path_prefix: None,
language: None,
is_external: None,
external_kind: None,
protocol: None,
Expand All @@ -521,6 +530,7 @@ mod tests {
constraints: None,
user_kind: None,
path_prefix: None,
language: None,
is_external: None,
external_kind: None,
protocol: None,
Expand Down Expand Up @@ -573,6 +583,7 @@ mod tests {
constraints: None,
user_kind: Some(Some("subsystem".to_string())),
path_prefix: Some(Some("src/api/".to_string())),
language: None,
is_external: Some(true),
external_kind: Some(Some("rest-api".to_string())),
protocol: None,
Expand Down Expand Up @@ -609,6 +620,7 @@ mod tests {
constraints: None,
user_kind: Some(None), // cleared
path_prefix: None, // untouched
language: None,
is_external: None,
external_kind: None,
protocol: Some(Some("gRPC".to_string())), // set
Expand Down Expand Up @@ -647,6 +659,7 @@ mod tests {
constraints: None,
user_kind: None,
path_prefix: None,
language: None,
is_external: None,
external_kind: None,
protocol: None,
Expand Down
Loading