forked from loafle/openapi-generator-original
[rust-server] add license and description to Cargo.toml (#7080)
* Move errant file to 'rust-server' Rust2 was the old name * Add license and description to Cargo.toml For rust-server, getting them from the swagger * Valid Java doesn't have uninitialised variables... * Default license to "Unlicense" * Set license to "Unlicense" for generated crates
This commit is contained in:
parent
da942ab80c
commit
a57fb0c7db
@ -2,6 +2,10 @@
|
|||||||
name = "{{packageName}}"
|
name = "{{packageName}}"
|
||||||
version = "{{appVersion}}"
|
version = "{{appVersion}}"
|
||||||
authors = [{{#infoEmail}}"{{infoEmail}}"{{/infoEmail}}]
|
authors = [{{#infoEmail}}"{{infoEmail}}"{{/infoEmail}}]
|
||||||
|
{{#appDescription}}
|
||||||
|
description = "{{{appDescription}}}"
|
||||||
|
{{/appDescription}}
|
||||||
|
license = "Unlicense"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["client", "server"]
|
default = ["client", "server"]
|
||||||
|
@ -4,10 +4,10 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Rust2OptionsProvider implements OptionsProvider {
|
public class RustServerOptionsProvider implements OptionsProvider {
|
||||||
@Override
|
@Override
|
||||||
public String getLanguage() {
|
public String getLanguage() {
|
||||||
return "rust2";
|
return "rust-server";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -2,6 +2,8 @@
|
|||||||
name = "petstore_api"
|
name = "petstore_api"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
authors = ["apiteam@swagger.io"]
|
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]
|
[features]
|
||||||
default = ["client", "server"]
|
default = ["client", "server"]
|
||||||
|
@ -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)
|
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
|
||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Build date: 2017-10-30T02:13:46.477Z
|
- Build date: 2017-11-30T15:18:45.444Z
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
@ -139,11 +139,11 @@ paths:
|
|||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
default: "available"
|
||||||
enum:
|
enum:
|
||||||
- "available"
|
- "available"
|
||||||
- "pending"
|
- "pending"
|
||||||
- "sold"
|
- "sold"
|
||||||
default: "available"
|
|
||||||
collectionFormat: "csv"
|
collectionFormat: "csv"
|
||||||
formatString: "{:?}"
|
formatString: "{:?}"
|
||||||
example: "&Vec::new()"
|
example: "&Vec::new()"
|
||||||
@ -893,10 +893,10 @@ paths:
|
|||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
default: "$"
|
||||||
enum:
|
enum:
|
||||||
- ">"
|
- ">"
|
||||||
- "$"
|
- "$"
|
||||||
default: "$"
|
|
||||||
formatString: "{:?}"
|
formatString: "{:?}"
|
||||||
example: "Some(&Vec::new())"
|
example: "Some(&Vec::new())"
|
||||||
- name: "enum_form_string"
|
- name: "enum_form_string"
|
||||||
@ -918,10 +918,10 @@ paths:
|
|||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
default: "$"
|
||||||
enum:
|
enum:
|
||||||
- ">"
|
- ">"
|
||||||
- "$"
|
- "$"
|
||||||
default: "$"
|
|
||||||
formatString: "{:?}"
|
formatString: "{:?}"
|
||||||
example: "Some(&Vec::new())"
|
example: "Some(&Vec::new())"
|
||||||
- name: "enum_header_string"
|
- name: "enum_header_string"
|
||||||
@ -943,10 +943,10 @@ paths:
|
|||||||
type: "array"
|
type: "array"
|
||||||
items:
|
items:
|
||||||
type: "string"
|
type: "string"
|
||||||
|
default: "$"
|
||||||
enum:
|
enum:
|
||||||
- ">"
|
- ">"
|
||||||
- "$"
|
- "$"
|
||||||
default: "$"
|
|
||||||
formatString: "{:?}"
|
formatString: "{:?}"
|
||||||
example: "Some(&Vec::new())"
|
example: "Some(&Vec::new())"
|
||||||
- name: "enum_query_string"
|
- name: "enum_query_string"
|
||||||
@ -1047,7 +1047,7 @@ paths:
|
|||||||
maximum: 543.2
|
maximum: 543.2
|
||||||
minimum: 32.1
|
minimum: 32.1
|
||||||
formatString: "{}"
|
formatString: "{}"
|
||||||
example: "3.4"
|
example: "8.14"
|
||||||
- name: "float"
|
- name: "float"
|
||||||
in: "formData"
|
in: "formData"
|
||||||
description: "None"
|
description: "None"
|
||||||
@ -1089,8 +1089,8 @@ paths:
|
|||||||
required: true
|
required: true
|
||||||
type: "string"
|
type: "string"
|
||||||
format: "byte"
|
format: "byte"
|
||||||
formatString: "\\\"{:?}\\\""
|
formatString: "{:?}"
|
||||||
example: "swagger::ByteArray(\"byte_example\".to_string().into_bytes())"
|
example: "swagger::ByteArray(Vec::from(\"B\"))"
|
||||||
- name: "binary"
|
- name: "binary"
|
||||||
in: "formData"
|
in: "formData"
|
||||||
description: "None"
|
description: "None"
|
||||||
@ -1465,12 +1465,12 @@ definitions:
|
|||||||
type: "boolean"
|
type: "boolean"
|
||||||
default: false
|
default: false
|
||||||
example:
|
example:
|
||||||
petId: 6
|
|
||||||
quantity: 1
|
|
||||||
id: 0
|
id: 0
|
||||||
shipDate: "2000-01-23T04:56:07.000+00:00"
|
petId: 6
|
||||||
complete: false
|
complete: false
|
||||||
status: "placed"
|
status: "placed"
|
||||||
|
quantity: 1
|
||||||
|
shipDate: "2000-01-23T04:56:07.000+00:00"
|
||||||
xml:
|
xml:
|
||||||
name: "Order"
|
name: "Order"
|
||||||
upperCaseName: "ORDER"
|
upperCaseName: "ORDER"
|
||||||
@ -1483,8 +1483,8 @@ definitions:
|
|||||||
name:
|
name:
|
||||||
type: "string"
|
type: "string"
|
||||||
example:
|
example:
|
||||||
name: "name"
|
|
||||||
id: 6
|
id: 6
|
||||||
|
name: "name"
|
||||||
xml:
|
xml:
|
||||||
name: "Category"
|
name: "Category"
|
||||||
upperCaseName: "CATEGORY"
|
upperCaseName: "CATEGORY"
|
||||||
@ -1512,14 +1512,14 @@ definitions:
|
|||||||
format: "int32"
|
format: "int32"
|
||||||
description: "User Status"
|
description: "User Status"
|
||||||
example:
|
example:
|
||||||
firstName: "firstName"
|
|
||||||
lastName: "lastName"
|
|
||||||
password: "password"
|
|
||||||
userStatus: 6
|
|
||||||
phone: "phone"
|
|
||||||
id: 0
|
id: 0
|
||||||
email: "email"
|
lastName: "lastName"
|
||||||
|
phone: "phone"
|
||||||
username: "username"
|
username: "username"
|
||||||
|
email: "email"
|
||||||
|
userStatus: 6
|
||||||
|
firstName: "firstName"
|
||||||
|
password: "password"
|
||||||
xml:
|
xml:
|
||||||
name: "User"
|
name: "User"
|
||||||
upperCaseName: "USER"
|
upperCaseName: "USER"
|
||||||
@ -1532,8 +1532,8 @@ definitions:
|
|||||||
name:
|
name:
|
||||||
type: "string"
|
type: "string"
|
||||||
example:
|
example:
|
||||||
name: "name"
|
|
||||||
id: 1
|
id: 1
|
||||||
|
name: "name"
|
||||||
xml:
|
xml:
|
||||||
name: "Tag"
|
name: "Tag"
|
||||||
upperCaseName: "TAG"
|
upperCaseName: "TAG"
|
||||||
@ -1574,20 +1574,20 @@ definitions:
|
|||||||
- "pending"
|
- "pending"
|
||||||
- "sold"
|
- "sold"
|
||||||
example:
|
example:
|
||||||
|
tags:
|
||||||
|
- id: 1
|
||||||
|
name: "name"
|
||||||
|
- id: 1
|
||||||
|
name: "name"
|
||||||
|
id: 0
|
||||||
|
category:
|
||||||
|
id: 6
|
||||||
|
name: "name"
|
||||||
|
status: "available"
|
||||||
|
name: "doggie"
|
||||||
photoUrls:
|
photoUrls:
|
||||||
- "photoUrls"
|
- "photoUrls"
|
||||||
- "photoUrls"
|
- "photoUrls"
|
||||||
name: "doggie"
|
|
||||||
id: 0
|
|
||||||
category:
|
|
||||||
name: "name"
|
|
||||||
id: 6
|
|
||||||
tags:
|
|
||||||
- name: "name"
|
|
||||||
id: 1
|
|
||||||
- name: "name"
|
|
||||||
id: 1
|
|
||||||
status: "available"
|
|
||||||
xml:
|
xml:
|
||||||
name: "Pet"
|
name: "Pet"
|
||||||
upperCaseName: "PET"
|
upperCaseName: "PET"
|
||||||
@ -1602,9 +1602,9 @@ definitions:
|
|||||||
message:
|
message:
|
||||||
type: "string"
|
type: "string"
|
||||||
example:
|
example:
|
||||||
|
message: "message"
|
||||||
code: 0
|
code: 0
|
||||||
type: "type"
|
type: "type"
|
||||||
message: "message"
|
|
||||||
upperCaseName: "APIRESPONSE"
|
upperCaseName: "APIRESPONSE"
|
||||||
$special[model.name]:
|
$special[model.name]:
|
||||||
properties:
|
properties:
|
||||||
@ -1957,8 +1957,8 @@ definitions:
|
|||||||
my_boolean:
|
my_boolean:
|
||||||
$ref: "#/definitions/OuterBoolean"
|
$ref: "#/definitions/OuterBoolean"
|
||||||
example:
|
example:
|
||||||
my_string: {}
|
|
||||||
my_number: {}
|
my_number: {}
|
||||||
|
my_string: {}
|
||||||
my_boolean: {}
|
my_boolean: {}
|
||||||
upperCaseName: "OUTERCOMPOSITE"
|
upperCaseName: "OUTERCOMPOSITE"
|
||||||
OuterNumber:
|
OuterNumber:
|
||||||
|
@ -129,7 +129,7 @@ fn main() {
|
|||||||
// },
|
// },
|
||||||
|
|
||||||
Some("TestEndpointParameters") => {
|
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>")));
|
println!("{:?} (X-Span-ID: {:?})", result, client.context().x_span_id.clone().unwrap_or(String::from("<none>")));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ impl Api for Server {
|
|||||||
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
/// 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> {
|
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();
|
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()))
|
Box::new(futures::failed("Generic failure".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,10 +535,10 @@ fn add_routes<T>(router: &mut Router, api: T) where T: Api + Send + Sync + Clone
|
|||||||
|
|
||||||
|
|
||||||
// Form parameters
|
// Form parameters
|
||||||
let param_number = 3.4;
|
let param_number = 8.14;
|
||||||
let param_double = 1.2;
|
let param_double = 1.2;
|
||||||
let param_pattern_without_delimiter = "pattern_without_delimiter_example".to_string();
|
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_integer = Some(56);
|
||||||
let param_int32 = Some(56);
|
let param_int32 = Some(56);
|
||||||
let param_int64 = Some(789);
|
let param_int64 = Some(789);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user