* [Rust][Server] Upgrade hyper from 0.13 to 0.14, swagger-rs from 5.0.2 to 6.1.0
* Also upgrade tokio from 0.2 to 1.14
* Re-add JavaClientCodegenTest.java
* Fix incorrect slashes due to wrong generation
* Spelling fix: failuare -> failure
* Upgrade more packages
* Commit generated code
* Fix typo
Co-authored-by: Foorack / Max Faxälv <max@foorack.com>
* [Rust Server] Fix server example on non-Linux
The server example is broken because it tries to import `use openssl::ssl::SslAcceptorBuilder;` unconditionally when it won't be present on MacOS, Windows or iOS and then conditionally provides `create` causing compile errors on the aforementioned platforms.
To fix, we simply move the condition from the function to the import and all is happy again :)
* Update Samples
Co-authored-by: William Cheng <wing328hk@gmail.com>
* [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 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] 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] 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.
- Restore XML namespace support
- Remove non snake case rust warning for xml wrap_in methods
- Add XML rust-server tests
- Fix wrapping XML arrays when a property of another object
- Run all tests, not just those for OpenAPI 2.0
- Force wrapping for rust-server
* Add test case that reproduce the issue #1782
* Fix missing RequestBody.required
* Update samples
./bin/utils/ensure-up-to-date
* Run ensure-up-to-date script
./bin/utils/ensure-up-to-date
* Ensure that generic JSON bodies are correctly autogenerated
Generates valid Rust for an arbitrary JSON response body of type `object` with no other schema.
I think these tests cover all the problems with rust-server and inline objects I know about. This should show us when we've fixed the problem.
Also fixes a CI failure.
Builds on #1180 by @colelawrence. This addition to the rust-server generator enables the use of text/html responses as plaintext.
I've added an html endpoint to the sample to demonstrate that this works (and fixed the problem that that uncovered).
Update to version 2 of the `swagger` crate, which contains changes intended to make it easier to debug errors involving middleware and contexts. Crates making use of the autogenerated libraries to also update their swagger dependency to version 2. See [here](https://github.com/Metaswitch/swagger-rs/blob/2.0.0/CHANGELOG.md) for details.
* Ignore additionalProperties
rust-server doen't yet support them, and they cause quite a bit of havoc at the moment (ending up as the `HashMap` type).
* Use .equals() rather than `==`