Skip to content

Commit

Permalink
POC generated rust client from openapi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
psFried committed Dec 5, 2024
1 parent 879528e commit 83a3409
Show file tree
Hide file tree
Showing 46 changed files with 1,934 additions and 1 deletion.
70 changes: 69 additions & 1 deletion Cargo.lock

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

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ reqwest = { version = "0.11", default-features = false, features = [
"json",
"rustls-tls",
"stream",
"multipart",
] }
rocksdb = { version = "0.22", default-features = false, features = [
"snappy",
Expand All @@ -131,6 +132,12 @@ schemars = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["raw_value", "float_roundtrip"] }
serde_yaml = "0.8"
serde_with = { version = "^3.8", default-features = false, features = [
"base64",
"std",
"macros",
] }
serde_repr = "^0.1"
serde-transcode = "1.1"
serde-wasm-bindgen = "0.4"
size = "0.4"
Expand Down
12 changes: 12 additions & 0 deletions crates/control-plane-api/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

Cargo.toml
docs/*
README.md
.gitignore
.travis.yml
git_push.sh
39 changes: 39 additions & 0 deletions crates/control-plane-api/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
src/apis/configuration.rs
src/apis/default_api.rs
src/apis/mod.rs
src/lib.rs
src/models/activation_status.rs
src/models/affected_consumer.rs
src/models/api_error.rs
src/models/auto_discover_failure.rs
src/models/auto_discover_outcome.rs
src/models/auto_discover_status.rs
src/models/catalog_type.rs
src/models/discover_change.rs
src/models/error.rs
src/models/evolved_collection.rs
src/models/incompatible_collection.rs
src/models/inferred_schema_status.rs
src/models/job_status.rs
src/models/job_status_one_of.rs
src/models/job_status_one_of_1.rs
src/models/job_status_one_of_2.rs
src/models/job_status_one_of_3.rs
src/models/job_status_one_of_4.rs
src/models/job_status_one_of_5.rs
src/models/job_status_one_of_6.rs
src/models/job_status_one_of_7.rs
src/models/job_status_one_of_8.rs
src/models/lock_failure.rs
src/models/mod.rs
src/models/publication_info.rs
src/models/publication_status.rs
src/models/re_create_reason.rs
src/models/rejected_field.rs
src/models/source_capture_status.rs
src/models/status_response.rs
src/models/status_response_controller_status.rs
src/models/status_response_controller_status_one_of.rs
src/models/status_response_controller_status_one_of_1.rs
src/models/status_response_controller_status_one_of_2.rs
src/models/status_response_controller_status_one_of_3.rs
1 change: 1 addition & 0 deletions crates/control-plane-api/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.10.0
18 changes: 18 additions & 0 deletions crates/control-plane-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "control-plane-api"
version.workspace = true
rust-version.workspace = true
edition.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
license.workspace = true

[dependencies]
serde = { workspace = true }
serde_with = { workspace = true }
serde_json = { workspace = true }
serde_repr = { workspace = true }
url = { workspace = true }
uuid = { workspace = true }
reqwest = { workspace = true }
8 changes: 8 additions & 0 deletions crates/control-plane-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Control-plane-api

All of the sources in this crate were generated by `openapi-generator` using the command:

`openapi-generator -i <control-plane-openapi-spec.json> -g rust -o . --additional-properties library=reqwest-trait`

The openapi spec was downloaded from a running agent instance.
I think this is probably not worth using.
51 changes: 51 additions & 0 deletions crates/control-plane-api/src/apis/configuration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Flow Control Plane V0 API
*
* some description here
*
* The version of the OpenAPI document:
*
* Generated by: https://openapi-generator.tech
*/



#[derive(Debug, Clone)]
pub struct Configuration {
pub base_path: String,
pub user_agent: Option<String>,
pub client: reqwest::Client,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub bearer_access_token: Option<String>,
pub api_key: Option<ApiKey>,
}

pub type BasicAuth = (String, Option<String>);

#[derive(Debug, Clone)]
pub struct ApiKey {
pub prefix: Option<String>,
pub key: String,
}


impl Configuration {
pub fn new() -> Configuration {
Configuration::default()
}
}

impl Default for Configuration {
fn default() -> Self {
Configuration {
base_path: "http://localhost".to_owned(),
user_agent: Some("OpenAPI-Generator//rust".to_owned()),
client: reqwest::Client::new(),
basic_auth: None,
oauth_access_token: None,
bearer_access_token: None,
api_key: None,
}
}
}
Loading

0 comments on commit 83a3409

Please sign in to comment.