[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:
Euan Kemp
2017-11-01 07:00:56 -07:00
committed by wing328
parent 7755c7de38
commit c97b63d2bb
18 changed files with 45 additions and 368 deletions

View File

@@ -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>();

View File

@@ -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 = "*"

View File

@@ -5,6 +5,9 @@
/// {{{classname}}} : {{{description}}}
{{/description}}
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct {{classname}} {
{{#vars}}