oxidecomputer / third-party-api-clients

A place for keeping all our generated third party API clients.
https://docs.rs/octorust
MIT License
133 stars 56 forks source link

[github] Fix compilation wiht httpcache feature enabled #63

Closed chantra closed 1 year ago

chantra commented 1 year ago

In #57, I forgot to test with httpcache feature enabled. There were some anyhow reference left that got exposed during CI.

This change converts anyhow::Errors to ClientErrors and anyhow::Results to ClientResults.

Tested using:

 make github && cargo build --features httpcache
--manifest-path=github/Cargo.toml && cargo build
--manifest-path=github/Cargo.toml
./target/debug/generator -i
/data/users/chantra/oxidecomputer-third-party-api-clients/specs/github/api.github.com.json
-v 0.3.2 \
        -o github \
        -n octorust \
        --proper-name GitHub \
        -d "A fully generated & opinionated API client for the GitHub
API." \
        --spec-link "https://github.com/github/rest-api-description" \
        --host "api.github.com"
Only default server urls are supported. Variables are not configurable
component responses not supported
component parameters not supported
component headers not supported
op repos/upload-release-asset: servers are only partially supported.
Variables are not supported
[warn] got ANY kind: Some("instances") code scanning alert AnySchema {
typ: None, pattern: None, multiple_of: None, exclusive_minimum: None,
exclusive_maximum: None, minimum: None, maximum: None, properties: {},
required: [], additional_properties: None, min_properties: None,
max_properties: None, items: None, min_items: None, max_items: None,
unique_items: None, enumeration: [], format: None, min_length: None,
max_length: None, one_of: [], all_of: [], any_of: [], not: None }

cargo fmt -p octorust
   Compiling octorust v0.3.2
(/data/users/chantra/oxidecomputer-third-party-api-clients/github)
    Finished dev [unoptimized + debuginfo] target(s) in 37.66s
   Compiling octorust v0.3.2
(/data/users/chantra/oxidecomputer-third-party-api-clients/github)
    Finished dev [unoptimized + debuginfo] target(s) in 40.35s
chantra commented 1 year ago

Given the error in https://github.com/oxidecomputer/third-party-api-clients/actions/runs/4429625601/jobs/7770453008

I wonder if clippy handles the feature switch fine.

For some reasons, I cannot repro locally on my devbox.

augustuswm commented 1 year ago

I believe this is just due to the CI not having all of the generated files. It currently runs against whatever is on main (without generating anything). I'm generating the updated clients now (to include the conditional IOError variant), and that should fix CI