Skip to content
Open
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
26 changes: 24 additions & 2 deletions rust/Cargo.lock

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

6 changes: 4 additions & 2 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "GoDaddy developer CLI"
license = "Proprietary"

[workspace]
members = [".", "tools/generate-api-catalog", "domains-client"]
members = [".", "tools/generate-api-catalog", "domains-client", "shopping-client"]

[[bin]]
name = "gddy"
Expand All @@ -20,9 +20,10 @@ 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.9.3" }
cli-engine = { version = "0.9.5", features = ["pkce-auth"] }
dirs = "6"
domains-client = { path = "domains-client" }
shopping-client = { path = "shopping-client" }
fancy-regex = "0.14"
flate2 = { version = "1.1.9", default-features = false, features = ["rust_backend"] }
globset = "0.4"
Expand All @@ -34,6 +35,7 @@ oxc_parser = "0.143"
oxc_span = "0.143"
oxc_syntax = "0.143"
phonenumber = "0.3"
progenitor-client = "0.14"
regex = { version = "1", features = ["std"] }
reqwest = { version = "0.13", default-features = false, features = ["json", "multipart", "form", "rustls"] }
self-replace = "1.5.0"
Expand Down
5 changes: 5 additions & 0 deletions rust/api-catalog-sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
"domain": "shipping",
"repository": "commerce.shipping-specification"
},
{
"domain": "shopping",
"repository": "shopping.ucp-specification",
"catalog": false
},
{
"domain": "stores",
"repository": "commerce.stores-specification"
Expand Down
27 changes: 27 additions & 0 deletions rust/shopping-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "shopping-client"
version = "0.2.12"
edition = "2024"
license = "Proprietary"
description = "Generated GoDaddy Shopping API client, produced from the vendored OpenAPI 3.0 spec by progenitor at build time."

[dependencies]
progenitor-client = "0.14"
reqwest = { version = "0.13", default-features = false, features = ["json", "rustls", "stream"] }
schemars = { version = "1", features = ["derive"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
futures = "0.3"
bytes = "1"
thiserror = "2"

[build-dependencies]
progenitor = "0.14"
openapiv3 = "2"
serde_json = "1"
prettyplease = "0.2"
syn = "2"

[dev-dependencies]
httpmock = "0.8"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync"] }
27 changes: 27 additions & 0 deletions rust/shopping-client/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! Generates the typed Shopping API client from the vendored OpenAPI 3.0 spec.
//!
//! The committed `openapi/shopping.oas3.json` is regenerated by `cargo run -p
//! generate-api-catalog` from the canonical `gdcorp-platform/shopping.ucp-specification`
//! contract. This build step is hermetic and never accesses the network.

use std::{env, fs, path::Path};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let spec_path = "openapi/shopping.oas3.json";
println!("cargo:rerun-if-changed={spec_path}");
println!("cargo:rerun-if-changed=build.rs");

let spec_text = fs::read_to_string(spec_path)?;
let spec: openapiv3::OpenAPI = serde_json::from_str(&spec_text)?;
let mut settings = progenitor::GenerationSettings::new();
settings.with_interface(progenitor::InterfaceStyle::Builder);
settings.with_derive("schemars::JsonSchema");
let mut generator = progenitor::Generator::new(&settings);
let tokens = generator.generate_tokens(&spec)?;
let ast = syn::parse2(tokens)?;
fs::write(
Path::new(&env::var("OUT_DIR")?).join("codegen.rs"),
prettyplease::unparse(&ast),
)?;
Ok(())
}
Loading
Loading