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

#draft feat(rust): added crate genenerated with api #256

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions crates/openapi-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cargo.lock # for now, just allow to use whatever
target
14 changes: 14 additions & 0 deletions crates/openapi-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "process-compose-openapi-client"
version = "0.1.0"
edition = "2021"

[dependencies]
futures = "0.3"
progenitor = { git = "https://github.com/oxidecomputer/progenitor" }
reqwest = { version = "^0.12", default-features = false, features = ["json", "stream"] }
serde = { version = "1.0.42", default-features = false, features = ["derive"] }


[dev-dependencies]
tokio = { version = "1.4", features = ["macros"]}
2 changes: 2 additions & 0 deletions crates/openapi-client/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.81.0"
2 changes: 2 additions & 0 deletions crates/openapi-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use progenitor::generate_api;
generate_api!(spec = "../../src/docs/swagger.json");
7 changes: 7 additions & 0 deletions crates/openapi-client/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use process_compose_openapi_client;

#[tokio::test]
async fn compiles_but_errors_with_bad_url() {
let client = process_compose_openapi_client::Client::new("locahost:8080");
client.get_hostname().await.expect_err("errors on bad url");
}