diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a4f407791..c7ba287e7 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,10 @@ updates: ignore: - dependency-name: "schemars" versions: [">=0.9.0"] + - package-ecosystem: "cargo" + directory: "/progenitor-impl/tests/output" + schedule: + interval: "weekly" + ignore: + - dependency-name: "schemars" + versions: [">=0.9.0"] diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bc1f19f9b..5eeef0e6d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -52,6 +52,16 @@ jobs: - name: Run tests run: cargo test --locked --verbose + build-test-output: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Build the generated clients + # We don't apply --locked here as there's no Cargo.lock committed for this crate + run: cargo build --manifest-path progenitor-impl/tests/output/Cargo.toml --verbose + build-no-default-features: runs-on: ${{ matrix.os }} strategy: diff --git a/progenitor-impl/tests/output/Cargo.toml b/progenitor-impl/tests/output/Cargo.toml index 37255a091..d9b10b7e8 100644 --- a/progenitor-impl/tests/output/Cargo.toml +++ b/progenitor-impl/tests/output/Cargo.toml @@ -3,22 +3,25 @@ [package] name = "test-output" version = "0.1.0" -edition = "2024" +# typify uses `gen` as a name for parameters of the `JsonSchema` impls it emits. +# `gen` is a reserved word in Rust 2024, so generated code that derives `schemars::JsonSchema` +# only parses under an earlier edition. +edition = "2021" rust-version = "1.85" license = "MPL-2.0" [dependencies] anyhow = "1.0" -base64 = "0.21" +base64 = "0.23" chrono = { version = "0.4", features = ["serde"] } clap = { version = "4", features = ["string"] } futures = "0.3" -httpmock = "0.7" +httpmock = "0.8" progenitor-client = { path = "../../../progenitor-client" } -rand = { version = "0.8", features = ["serde1"] } +rand = { version = "0.10", features = ["serde"] } regex = "1.10" -regress = "0.7" -reqwest = "0.12" +regress = "0.12" +reqwest = "0.13" schemars = { version = "0.8", features = ["chrono", "uuid1"] } serde = { features = ["derive"], version = "1" } serde_json = "1" diff --git a/progenitor-impl/tests/output/src/lib.rs b/progenitor-impl/tests/output/src/lib.rs index 1bb9e9564..4e3e426aa 100644 --- a/progenitor-impl/tests/output/src/lib.rs +++ b/progenitor-impl/tests/output/src/lib.rs @@ -32,3 +32,23 @@ pub mod test_default_params_builder; pub mod test_default_params_positional; pub mod test_freeform_response; pub mod test_renamed_parameters; + +// progenitor emits `clap::value_parser!(T)` for every argument, and clap +// infers the parser from the traits the type implements. `GetThingOrThingsId` +// implements none that clap accepts, so we, as the consumer, supply the +// parser through `ValueParserFactory`, which is what the CLI generator asks a +// consumer to do. +impl ::clap::builder::ValueParserFactory for buildomat_builder::types::GetThingOrThingsId { + type Parser = ::clap::builder::MapValueParser< + ::clap::builder::StringValueParser, + fn(String) -> buildomat_builder::types::GetThingOrThingsId, + >; + + fn value_parser() -> Self::Parser { + ::clap::builder::TypedValueParser::map( + ::clap::builder::StringValueParser::new(), + buildomat_builder::types::GetThingOrThingsId::String + as fn(String) -> buildomat_builder::types::GetThingOrThingsId, + ) + } +}