mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-17 15:54:36 +00:00
[Rust] Implement 'object' type conversion (#6846)
* [Rust] Use serde Value for objects This hopefully fixes the previous TODO; it at least fixes compilation errors for the specific swagger model I'm working with. * [Rust] Update Cargo.toml to specify versions Letting the version float freely is scary, to say the least. This gives it a better chance at being future-proof. When the crate author had a recommended selector I picked that, otherwise I went semver compatible. * [Rust] Regenerate the example
This commit is contained in:
@@ -99,8 +99,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("file", "File");
|
||||
typeMapping.put("binary", "Vec<u8>");
|
||||
typeMapping.put("ByteArray", "String");
|
||||
// TODO what should 'object' mapped to
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("object", "Value");
|
||||
|
||||
// no need for rust
|
||||
//importMapping = new HashMap<String, String>();
|
||||
|
||||
@@ -4,14 +4,14 @@ version = "{{{packageVersion}}}"
|
||||
authors = ["Swagger Codegen team and contributors"]
|
||||
|
||||
[dependencies]
|
||||
serde = "*"
|
||||
serde_derive = "*"
|
||||
serde_yaml = "*"
|
||||
serde_json = "*"
|
||||
base64 = "*"
|
||||
futures = "*"
|
||||
hyper = "*"
|
||||
url = "*"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_yaml = "0.7"
|
||||
serde_json = "1.0"
|
||||
base64 = "~0.7.0"
|
||||
futures = "0.1.16"
|
||||
hyper = "0.11.6"
|
||||
url = "1.5"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-core = "*"
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
/// {{{classname}}} : {{{description}}}
|
||||
{{/description}}
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct {{classname}} {
|
||||
{{#vars}}
|
||||
|
||||
Reference in New Issue
Block a user