fix: domain-purchase data formatting + comprehensive CLI help#75
Merged
Conversation
Address four bug-bash issues from the API Transformation MVP tracker: - #12 Normalize contact phone/fax to the Domains API's `+<code>.<number>` format via the `phonenumber` crate (parsing with the contact's country as the default region), so common inputs like `+44 7793 601890` or a local `07793 601890` are accepted instead of returning a cryptic 422. - #33 Omit blank optional contact fields (address2, name_middle, organization, job_title, fax) instead of sending empty strings, which the API rejects with LENGTH_UNDER. - #14 Translate Domains API validation errors (`fields[]`) into plain-English guidance in `format_api_error`, suppressing the raw regex-bearing messages; the raw body remains available under `--debug`. - #27 Comprehensive help pass: root long help, plus `.with_long()` and argument-help review across domain, dns, api, application, env, payments, webhook, and actions commands. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes Domains “purchase” request formatting issues and improves the CLI’s self-documentation by adding comprehensive long-form help across many command groups. It normalizes contact data to match Domains API expectations, renders validation errors as plain-English summaries, and expands --help guidance for major command surfaces.
Changes:
- Normalize
contacts.tomlphone/fax values to the Domains API+<code>.<number>format and omit blank optional contact fields instead of sending"". - Translate Domains API structured validation errors (
fields[]) into a friendly bullet list, while preserving access to the raw JSON body under--debug. - Add/refresh long help strings for root and multiple command groups to make CLI discovery easier.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/src/contacts/mod.rs | Normalizes phone/fax, coerces blank optional fields to None, and adds unit tests. |
| rust/src/domain/mod.rs | Adds friendly validation error rendering + tests; expands long help for domain commands. |
| rust/src/main.rs | Adds root long help and updates global --env help text. |
| rust/src/env/mod.rs | Adds long help for env group and subcommands. |
| rust/src/dns/mod.rs | Adds long help for dns group and subcommands. |
| rust/src/api_explorer/mod.rs | Adds long help for API explorer group and commands. |
| rust/src/application/commands/mod.rs | Adds long help for application commands and “add” subgroups. |
| rust/src/actions_catalog/mod.rs | Adds long help for actions catalog group and commands. |
| rust/src/payments/mod.rs | Adds long help for payments group. |
| rust/src/webhook/mod.rs | Adds long help for webhook group and events command. |
| rust/Cargo.toml | Adds phonenumber dependency. |
| rust/Cargo.lock | Locks new transitive dependencies from phonenumber. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jbrooks2-godaddy
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses four data-formatting issues from the API Transformation MVP tracker bug bash (#12, #14, #27, #33).
#12 — phone normalization (
contacts/mod.rs)Contact::to_api()now normalizesphone(andfax) to the Domains API's required+<country-code>.<number>format using the newphonenumbercrate, parsed with the contact'scountryas the default region. Inputs like+447793601890,+44 7793 601890, and a local07793 601890all become+44.7793601890; unparseable input fails fast with a plain-English error and an example.#33 — omit blank optional fields (
contacts/mod.rs)Blank optional contact fields (
address2,name_middle,organization,job_title,fax) are coerced toNoneso they're omitted rather than sent as"", which the API rejected withLENGTH_UNDER.#14 — translate validation errors (
domain/mod.rs)format_api_errorparses the API'sfields[]array and renders a plain-English bullet list (friendly field name + problem + hint), e.g. "registrant mailing address line 2 is too short (leave it blank to omit it)". The raw regex-bearing messages are suppressed; the full JSON body stays available under--debug. Non-validation bodies (incl. the 402 path) keep their existing passthrough behavior.#27 — comprehensive help pass
Root long help in
main.rs, plus.with_long()and argument-help review acrossdomain,dns,api,application,env,payments,webhook, andactions. Corrected an inaccurate "requires--reason" claim (the CLI registers no authorizer, so--reasonis audit-only) and removed custom/local-environment language from user-facing help.Testing
cargo test— 195 passing (14 new unit tests acrosscontactsanddomain)cargo clippy --all-targets -- -D warnings— cleancargo fmt --check— clean--helpfor root,domain purchase,dns,api call,application add subscription, andenvcommands🤖 Generated with Claude Code