Better Rust client imports (#3332)

* Better Rust client imports.

* No more "unused_imports" in models for serde_json::Value.
* No more compilation problem for apis requiring serde_json::Value.
* "crate::" prefix for models and apis imports, for compatibility with Rust 2018 edition.

* Rust samples regeneration using new code.
This commit is contained in:
Benoît Courtine
2019-07-18 11:08:48 +02:00
committed by Benjamin Gill
parent 0fec25e92e
commit 26b8d1f4c2
36 changed files with 126 additions and 165 deletions

View File

@@ -10,9 +10,6 @@
/// ApiResponse : Describes the result of uploading an image resource
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct ApiResponse {

View File

@@ -10,9 +10,6 @@
/// Category : A category for a pet
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct Category {

View File

@@ -10,9 +10,6 @@
/// Order : An order for a pets from the pet store
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct Order {

View File

@@ -10,22 +10,19 @@
/// Pet : A pet for sale in the pet store
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct Pet {
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
#[serde(rename = "category", skip_serializing_if = "Option::is_none")]
pub category: Option<::models::Category>,
pub category: Option<crate::models::Category>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "photoUrls")]
pub photo_urls: Vec<String>,
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<::models::Tag>>,
pub tags: Option<Vec<crate::models::Tag>>,
/// pet status in the store
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<String>,

View File

@@ -10,9 +10,6 @@
/// Tag : A tag for a pet
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct Tag {

View File

@@ -10,9 +10,6 @@
/// User : A User who is purchasing from the pet store
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct User {