Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
name = "{{packageName}}"
version = "{{appVersion}}"
authors = [{{#infoEmail}}"{{infoEmail}}"{{/infoEmail}}]
{{#appDescription}}
description = "{{{appDescription}}}"
{{/appDescription}}
license = "Unlicense"

[features]
default = ["client", "server"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import java.util.Map;

public class Rust2OptionsProvider implements OptionsProvider {
public class RustServerOptionsProvider implements OptionsProvider {
@Override
public String getLanguage() {
return "rust2";
return "rust-server";
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions samples/server/petstore/rust-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name = "petstore_api"
version = "1.0.0"
authors = ["apiteam@swagger.io"]
description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\"
license = "Unlicense"

[features]
default = ["client", "server"]
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/rust-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 1.0.0
- Build date: 2017-10-30T02:13:46.477Z
- Build date: 2017-11-30T15:18:45.444Z

## Examples

Expand Down
58 changes: 29 additions & 29 deletions samples/server/petstore/rust-server/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ paths:
type: "array"
items:
type: "string"
default: "available"
enum:
- "available"
- "pending"
- "sold"
default: "available"
collectionFormat: "csv"
formatString: "{:?}"
example: "&Vec::new()"
Expand Down Expand Up @@ -893,10 +893,10 @@ paths:
type: "array"
items:
type: "string"
default: "$"
enum:
- ">"
- "$"
default: "$"
formatString: "{:?}"
example: "Some(&Vec::new())"
- name: "enum_form_string"
Expand All @@ -918,10 +918,10 @@ paths:
type: "array"
items:
type: "string"
default: "$"
enum:
- ">"
- "$"
default: "$"
formatString: "{:?}"
example: "Some(&Vec::new())"
- name: "enum_header_string"
Expand All @@ -943,10 +943,10 @@ paths:
type: "array"
items:
type: "string"
default: "$"
enum:
- ">"
- "$"
default: "$"
formatString: "{:?}"
example: "Some(&Vec::new())"
- name: "enum_query_string"
Expand Down Expand Up @@ -1047,7 +1047,7 @@ paths:
maximum: 543.2
minimum: 32.1
formatString: "{}"
example: "3.4"
example: "8.14"
- name: "float"
in: "formData"
description: "None"
Expand Down Expand Up @@ -1089,8 +1089,8 @@ paths:
required: true
type: "string"
format: "byte"
formatString: "\\\"{:?}\\\""
example: "swagger::ByteArray(\"byte_example\".to_string().into_bytes())"
formatString: "{:?}"
example: "swagger::ByteArray(Vec::from(\"B\"))"
- name: "binary"
in: "formData"
description: "None"
Expand Down Expand Up @@ -1465,12 +1465,12 @@ definitions:
type: "boolean"
default: false
example:
petId: 6
quantity: 1
id: 0
shipDate: "2000-01-23T04:56:07.000+00:00"
petId: 6
complete: false
status: "placed"
quantity: 1
shipDate: "2000-01-23T04:56:07.000+00:00"
xml:
name: "Order"
upperCaseName: "ORDER"
Expand All @@ -1483,8 +1483,8 @@ definitions:
name:
type: "string"
example:
name: "name"
id: 6
name: "name"
xml:
name: "Category"
upperCaseName: "CATEGORY"
Expand Down Expand Up @@ -1512,14 +1512,14 @@ definitions:
format: "int32"
description: "User Status"
example:
firstName: "firstName"
id: 0
lastName: "lastName"
password: "password"
userStatus: 6
phone: "phone"
id: 0
email: "email"
username: "username"
email: "email"
userStatus: 6
firstName: "firstName"
password: "password"
xml:
name: "User"
upperCaseName: "USER"
Expand All @@ -1532,8 +1532,8 @@ definitions:
name:
type: "string"
example:
name: "name"
id: 1
name: "name"
xml:
name: "Tag"
upperCaseName: "TAG"
Expand Down Expand Up @@ -1574,20 +1574,20 @@ definitions:
- "pending"
- "sold"
example:
photoUrls:
- "photoUrls"
- "photoUrls"
name: "doggie"
tags:
- id: 1
name: "name"
- id: 1
name: "name"
id: 0
category:
name: "name"
id: 6
tags:
- name: "name"
id: 1
- name: "name"
id: 1
name: "name"
status: "available"
name: "doggie"
photoUrls:
- "photoUrls"
- "photoUrls"
xml:
name: "Pet"
upperCaseName: "PET"
Expand All @@ -1602,9 +1602,9 @@ definitions:
message:
type: "string"
example:
message: "message"
code: 0
type: "type"
message: "message"
upperCaseName: "APIRESPONSE"
$special[model.name]:
properties:
Expand Down Expand Up @@ -1957,8 +1957,8 @@ definitions:
my_boolean:
$ref: "#/definitions/OuterBoolean"
example:
my_string: {}
my_number: {}
my_string: {}
my_boolean: {}
upperCaseName: "OUTERCOMPOSITE"
OuterNumber:
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/rust-server/examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn main() {
// },

Some("TestEndpointParameters") => {
let result = client.test_endpoint_parameters(3.4, 1.2, "pattern_without_delimiter_example".to_string(), swagger::ByteArray("byte_example".to_string().into_bytes()), Some(56), Some(56), Some(789), Some(3.4), Some("string_example".to_string()), Some(swagger::ByteArray(Vec::from("B"))), None, None, Some("password_example".to_string()), Some("callback_example".to_string())).wait();
let result = client.test_endpoint_parameters(8.14, 1.2, "pattern_without_delimiter_example".to_string(), swagger::ByteArray(Vec::from("B")), Some(56), Some(56), Some(789), Some(3.4), Some("string_example".to_string()), Some(swagger::ByteArray(Vec::from("B"))), None, None, Some("password_example".to_string()), Some("callback_example".to_string())).wait();
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl Api for Server {
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option<i32>, int32: Option<i32>, int64: Option<i64>, float: Option<f32>, string: Option<String>, binary: Option<swagger::ByteArray>, date: Option<chrono::DateTime<chrono::Utc>>, date_time: Option<chrono::DateTime<chrono::Utc>>, password: Option<String>, callback: Option<String>, context: &Context) -> Box<Future<Item=TestEndpointParametersResponse, Error=ApiError> + Send> {
let context = context.clone();
println!("test_endpoint_parameters({}, {}, \"{}\", \"{:?}\", {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, date, date_time, password, callback, context.x_span_id.unwrap_or(String::from("<none>")).clone());
println!("test_endpoint_parameters({}, {}, \"{}\", {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, date, date_time, password, callback, context.x_span_id.unwrap_or(String::from("<none>")).clone());
Box::new(futures::failed("Generic failure".into()))
}

Expand Down
4 changes: 2 additions & 2 deletions samples/server/petstore/rust-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,10 @@ fn add_routes<T>(router: &mut Router, api: T) where T: Api + Send + Sync + Clone


// Form parameters
let param_number = 3.4;
let param_number = 8.14;
let param_double = 1.2;
let param_pattern_without_delimiter = "pattern_without_delimiter_example".to_string();
let param_byte = swagger::ByteArray("byte_example".to_string().into_bytes());
let param_byte = swagger::ByteArray(Vec::from("B"));
let param_integer = Some(56);
let param_int32 = Some(56);
let param_int64 = Some(789);
Expand Down