mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
[rust-server] API version constant and composite version support (#7969)
* Add constant with API version * Use semver::Version for ApiVersion * Go back to API version as a string * Rust composite services * Actually use the version from the swagger file
This commit is contained in:
parent
386b9f432a
commit
37faaf9266
@ -19,7 +19,7 @@ chrono = { version = "0.4", features = ["serde"] }
|
||||
futures = "0.1"
|
||||
hyper = {version = "0.11", optional = true}
|
||||
hyper-tls = {version = "0.1.2", optional = true}
|
||||
swagger = "0.9"
|
||||
swagger = "0.10.0"
|
||||
|
||||
# Not required by example server.
|
||||
#
|
||||
|
@ -33,6 +33,7 @@ mod mimetypes;
|
||||
pub use swagger::{ApiError, Context, ContextWrapper};
|
||||
|
||||
pub const BASE_PATH: &'static str = "{{basePathWithoutHost}}";
|
||||
pub const API_VERSION: &'static str = "{{appVersion}}";
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
|
||||
{{^isResponseFile}}
|
||||
|
@ -17,7 +17,7 @@ chrono = { version = "0.4", features = ["serde"] }
|
||||
futures = "0.1"
|
||||
hyper = {version = "0.11", optional = true}
|
||||
hyper-tls = {version = "0.1.2", optional = true}
|
||||
swagger = "0.9"
|
||||
swagger = "0.10.0"
|
||||
|
||||
# Not required by example 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)
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build date: 2018-02-06T14:00:33.084Z
|
||||
- Build date: 2018-04-03T12:24:00.479+01:00
|
||||
|
||||
This autogenerated project defines an API crate `petstore_api` which contains:
|
||||
* An `Api` trait defining the API in Rust.
|
||||
@ -57,6 +57,7 @@ To run a client, follow one of the following simple steps:
|
||||
|
||||
```
|
||||
cargo run --example client TestSpecialTags
|
||||
cargo run --example client TestBodyWithQueryParams
|
||||
cargo run --example client FakeOuterBooleanSerialize
|
||||
cargo run --example client FakeOuterCompositeSerialize
|
||||
cargo run --example client FakeOuterNumberSerialize
|
||||
|
@ -784,7 +784,7 @@ paths:
|
||||
parameters:
|
||||
- name: "username"
|
||||
in: "path"
|
||||
description: "The name that needs to be fetched. Use user1 for testing. "
|
||||
description: "The name that needs to be fetched. Use user1 for testing."
|
||||
required: true
|
||||
type: "string"
|
||||
formatString: "\\\"{}\\\""
|
||||
@ -902,6 +902,7 @@ paths:
|
||||
tags:
|
||||
- "fake_classname_tags 123#$%^"
|
||||
summary: "To test class name in snake case"
|
||||
description: "To test class name in snake case"
|
||||
operationId: "testClassname"
|
||||
consumes:
|
||||
- "application/json"
|
||||
@ -1900,6 +1901,8 @@ definitions:
|
||||
upperCaseName: "ENUMCLASS"
|
||||
Enum_Test:
|
||||
type: "object"
|
||||
required:
|
||||
- "enum_string_required"
|
||||
properties:
|
||||
enum_string:
|
||||
type: "string"
|
||||
@ -1907,6 +1910,12 @@ definitions:
|
||||
- "UPPER"
|
||||
- "lower"
|
||||
- ""
|
||||
enum_string_required:
|
||||
type: "string"
|
||||
enum:
|
||||
- "UPPER"
|
||||
- "lower"
|
||||
- ""
|
||||
enum_integer:
|
||||
type: "integer"
|
||||
format: "int32"
|
||||
|
@ -33,6 +33,7 @@ mod mimetypes;
|
||||
pub use swagger::{ApiError, Context, ContextWrapper};
|
||||
|
||||
pub const BASE_PATH: &'static str = "/v2";
|
||||
pub const API_VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -361,6 +361,10 @@ pub struct EnumTest {
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
pub enum_string: Option<String>,
|
||||
|
||||
// Note: inline enums are not fully supported by swagger-codegen
|
||||
#[serde(rename = "enum_string_required")]
|
||||
pub enum_string_required: String,
|
||||
|
||||
// Note: inline enums are not fully supported by swagger-codegen
|
||||
#[serde(rename = "enum_integer")]
|
||||
#[serde(skip_serializing_if="Option::is_none")]
|
||||
@ -378,9 +382,10 @@ pub struct EnumTest {
|
||||
}
|
||||
|
||||
impl EnumTest {
|
||||
pub fn new() -> EnumTest {
|
||||
pub fn new(enum_string_required: String, ) -> EnumTest {
|
||||
EnumTest {
|
||||
enum_string: None,
|
||||
enum_string_required: enum_string_required,
|
||||
enum_integer: None,
|
||||
enum_number: None,
|
||||
outer_enum: None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user