openapi-generatorで生成されたrustのコードでエラーがでる。
openapi-generatorで以下のコードが生成されたのですが、エラーが出てしまいます。
/*
* EPGStation
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.5.4
*
* Generated by: https://openapi-generator.tech
*/
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct RecordedDeletes {
#[serde(rename = "recordedIds")]
pub recorded_ids: Vec<i32>,
/// onlyTs: TS だけ削除, onlyEncoded: エンコード済みファイル削除のみ削除
#[serde(rename = "option", skip_serializing_if = "Option::is_none")]
pub option: Option<String>,
}
impl RecordedDeletes {
pub fn new(recorded_ids: Vec<i32>) -> RecordedDeletes {
RecordedDeletes {
recorded_ids: recorded_ids,
option: None,
}
}
}
/// onlyTs: TS だけ削除, onlyEncoded: エンコード済みファイル削除のみ削除
#[derive(Debug, Serialize, Deserialize)]
pub enum Option {
#[serde(rename = "onlyTs")]
OnlyTs,
#[serde(rename = "onlyEncoded")]
OnlyEncoded,
}
エラー1
warning: unused import: `super::models::*`
--> generated/src/apis/mod.rs:52:5
|
52 | use super::models::*;
| ^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
warning: unused import: `std::collections::HashMap`
--> generated/src/apis/configuration.rs:12:5
|
12 | use std::collections::HashMap;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0107]: wrong number of type arguments: expected 0, found 1
--> generated/src/models/recorded_deletes.rs:22:24
|
22 | pub option: Option<String>,
| ^^^^^^ unexpected type argument
error: aborting due to previous error
For more information about this error, try `rustc --explain E0107`.
error: Could not compile `openapi`.
To learn more, run the command again with --verbose.
<String>
を消してみましたが次に以下のエラーが出るようになってしまいました。
エラー2
warning: unused import: `super::models::*`
--> generated/src/apis/mod.rs:52:5
|
52 | use super::models::*;
| ^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
warning: unused import: `std::collections::HashMap`
--> generated/src/apis/configuration.rs:12:5
|
12 | use std::collections::HashMap;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: unreachable expression
--> generated/src/apis/recorded_api.rs:172:9
|
172 | / __internal_request::Request::new(hyper::Method::Post, "/recorded/{id}/upload".to_string())
173 | | .with_path_param("id".to_string(), id.to_string())
174 | | .with_form_param("directory".to_string(), directory.to_string())
175 | | .with_form_param("encoded".to_string(), encoded.to_string())
176 | | .with_form_param("name".to_string(), name.to_string())
177 | | .with_form_param("file".to_string(), unimplemented!())
| |__________________________________________________________________^
|
= note: #[warn(unreachable_code)] on by default
error[E0599]: no variant or associated item named `is_none` found for type `models::recorded_deletes::Option` in the current scope
--> generated/src/models/recorded_deletes.rs:21:54
|
21 | #[serde(rename = "option", skip_serializing_if = "Option::is_none")]
| ^^^^^^^^^^^^^^^^^ variant or associated item not found in `models::recorded_deletes::Option`
...
36 | pub enum Option {
| --------------- variant or associated item `is_none` not found here
error[E0308]: mismatched types
--> generated/src/models/recorded_deletes.rs:29:21
|
29 | option: None,
| ^^^^ expected enum `models::recorded_deletes::Option`, found enum `std::option::Option`
|
= note: expected type `models::recorded_deletes::Option`
found type `std::option::Option<_>`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0308, E0599.
For more information about an error, try `rustc --explain E0308`.
error: Could not compile `openapi`.
To learn more, run the command again with --verbose.
解決法はありますでしょうか。