Skip to content

[BFP-2143] Generate client with openapi-generator-cli v7.13.0#116

Merged
kevin-ip merged 6 commits intomainfrom
kevin/BFP-2143-use-openapi-generator-cli-v7.13.0
Jun 3, 2025
Merged

[BFP-2143] Generate client with openapi-generator-cli v7.13.0#116
kevin-ip merged 6 commits intomainfrom
kevin/BFP-2143-use-openapi-generator-cli-v7.13.0

Conversation

@kevin-ip
Copy link
Copy Markdown
Contributor

@kevin-ip kevin-ip commented Jun 3, 2025

User description

  • update python example/main.py
  • update ts example.ts
  • add 10 secs timeout to rust ws examples
  • fix reqwest error in Rust when using v7.13.0:
    Error: AuthenticationRequestFailed("error in reqwest: error sending request for url (https://auth.api.sui-staging.bluefin.io/auth/v2/token)")
    

PR Type

enhancement, bug_fix


Description

  • Regenerate API clients using openapi-generator-cli v7.13.0

    • Update Python, Rust, and TypeScript SDKs to latest generator output
    • Update generator version markers in SDKs
  • Improve Rust API client error handling for content types

    • Add content-type checks and explicit error messages for unsupported types
    • Prevents deserialization errors on unexpected responses
  • Add shutdown timeout logic to Rust WebSocket examples

    • Introduce shutdown module and use in all Rust WS examples
    • Ensures clean shutdown after a timeout
  • Update example scripts for Python and TypeScript SDKs

    • Add secondary wallet usage for account authorization/deauthorization
    • Update comments and logging for clarity
  • Enhance Python SDK configuration for CA certificate data

    • Add ca_cert_data support for SSL context
    • Update requirements and documentation for Python 3.9+ and urllib3 2.x

Changes walkthrough 📝

Relevant files
Bug fix
6 files
account_data_api.rs
Add content-type aware error handling to API responses     
+57/-7   
auth_api.rs
Add content-type checks and error handling to auth endpoints
+46/-6   
exchange_api.rs
Add content-type checks and error handling to exchange endpoints
+79/-9   
rewards_api.rs
Add content-type checks and error handling to rewards endpoints
+167/-17
trade_api.rs
Add content-type checks and error handling to trade endpoints
+46/-6   
streams_api.rs
Prepare for content-type aware error handling (import only)
+2/-2     
Enhancement
15 files
mod.rs
Introduce ContentType enum for response handling                 
+21/-0   
ws-candlestick-stream.rs
Add shutdown timeout logic to candlestick WS example         
+3/-0     
ws-leverage-update-failure.rs
Add shutdown timeout logic to leverage update WS example 
+3/-0     
ws-mark-price-stream.rs
Add shutdown timeout logic to mark price WS example           
+3/-0     
ws-oracle-price-stream.rs
Add shutdown timeout logic to oracle price WS example       
+3/-0     
ws-recent-trade-stream.rs
Add shutdown timeout logic to recent trade WS example       
+3/-0     
ws-ticker-all-stream.rs
Add shutdown timeout logic to ticker-all WS example           
+3/-0     
ws-ticker-stream.rs
Add shutdown timeout logic to ticker WS example                   
+3/-0     
lib.rs
Export shutdown module in crate root                                         
+2/-0     
shutdown.rs
Add shutdown utility for timed shutdowns                                 
+14/-0   
example.ts
Add secondary wallet for account auth/deauth in example   
+9/-3     
configuration.ts
Minor formatting and docstring updates from regeneration 
+95/-117
main.py
Add secondary wallet for account auth/deauth in example   
+7/-7     
configuration.py
Add ca_cert_data option for SSL context                                   
+9/-2     
rest.py
Support ca_cert_data in SSL context creation                         
+2/-1     
Documentation
5 files
Trade.md
Document new orderType field in Trade model                           
+2/-0     
AuthApi.md
Minor doc formatting updates from regeneration                     
+0/-8     
TradeApi.md
Improve cancel orders endpoint documentation formatting   
+11/-2   
openapi_client_README.md
Update generator version, Python/urllib3 requirements       
+3/-3     
README.md
Update generator version in README                                             
+1/-1     
Dependencies
4 files
VERSION
Bump openapi-generator version to 7.13.0                                 
+1/-1     
VERSION
Bump openapi-generator version to 7.13.0                                 
+1/-1     
Cargo.toml
Remove unused uuid dependency from Cargo.toml                       
+0/-1     
Cargo.toml
Add tokio as a main dependency for shutdown logic               
+1/-0     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @qodo-code-review
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The new content-type checking code is duplicated across multiple API functions. Consider refactoring this pattern into a helper function to reduce code duplication and improve maintainability.

    let content_type = resp
        .headers()
        .get("content-type")
        .and_then(|v| v.to_str().ok())
        .unwrap_or("application/octet-stream");
    let content_type = super::ContentType::from(content_type);
    
    if !status.is_client_error() && !status.is_server_error() {
        let content = resp.text().await?;
        match content_type {
            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetAffiliateIntervalOverview200Response`"))),
            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetAffiliateIntervalOverview200Response`")))),
        }
    } else {
    Type Imports

    The Union type is imported from typing module but was previously not needed. Verify that this change is compatible with the minimum Python version requirements, which were updated from 3.8+ to 3.9+.

    from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
    from typing_extensions import NotRequired, Self

    @qodo-code-review
    Copy link
    Copy Markdown

    qodo-code-review Bot commented Jun 3, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Comment thread rust/src/shutdown.rs
    @@ -0,0 +1,14 @@
    use std::sync::atomic::AtomicBool;
    Copy link
    Copy Markdown
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This seems like a utility purely for examples right? In that case, it's better to put it in the example folder?

    Copy link
    Copy Markdown
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    We shouldn't expose this as part of the public sdk IMO

    Copy link
    Copy Markdown
    Contributor Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    IDE complains about No main function found. Anyway to suppress it?

    Screenshot 2025-06-03 at 2 16 09 PM

    @kevin-ip kevin-ip merged commit c1d4ab8 into main Jun 3, 2025
    @kevin-ip kevin-ip deleted the kevin/BFP-2143-use-openapi-generator-cli-v7.13.0 branch June 3, 2025 20:09
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    3 participants