Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async-trait = "0.1"
bytes = "1"
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
clap = { version = "4.5", features = ["std", "string"] }
cli-engine = { features = ["pkce-auth"], version = "0.4.5" }
cli-engine = { features = ["pkce-auth"], version = "0.4.6" }
dirs = "6"
domains-client = { path = "domains-client" }
fancy-regex = "0.14"
Expand Down
24 changes: 20 additions & 4 deletions rust/src/domain/available.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub(super) fn command() -> RuntimeCommandSpec {
)
.with_system("domain")
.with_tier(Tier::Read)
.with_default_fields("domain,available,definitive,price,currency")
.with_default_fields("domain,available,definitive,price,renewalPrice,currency,period")
.with_output_schema::<DomainAvailableResult>()
.with_scopes(&[DOMAINS_READ])
.with_arg(
Expand Down Expand Up @@ -79,8 +79,9 @@ pub(super) fn command() -> RuntimeCommandSpec {
// Emit the required identity fields concretely (never JSON null): the
// domain falls back to the known input, and missing booleans read as
// false — matching how availability is treated for the next action.
let resolved_domain = body.domain.clone().unwrap_or_else(|| domain.clone());
let mut result = json!({
"domain": body.domain.clone().unwrap_or_else(|| domain.clone()),
"domain": resolved_domain,
"available": body.available.unwrap_or(false),
"definitive": body.definitive.unwrap_or(false),
});
Comment thread
jpage-godaddy marked this conversation as resolved.
Expand All @@ -107,14 +108,29 @@ pub(super) fn command() -> RuntimeCommandSpec {
if body.available.unwrap_or(false) {
Ok(cmd.with_next_actions(vec![
next_action("domain quote <domain>", "Price a registration")
.with_param("domain", NextActionParam::required()),
.with_param("domain", NextActionParam::value(resolved_domain)),
]))
} else {
Ok(cmd.with_next_actions(vec![
// `domain suggest` accepts a seed domain, so the domain just
// checked as taken is a valid query to copy/paste directly.
next_action("domain suggest <query>", "Find alternatives")
.with_param("query", NextActionParam::required()),
.with_param("query", NextActionParam::value(resolved_domain)),
]))
}
},
)
}

#[cfg(test)]
mod tests {
use super::command;

#[test]
fn default_fields_includes_renewal_price() {
// Regression for GDDEVPLAT-133: `renewalPrice` was computed and present
// in `--output json` but silently dropped from the default table view.
let fields = command().spec.default_fields.expect("default fields set");
assert!(fields.contains("renewalPrice"), "{fields}");
Comment thread
jpage-godaddy marked this conversation as resolved.
Outdated
}
}
20 changes: 18 additions & 2 deletions rust/src/domain/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub(super) fn command() -> RuntimeCommandSpec {
.with_system("domain")
.with_tier(Tier::Read)
.with_default_fields(
"domain,available,price,currency,period,quoteToken,expiresAt,agreements",
"domain,available,price,renewalPrice,currency,period,quoteToken,expiresAt,agreements",
)
.with_output_schema::<DomainQuoteResult>()
.with_scopes(&[DOMAINS_READ])
Expand Down Expand Up @@ -327,13 +327,29 @@ pub(super) fn command() -> RuntimeCommandSpec {
} else {
// Not available (or no token was issued): point at discovery, the
// same next step `domain available` offers for a taken name.
// `domain suggest` accepts a seed domain, so the domain just
// quoted is a valid query to copy/paste directly.
let resolved_domain = quote.domain.clone().unwrap_or_else(|| domain.clone());
next_actions.push(
next_action("domain suggest <query>", "Find an available alternative")
.with_param("query", NextActionParam::required()),
.with_param("query", NextActionParam::value(resolved_domain)),
);
}

Ok(CommandResult::new(view).with_next_actions(next_actions))
},
)
}

#[cfg(test)]
mod tests {
use super::command;

#[test]
fn default_fields_includes_renewal_price() {
// Regression for GDDEVPLAT-133: `renewalPrice` was computed and present
// in `--output json` but silently dropped from the default table view.
let fields = command().spec.default_fields.expect("default fields set");
assert!(fields.contains("renewalPrice"), "{fields}");
Comment thread
jpage-godaddy marked this conversation as resolved.
Outdated
}
}
1 change: 1 addition & 0 deletions rust/src/scopes_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub(crate) fn auth_scopes_command() -> RuntimeCommandSpec {
.with_system("auth")
.with_tier(Tier::Read)
.with_output_schema::<ScopeEntry>()
.with_default_fields("scope,description,commands,default")
.no_auth(true)
.with_arg(
clap::Arg::new("command")
Expand Down