* [Rust Server] Fix RustServerCodegen type: object example "Disabled because there's no example" issue.
* [Rust Server] Add test case yaml with "Disabled because there's no example" issue.
* [Rust Server] Fix example-client-main param.example character escaping issue with raw string.
* [Rust Server] Add test case yaml new generated code after fix.
* [Rust Server] Fix issue with multiple tags on an operation generating duplicate methods.
* [Rust Server] Add test case yaml with multiple tags on a single operation.
* [Rust Server] Fix Rust 1.39+ "Box<Future" and "as &Has" compile issue
* [Rust Server] Fix Rust server side pathRegEx and baseName not match issue
* [Rust Server] Add test case yaml with path parameter.
* [Rust Server] Support complex query parameters
* [Rust Server] Remove unused extern crate
* [Rust Server] tokio should be a dev-dependency
* [Rust Server] Add test for complex query params
* Update samples
Co-authored-by: Matt Williams
* Remove test file erroneously checked in
* [Rust Server] Fix no features build
- Need serde_json for no-features build for undefined value structures
- Don't include `IntoHeader` type and implementations if we aren't including the client/server features
- Don't export the `IntoHeader` type at all - it's internal
* Update samples
* [Rust Server] Don't use structs in models
This avoids namespace clashes between model names and types used.
* [Rust Server] Handle models named after results
* [Rust Server] Add test for result models
* Update samples
* [Rust Server] Handle text/xml correctly
Treat application/xml the same as text/xml as per RFC 7303
* [Rust Server] Add test for text/xml
* Update samples
* Run rustfmt over rust-server output
Automatically run rustfmt over rust-server output if --enable-post-process-file is set
* Update samples
* Add note about configuring post processing
* [Rust Server] Make parse error displayable
Change error type to be displayable to prevent compile errors
* [Rust Server] Add test for enum in path
* Update samples
* [Rust Server] Suffix reserved words with _
Suffix reserved words with an underscore instead of prefixing them.
This follows convention in the Rust community, as prefixing with an underscore
indicates an unused variable in Rust.
* Update samples
* [Rust Server] Support RFC 7386
Support application/merge-patch+json as defined by RFC 7386 -
https://tools.ietf.org/html/rfc7386
Handle exactly the same as application/json.
* [Rust Server] Add test for RFC 7386
* Update samples
[Rust Server] Hyper 0.12 Support
- Hyper upgraded to Hyper 0.12.
- NewService becomes MakeService
- Request on MakeContext is not parameterised - instead, ReqBody, and ResBody are parameterized, and must implement hyper::body::Payload.
- This means that our existing tuples (i.e. (Body, Context)) don't work - instead we have a type ContextualPayload, which implements Payload, and derefs to an inner payload (the body), and contains a context.
- This is handled by the work done in Metaswitch/swagger-rs#63 but has some fall out here as well.
- tokio-proto/tokio-core is no longer supported, and hyper instead depends on tokio.
- Hyper depends on mime 0.3, but multipart depends on mime 0.2, so we now import both
- Hyper TLS 0.2 and native-tls 0.1
- Use Swagger Support library 3.x
- Futures are now Send. This forces ApiImpl to be need to Send as a result, and all forces Clients to be Send + Sync.
[Rust Server] Fix panic handling headers
If we have an API which has multiple auth types, we may panic. This is because
in Hyper 0.11, the following code will panic:
```
use hyper::header::{Authorization, Basic, Bearer, Headers};
fn main() {
let mut headers = Headers::default();
let basic = Basic { username: "richard".to_string(), password: None };
headers.set::<Authorization<Basic>>(Authorization(basic));
println!("Auth: {:?}", headers.get::<Authorization<Bearer>>());
}
```
as it mixes up an `Authorization<Basic>` and `Authorization<Bearer>` as both
have `Authorization:` as the header name.
This is fixed by using `swagger::SafeHeaders` added in
https://github.com/Metaswitch/swagger-rs/pull/90