Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[github] Fix compilation wiht httpcache feature enabled #63

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

chantra
Copy link
Contributor

@chantra chantra commented Mar 15, 2023

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

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

This change converts `anyhow::Error`s to `ClientError`s and
`anyhow::Result`s to `ClientResult`s.

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
```
@augustuswm augustuswm merged commit 0acc3ad into oxidecomputer:main Mar 15, 2023
@chantra
Copy link
Contributor Author

chantra commented Mar 15, 2023

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
Copy link
Contributor

augustuswm commented Mar 15, 2023

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

@chantra chantra deleted the fix_specialized_errors branch March 15, 2023 20:20
kavin-kr pushed a commit to kavin-kr/third-party-api-clients that referenced this pull request Mar 28, 2023
…r#63)

This change converts `httpcache` `anyhow::Error`s to `ClientError`s and `anyhow::Result`s to `ClientResult`s.
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.

2 participants