Skip to content

fix(api-explorer): remove broken --query flag, add domains catalog source (DEVEX-898)#124

Merged
jpage-godaddy merged 4 commits into
rust-portfrom
api-query-flag
Jul 20, 2026
Merged

fix(api-explorer): remove broken --query flag, add domains catalog source (DEVEX-898)#124
jpage-godaddy merged 4 commits into
rust-portfrom
api-query-flag

Conversation

@jpage-godaddy

Copy link
Copy Markdown
Collaborator

Summary

  • Removes gddy api call's broken, hand-rolled --query/-q flag (DEVEX-898) — any lookup miss silently coerced the response to null. 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.
  • Wires domains-client's vendored OpenAPI spec in as a new domains local catalog source for api_explorer (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.
  • Inverts domains-client's dependency on cli-engine from pull to push: it now defines its own TransportObserver extension point, and the main crate pushes a --debug transport adapter into it, instead of domains-client calling into cli-engine directly. domains-client no longer depends on cli-engine at all.

Test plan

  • cargo build, cargo test --workspace, cargo clippy --workspace -- -D warnings all clean
  • gddy api call <endpoint> --query foo now rejected by clap as an unknown flag
  • gddy api call <endpoint> --expr ... / --output json extraction verified against no-auth commands
  • gddy api domain list shows a new domains row; gddy api endpoint list --domain domains lists all 15 endpoints; gddy api describe suggestDomains shows full detail with correct scopes
  • gddy domain suggest ... --debug transport confirms the pushed TransportObserver adapter fires end-to-end with zero cli-engine dependency inside domains-client (cargo tree -p domains-client no longer lists cli-engine)

🤖 Generated with Claude Code

jpage-godaddy and others added 3 commits July 17, 2026 12:16
…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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/-q JSON-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::TransportObserver hook so the main crate can push --debug transport logging in without domains-client depending on cli-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.

Comment thread rust/domains-client/src/lib.rs Outdated
Comment thread rust/domains-client/src/lib.rs
Comment thread rust/schemas/api/domains.json
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.

@qcai-godaddy qcai-godaddy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still ramping, but from what I followed this looks solid. Left a few questions just for my own understanding :)

Comment thread rust/src/domain/common.rs

static TRANSPORT_OBSERVER_INIT: std::sync::Once = std::sync::Once::new();

fn ensure_transport_observer_registered() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For any future generated client, I assume we’d reuse this same push/TransportObserver pattern?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After someone updates that OpenAPI, what’s the intended regen path for gddy domain and gddy api?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jpage-godaddy
jpage-godaddy merged commit c07994a into rust-port Jul 20, 2026
2 checks passed
@jpage-godaddy
jpage-godaddy deleted the api-query-flag branch July 20, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants