fix(api-explorer): remove broken --query flag, add domains catalog source (DEVEX-898)#124
Conversation
…urce (DEVEX-898) `gddy api call --query` silently nulled the response body on any lookup miss instead of extracting the requested field, and duplicated the global `--expr`/`--filter` JMESPath flags cli-engine already provides on every command. Remove the local flag and hand-rolled path parser in favor of the global flags, which are strictly more capable and operate on the same printed envelope. Also wire domains-client's vendored OpenAPI spec in as a new "domains" local catalog source (same mechanism already used for hosting-nodejs), so `gddy api domain/endpoint/describe/call` can browse and call the Domains registrar API for the first time, using the same spec that already drives the typed domains-client crate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…omains local source Follow-up to the previous commit's domains catalog source — the test asserting the reconciled domain count/list was still hardcoded to the pre-change values. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
domains-client called straight into cli_engine::transport from inside its progenitor ClientHooks impl, giving a generated, otherwise framework-agnostic client a hard compile-time dependency on cli-engine purely for --debug transport logging — and leaving its own minimum cli-engine version (0.4.0) to drift from the main crate's (0.4.2). Replace it with a TransportObserver trait domains-client defines and owns; the main crate now pushes an adapter into it via set_transport_observer instead of domains-client pulling from the engine. domains-client no longer depends on cli-engine at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Rust GoDaddy CLI’s API explorer and Domains integration by removing a broken response-extraction flag, adding a new embedded domains API catalog source, and decoupling domains-client from cli-engine via an observer extension point.
Changes:
- Removes
gddy api call’s bespoke--query/-qJSON-path extraction and points users to the global--expr/--filter(JMESPath) output flags instead. - Adds the Domains catalog (
domains) as a local API explorer source (including schema + manifest/source wiring). - Introduces a
domains-client::TransportObserverhook so the main crate can push--debug transportlogging in withoutdomains-clientdepending oncli-engine.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/tools/generate-api-catalog/src/main.rs | Updates catalog source manifest test expectations for the new domains local source. |
| rust/src/domain/common.rs | Pushes a TransportObserver adapter into domains-client to bridge into cli-engine transport debug logging. |
| rust/src/api_explorer/mod.rs | Adds domains to embedded catalog and removes the broken --query flag + extraction logic. |
| rust/schemas/api/manifest.json | Registers domains.json in the embedded API catalog manifest. |
| rust/schemas/api/domains.json | Adds the embedded Domains API schema used by api_explorer. |
| rust/domains-client/src/lib.rs | Defines TransportObserver, adds global registration API, and forwards hooks to the observer. |
| rust/domains-client/Cargo.toml | Removes the cli-engine dependency from domains-client. |
| rust/Cargo.lock | Reflects removal of cli-engine from domains-client dependencies. |
| rust/api-catalog-sources.json | Adds domains-client’s vendored OpenAPI input as a local catalog source. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ClientHooks::pre/post called the registered TransportObserver while still holding TRANSPORT_OBSERVER's read guard. Calling out to caller-provided code under a lock risks deadlock if an observer ever needs the write lock (e.g. via set_transport_observer) or re-enters through another hook. Clone the Arc out and drop the guard first. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
qcai-godaddy
left a comment
There was a problem hiding this comment.
Still ramping, but from what I followed this looks solid. Left a few questions just for my own understanding :)
|
|
||
| static TRANSPORT_OBSERVER_INIT: std::sync::Once = std::sync::Once::new(); | ||
|
|
||
| fn ensure_transport_observer_registered() { |
There was a problem hiding this comment.
For any future generated client, I assume we’d reuse this same push/TransportObserver pattern?
There was a problem hiding this comment.
Yep. At some point we might be able to extract something common in the engine, but for now we just have this one HTTP client.
| }, | ||
| { | ||
| "domain": "domains", | ||
| "path": "domains-client/openapi/domains.oas3.json" |
There was a problem hiding this comment.
After someone updates that OpenAPI, what’s the intended regen path for gddy domain and gddy api?
There was a problem hiding this comment.
It's this https://github.com/godaddy/cli/blob/rust-port/rust/domains-client/scripts/regenerate-spec.sh script. I dislike how we now have three separate spec downloading/processing code paths. Created https://godaddy-corp.atlassian.net/browse/DEVEX-917 to track consolidating the logic.
Summary
gddy api call's broken, hand-rolled--query/-qflag (DEVEX-898) — any lookup miss silently coerced the response tonull. Points users at cli-engine's global--expr/--filter(JMESPath) flags instead, which are strictly more capable and already applied to every command's output.domains-client's vendored OpenAPI spec in as a newdomainslocal catalog source forapi_explorer(same mechanism already used forhosting-nodejs), sogddy api domain/endpoint/describe/callcan browse and call the Domains registrar API for the first time — using the same spec that already drives the typeddomains-clientcrate.domains-client's dependency oncli-enginefrom pull to push: it now defines its ownTransportObserverextension point, and the main crate pushes a--debug transportadapter into it, instead ofdomains-clientcalling intocli-enginedirectly.domains-clientno longer depends oncli-engineat all.Test plan
cargo build,cargo test --workspace,cargo clippy --workspace -- -D warningsall cleangddy api call <endpoint> --query foonow rejected by clap as an unknown flaggddy api call <endpoint> --expr .../--output jsonextraction verified against no-auth commandsgddy api domain listshows a newdomainsrow;gddy api endpoint list --domain domainslists all 15 endpoints;gddy api describe suggestDomainsshows full detail with correct scopesgddy domain suggest ... --debug transportconfirms the pushedTransportObserveradapter fires end-to-end with zerocli-enginedependency insidedomains-client(cargo tree -p domains-clientno longer listscli-engine)🤖 Generated with Claude Code