OpenAPITools / OpenAPITools/openapi-generator
[BUG][Rust] Invalid Rust generated code
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
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
https://github.com/OpenAPITools/openapi-generator/issues/12464
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated references in src/apis/user_data_api.rs, src/apis/user_trading_api.rs, and src/apis/websockets_authentication_api.rs, then compare them with the models listed under src/models/. Trace why the referenced request and Array types are absent, and verify that the generated Rust crate compiles without the reported missing-type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100