-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Sindri-Labs/klm-update-client-plus-patches
Update openapi, use original spec, reformat patches
- Loading branch information
Showing
133 changed files
with
2,713 additions
and
1,887 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ README.md | |
git_push.sh | ||
.travis.yml | ||
docs/ | ||
openapi.patch | ||
patches/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7.10.0 | ||
7.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Manual Patches | ||
|
||
Internal documentation. | ||
|
||
## Patch List | ||
|
||
Most of these patches (marked with a `*`) are temporary solutions until the openapi-generator fully supports 3.1.0 specifications. | ||
Removing `scripts/openapitools.json` and rerunning `./scripts/update-sdk.sh` will regenerate the client with the latest rust openapi-generator version, potentially removing the need for some of these patches. | ||
|
||
| Filename | Purpose | Patched Files | | ||
|----------------|--------------------------|-----------------------| | ||
| `circuit_creation.patch` | *Creates custom multipart form data | `src/apis/circuits_api.rs` | | ||
| `define_any_ltgt.patch` | *Defines `AnyOfLessThanGreaterThan` type (as `serde_json::Value`) | `src/models/mod.rs` | | ||
| `export_some_internals.patch` | Exports some internal types for use in `sindri-rs` | `src/apis/mod.rs` | | ||
| `no_circuit_response_nest.patch` | Circuit info is not nested by `circuit_type`, this patch removes the nesting | `src/models/circuit_info_response.rs` | | ||
| `rm_id_options_restore_download.patch` | *Identifiers should not be optional for path params | `src/apis/internal_api.rs` | | ||
| `rm_proof_id_option.patch` | *Identifier should not be optional for path params | `src/apis/proofs_api.rs` | | ||
| `two_input_modes.patch` | Allows automatic inference of proof input type from string or JSON | `src/models/proof_input.rs` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
diff --git a/openapi/src/apis/circuits_api.rs b/openapi/src/apis/circuits_api.rs | ||
index b604ac4..96d8aad 100644 | ||
--- a/openapi/src/apis/circuits_api.rs | ||
+++ b/openapi/src/apis/circuits_api.rs | ||
@@ -73,7 +73,7 @@ pub enum ProofCreateError { | ||
/// Create a circuit. | ||
pub async fn circuit_create( | ||
configuration: &configuration::Configuration, | ||
- files: Vec<std::path::PathBuf>, | ||
+ files: Vec<u8>, | ||
meta: Option<std::collections::HashMap<String, String>>, | ||
tags: Option<Vec<String>>, | ||
) -> Result<models::CircuitInfoResponse, Error<CircuitCreateError>> { | ||
@@ -96,23 +96,58 @@ pub async fn circuit_create( | ||
if let Some(ref token) = configuration.bearer_access_token { | ||
req_builder = req_builder.bearer_auth(token.to_owned()); | ||
}; | ||
- let mut multipart_form = reqwest::multipart::Form::new(); | ||
- // TODO: support file upload for 'files' parameter | ||
- if let Some(param_value) = p_meta { | ||
- multipart_form = multipart_form.text("meta", param_value.to_string()); | ||
+ // Build the request body directly in order to avoid a streaming request | ||
+ // that is incompatible with the retry middleware | ||
+ let boundary = "----------------------------4ebf00fbcf09"; | ||
+ req_builder = req_builder.header( | ||
+ "Content-Type", | ||
+ format!("multipart/form-data; boundary={boundary}"), | ||
+ ); | ||
+ | ||
+ let filename = "rust_sdk_upload.tar.gz"; | ||
+ let mut byte_string = Vec::new(); | ||
+ byte_string.extend_from_slice( | ||
+ format!( | ||
+ "--{boundary}\r\n\ | ||
+ Content-Disposition: form-data; name=\"files\"; filename=\"{filename}\"\r\n\ | ||
+ \r\n", | ||
+ ) | ||
+ .as_bytes(), | ||
+ ); | ||
+ byte_string.extend(p_files); | ||
+ byte_string.extend_from_slice(format!("--{boundary}--\r\n").as_bytes()); // End of files | ||
+ if let Some(p_tags) = p_tags { | ||
+ for tag in p_tags { | ||
+ byte_string.extend_from_slice( | ||
+ format!( | ||
+ "--{boundary}\r\n\ | ||
+ Content-Disposition: form-data; name=\"tags\"\r\n\ | ||
+ \r\n\ | ||
+ {tag}\r\n" | ||
+ ) | ||
+ .as_bytes(), | ||
+ ); | ||
+ byte_string.extend_from_slice(format!("--{boundary}--\r\n").as_bytes()); | ||
+ // End of tag | ||
+ } | ||
} | ||
- if let Some(param_value) = p_tags { | ||
- multipart_form = multipart_form.text( | ||
- "tags", | ||
- param_value | ||
- .into_iter() | ||
- .map(|p| p.to_string()) | ||
- .collect::<Vec<String>>() | ||
- .join(",") | ||
- .to_string(), | ||
+ if let Some(p_meta) = p_meta { | ||
+ let meta_json = serde_json::to_string(&p_meta)?; | ||
+ byte_string.extend_from_slice( | ||
+ format!( | ||
+ "--{boundary}\r\n\ | ||
+ Content-Disposition: form-data; name=\"meta\"\r\n\ | ||
+ Content-Type: application/json\r\n\ | ||
+ \r\n\ | ||
+ {meta_json}\r\n" | ||
+ ) | ||
+ .as_bytes(), | ||
); | ||
+ byte_string.extend_from_slice(format!("--{boundary}--\r\n").as_bytes()); | ||
+ // End of meta | ||
} | ||
- req_builder = req_builder.multipart(multipart_form); | ||
+ let local_var_body = reqwest::Body::from(byte_string); | ||
+ req_builder = req_builder.body(local_var_body); | ||
|
||
let req = req_builder.build()?; | ||
let resp = configuration.client.execute(req).await?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
diff --git a/openapi/src/models/mod.rs b/openapi/src/models/mod.rs | ||
index ba528a7..971bc35 100644 | ||
--- a/openapi/src/models/mod.rs | ||
+++ b/openapi/src/models/mod.rs | ||
@@ -1,3 +1,4 @@ | ||
+pub type AnyOfLessThanGreaterThan = serde_json::Value; | ||
pub mod action_response; | ||
pub use self::action_response::ActionResponse; | ||
pub mod api_key_does_not_exist_response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/openapi/src/apis/mod.rs b/openapi/src/apis/mod.rs | ||
index 18c0d9d..9347831 100644 | ||
--- a/openapi/src/apis/mod.rs | ||
+++ b/openapi/src/apis/mod.rs | ||
@@ -103,7 +103,11 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String | ||
|
||
pub mod authorization_api; | ||
pub mod circuits_api; | ||
-pub mod internal_api; | ||
+#[allow(dead_code)] | ||
+mod internal_api; | ||
+pub use internal_api::{ | ||
+ circuit_download, circuit_status, proof_status, CircuitStatusError, ProofStatusError, | ||
+}; | ||
pub mod proofs_api; | ||
pub mod token_api; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/openapi/src/models/circuit_info_response.rs b/openapi/src/models/circuit_info_response.rs | ||
index 2f6d0d2..1b50f0b 100644 | ||
--- a/openapi/src/models/circuit_info_response.rs | ||
+++ b/openapi/src/models/circuit_info_response.rs | ||
@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize}; | ||
|
||
/// CircuitInfoResponse : Response for getting circuit info. | ||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
-#[serde(tag = "circuit_type")] | ||
+#[serde(untagged)] | ||
pub enum CircuitInfoResponse { | ||
#[serde(rename = "boojum")] | ||
Boojum(Box<models::BoojumCircuitInfoResponse>), |
Oops, something went wrong.