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

[BUG][Rust] Invalid Rust generated code #14107

Open
5 of 6 tasks
arttet opened this issue Nov 24, 2022 · 1 comment
Open
5 of 6 tasks

[BUG][Rust] Invalid Rust generated code #14107

arttet opened this issue Nov 24, 2022 · 1 comment

Comments

@arttet
Copy link

arttet commented Nov 24, 2022

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
error[E0412]: cannot find type `GetWebsocketsTokenRequest` in module `crate::models`
   --> src\apis\user_data_api.rs:234:125
    |
234 | ...: crate::models::GetWebsocketsTokenRequest) -> Result<crate::models::Balance2, Error<GetAccountBalanceError>> {
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `GetWebsocketsToken200Response`
    |
   ::: src\models\get_websockets_token_200_response.rs:15:1
    |
15  | pub struct GetWebsocketsToken200Response {
    | ---------------------------------------- similarly named struct `GetWebsocketsToken200Response` defined here

error[E0412]: cannot find type `GetClosedOrdersRequestBody` in module `crate::models`
   --> src\apis\user_data_api.rs:279:125
    |
279 | ...ed_orders_request_body: crate::models::GetClosedOrdersRequestBody) -> Result<crate::models::Closed2, Error<GetClosedOrdersError>> {
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetLedgersInfoRequestBody` in module `crate::models`
   --> src\apis\user_data_api.rs:324:118
    |
324 | ...dgers_info_request_body: crate::models::GetLedgersInfoRequestBody) -> Result<crate::models::Info3, Error<GetLedgersError>> {
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetLedgerInfoRequestBody` in module `crate::models`
   --> src\apis\user_data_api.rs:369:122
    |
369 | ...edger_info_request_body: crate::models::GetLedgerInfoRequestBody) -> Result<crate::models::Query3, Error<GetLedgersInfoError>> {
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetOpenOrdersRequestBody` in module `crate::models`
   --> src\apis\user_data_api.rs:414:121
    |
414 | ...pen_orders_request_body: crate::models::GetOpenOrdersRequestBody) -> Result<crate::models::Open2, Error<GetOpenOrdersError>> {
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `UpdateAccountProfileRequest` in module `crate::models`
   --> src\apis\user_data_api.rs:569:125
    |
569 | ...ccount_profile_request: crate::models::UpdateAccountProfileRequest) -> Result<crate::models::Balance4, Error<GetTradeBalanceError>> {
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetTradesHistoryRequestBody` in module `crate::models`
   --> src\apis\user_data_api.rs:614:126
    |
614 | ...s_history_request_body: crate::models::GetTradesHistoryRequestBody) -> Result<crate::models::History2, Error<GetTradeHistoryError>> {
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetTradeVolume` in module `crate::models`
   --> src\apis\user_data_api.rs:659:122
    |
659 | ...t_trade_volume: crate::models::GetTradeVolume) -> Result<crate::models::Volume, Error<GetTradeVolumeError>> {
    |                                   ^^^^^^^^^^^^^^ help: a struct with a similar name exists: `TradeVolume`
    |
   ::: src\models\trade_volume.rs:16:1
    |
16  | pub struct TradeVolume {
    | ---------------------- similarly named struct `TradeVolume` defined here

error[E0412]: cannot find type `GetTradesInfoRequestBody` in module `crate::models`
   --> src\apis\user_data_api.rs:705:121
    |
705 | ...rades_info_request_body: crate::models::GetTradesInfoRequestBody) -> Result<crate::models::GetTradesInfo200Response, Error<GetTradesIn...
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `BatchaddOrdersInner` in module `crate::models`
   --> src\apis\user_trading_api.rs:168:115
    |
168 | ...on, nonce: i32, orders: Vec<crate::models::BatchaddOrdersInner>, pair: &str, deadline: Option<&str>, validate: Option<bool>) -> Result...
    |                                               ^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetWebsocketsTokenRequest` in module `crate::models`
   --> src\apis\user_trading_api.rs:223:123
    |
223 | ...: crate::models::GetWebsocketsTokenRequest) -> Result<crate::models::CancelAllOrders200Response, Error<CancelAllOrdersError>> {
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `GetWebsocketsToken200Response`
    |
   ::: src\models\get_websockets_token_200_response.rs:15:1
    |
15  | pub struct GetWebsocketsToken200Response {
    | ---------------------------------------- similarly named struct `GetWebsocketsToken200Response` defined here

error[E0412]: cannot find type `CancelTxid` in module `crate::models`
   --> src\apis\user_trading_api.rs:316:106
    |
316 | ...onfiguration, nonce: i32, txid: crate::models::CancelTxid) -> Result<crate::models::Cancel2, Error<CancelOrderError>> {
    |                                                   ^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `BatchcancelOrdersInner` in module `crate::models`
   --> src\apis\user_trading_api.rs:364:118
    |
364 | ..., nonce: i32, orders: Vec<crate::models::BatchcancelOrdersInner>) -> Result<crate::models::Batchcancel2, Error<CancelOrderBatchError>> {
    |                                             ^^^^^^^^^^^^^^^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `EditTxid` in module `crate::models`
   --> src\apis\user_trading_api.rs:412:104
    |
412 | ...Configuration, nonce: i32, txid: crate::models::EditTxid, pair: &str, userref: Option<i32>, volume: Option<&str>, displayvol: Option<&...
    |                                                    ^^^^^^^^ not found in `crate::models`

error[E0412]: cannot find type `GetWebsocketsTokenRequest` in module `crate::models`
  --> src\apis\websockets_authentication_api.rs:27:126
   |
27 | ...: crate::models::GetWebsocketsTokenRequest) -> Result<crate::models::GetWebsocketsToken200Response, Error<GetWebsocketsTokenError>> {
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `GetWebsocketsToken200Response`
   |
  ::: src\models\get_websockets_token_200_response.rs:15:1
   |
15 | pub struct GetWebsocketsToken200Response {
   | ---------------------------------------- similarly named struct `GetWebsocketsToken200Response` defined here

error[E0412]: cannot find type `Array` in module `crate::models`
  --> src\models\add_2.rs:19:42
   |
19 |     pub error: Option<Vec<crate::models::Array>>,
   |                                          ^^^^^ not found in `crate::models`
   |
help: there is an enum variant `serde_json::Value::Array`; try using the variant's enum
   |
19 |     pub error: Option<Vec<serde_json::Value>>,
   |                           ~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `Array` in module `crate::models`
  --> src\models\batchadd_2.rs:19:42
   |
19 |     pub error: Option<Vec<crate::models::Array>>,
   |                                          ^^^^^ not found in `crate::models`
   |
help: there is an enum variant `serde_json::Value::Array`; try using the variant's enum
   |
19 |     pub error: Option<Vec<serde_json::Value>>,
   |                           ~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `Array` in module `crate::models`
  --> src\models\batchcancel_2.rs:19:42
   |
19 |     pub error: Option<Vec<crate::models::Array>>,
   |                                          ^^^^^ not found in `crate::models`
   |
help: there is an enum variant `serde_json::Value::Array`; try using the variant's enum
   |
19 |     pub error: Option<Vec<serde_json::Value>>,
   |                           ~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `Array` in module `crate::models`
  --> src\models\cancel_2.rs:19:42
   |
19 |     pub error: Option<Vec<crate::models::Array>>,
   |                                          ^^^^^ not found in `crate::models`
   |
help: there is an enum variant `serde_json::Value::Array`; try using the variant's enum
   |
19 |     pub error: Option<Vec<serde_json::Value>>,
   |                           ~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `Array` in module `crate::models`
  --> src\models\edit_2.rs:19:42
   |
19 |     pub error: Option<Vec<crate::models::Array>>,
   |                                          ^^^^^ not found in `crate::models`
   |
help: there is an enum variant `serde_json::Value::Array`; try using the variant's enum
   |
19 |     pub error: Option<Vec<serde_json::Value>>,
   |                           ~~~~~~~~~~~~~~~~~

error[E0412]: cannot find type `Array` in module `crate::models`
  --> src\models\get_trades_info_200_response.rs:20:42
   |
20 |     pub error: Option<Vec<crate::models::Array>>,
   |                                          ^^^^^ not found in `crate::models`
   |
help: there is an enum variant `serde_json::Value::Array`; try using the variant's enum
   |
20 |     pub error: Option<Vec<serde_json::Value>>,
   |                           ~~~~~~~~~~~~~~~~~

error[E0283]: type annotations needed
  --> src\models\add_2.rs:19:5
   |
14 | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
   |                                   ------- in this derive macro expansion
...
19 |     pub error: Option<Vec<crate::models::Array>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Default`
   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
  --> src\models\add_2.rs:26:20
   |
26 |             error: None,
   |                    ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
   |
help: consider specifying the generic argument
   |
26 |             error: None::<T>,
   |                        +++++

error[E0283]: type annotations needed
  --> src\models\batchadd_2.rs:19:5
   |
14 | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
   |                                   ------- in this derive macro expansion
...
19 |     pub error: Option<Vec<crate::models::Array>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Default`
   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
  --> src\models\batchadd_2.rs:26:20
   |
26 |             error: None,
   |                    ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
   |
help: consider specifying the generic argument
   |
26 |             error: None::<T>,
   |                        +++++

error[E0283]: type annotations needed
  --> src\models\batchcancel_2.rs:19:5
   |
14 | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
   |                                   ------- in this derive macro expansion
...
19 |     pub error: Option<Vec<crate::models::Array>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Default`
   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
  --> src\models\batchcancel_2.rs:26:20
   |
26 |             error: None,
   |                    ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
   |
help: consider specifying the generic argument
   |
26 |             error: None::<T>,
   |                        +++++

error[E0283]: type annotations needed
  --> src\models\cancel_2.rs:19:5
   |
14 | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
   |                                   ------- in this derive macro expansion
...
19 |     pub error: Option<Vec<crate::models::Array>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Default`
   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
  --> src\models\cancel_2.rs:26:20
   |
26 |             error: None,
   |                    ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
   |
help: consider specifying the generic argument
   |
26 |             error: None::<T>,
   |                        +++++

error[E0283]: type annotations needed
  --> src\models\edit_2.rs:19:5
   |
14 | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
   |                                   ------- in this derive macro expansion
...
19 |     pub error: Option<Vec<crate::models::Array>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Default`
   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
  --> src\models\edit_2.rs:26:20
   |
26 |             error: None,
   |                    ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
   |
help: consider specifying the generic argument
   |
26 |             error: None::<T>,
   |                        +++++

error[E0283]: type annotations needed
  --> src\models\get_trades_info_200_response.rs:20:5
   |
14 | #[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
   |                                   ------- in this derive macro expansion
...
20 |     pub error: Option<Vec<crate::models::Array>>,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `_: Default`
   = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0282]: type annotations needed
  --> src\models\get_trades_info_200_response.rs:27:20
   |
27 |             error: None,
   |                    ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
   |
help: consider specifying the generic argument
   |
27 |             error: None::<T>,
   |                        +++++
openapi-generator version

openapitools/openapi-generator-cli:latest
openapitools/openapi-generator-cli:v6.2.1
openapitools/openapi-generator-cli:v5.4.0

OpenAPI declaration file content or url

https://docs.kraken.com/rest/

blob:https://docs.kraken.com/6e6b7eda-80e7-4190-9795-d3fe76784b87

Generation Details
Steps to reproduce
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate -i /local/openapi.json -g rust -o /local/out/rust
cd out/rust
cargo build
Related issues/PRs

#12464

Suggest a fix
@Snazzie
Copy link

Snazzie commented Apr 18, 2024

yeah my experience is that it misses imports and structs and enums dont have Eq, Hash which causes errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants