30 Commits

Author SHA1 Message Date
Naoki Ikeguchi
fa51d8b6b3
[rust-server] Resolve clippy warnings (#13473)
* fix(rust-server): Use ok_or_else instead of ok_or

* fix(rust-server): Remove empty format string

* fix(rust-server): Remove redundant field names in struct initialisation

* fix(rust-server): Remove redundant clones

* fix(rust-server): Derive Eq with PartialEq always

* fix(rust-server): Remove immediately pushes replaced by vec macro

* fix(rust-server): Remove useless conversions

* fix(rust-server): Dismiss clippy::new_without_default

* fix(rust-server): Fix compilation failures

* fix(rust-server): Resolve remaining warnings

* build(rust-server): Add newly generated samples of petstore

* fix(rust-server): Allow clippy::derive_partial_eq_without_eq to avoid float types try to derive Eq

* fix(rust-server): Fix parts to compile samples successfully

* fix(rust-server): Allow clippy::redundant_clone instead of removing redundant map_err

* fix(rust-server): Resolve and dismiss lots of warnings to satisfy clippy on samples

* build(rust-server): Add clippy execution to sample integration test

* build(rust-server): Add .cargo/config to the test root to use -Dwarnings flag in tests

* fix(rust-server): Allow unused_mut to avoid compilation fails in some environments
2022-09-21 22:45:08 +08:00
William Cheng
ad3b5f7045
[Inline model resolver] various improvements (#12293)
* better handling of requestbody in the inline resolver

* remove commented code

* better request body naming

* fix unique naming

* minor code format change

* removed additional underscore from names, fix test

* more fixes, update tests

* fix all tests

* undo changes to default codegen

* update samples

* update python tests

* add new files

* update samples
2022-05-10 17:13:57 +08:00
Samodya Abey
4e602b66b9
[Rust][Server] Upgrade to tokio v1 (#11873)
* [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>
2022-03-16 15:29:36 +08:00
Nathan Baulch
5d68bd6a03
Fix thousands of spelling typos (#10272) 2021-08-28 22:58:24 +08:00
Matthew Dowdell
8c11c8f582
[Rust Server] Fix server example on non-Linux (#7399)
* [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>
2020-10-05 21:54:50 +01:00
Richard Whitehouse
82410ae90b
[Rust Server] Hyper 0.13 + Async/Await support (#6244)
* [Rust Server] Hyper 0.13 + Async/Await support

Upgrade dependencies to Hyper 0.13 and use async/await.

* [Rust Server] Add missing hyper-tls dependency

* [Rust Server] Add missing models import

* Update samples
2020-05-29 15:18:30 +01:00
Richard Whitehouse
f36a319316
[Rust Server] Rust 2018 Edition (#5942)
* [Rust Server] Rust 2018 Edition
* [Rust Server] Fix unused warning
* Update samples
2020-04-26 12:00:46 +01:00
Andy.Yang.cn
d911fd73bd
[Rust Server] Bugfix #5948 (Generated client code "Disabled because there's no example") (#5949)
* [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.
2020-04-24 11:04:36 +08:00
Andy.Yang.cn
c3837ca331
[Rust Server] Fix #5906 (yaml with path parameter error) (#5871)
* [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.
2020-04-15 17:19:00 +01:00
Richard Whitehouse
d0d0252fff
[Rust Server] Don't use structs in models (#5557)
* [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
2020-03-29 20:04:56 +01:00
Richard Whitehouse
be983b5212
[Rust Server] Build APIs which have no available examples (#5561)
* [Rust Server] Build APIs which have no examples

* [Rust Server] Add test for APIs with no examples

* Update samples
2020-03-22 19:54:48 +00:00
Richard Whitehouse
4aefc9ba33
[Rust Sever] Upgrade to openssl 0.10 (#5564)
* [Rust Server] Upgrade to openssl 0.10

Use hyper-openssl/openssl instead of hyper-tls/native-tls/openssl on Linux

* Update samples
2020-03-19 21:05:16 +00:00
Richard Whitehouse
e4be8a107f
[Rust Server] Test allOf objects including base properties (#5457)
* [Rust Server] Add operationIds for rust-server-test

* [Rust Server] Add test for allOf

* Update samples
2020-03-07 20:53:13 +00:00
Richard Whitehouse
b60fc900b2
[Rust Server] Support OpenAPI v3 callbacks (#5405)
* [Rust Server] Support Callbacks

* [Rust Server] Support callbacks in the examples

* [Rust Server] Update features documentation

* [Rust Server] Mark as supporting callbacks

* Update samples

* [Rust Server] Add tests for callbacks

* [Rust Server] Fix README

Don't suggest examples which don't exist
2020-03-07 19:24:42 +00:00
Richard Whitehouse
1b3094be87
[Rust Server] Add support for untyped properties and models (#5339)
* [Rust Server] Add support for untyped properties
* [Rust Server] Improve support for untyped data
* Update samples
2020-02-22 20:29:51 +00:00
Richard Whitehouse
71aef72bbd
[Rust Server] Support objects as query parameters (#5338)
- Support objects as query parameters
- Update samples
2020-02-22 18:25:57 +00:00
Richard Whitehouse
e9459125bb
[Rust Server] Hyper 0.12 Support (#4519)
[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.
2020-01-05 14:48:12 +00:00
Richard Whitehouse
57d248dd3d
[Rust Server] Rust 1.39 compatibility (#4864)
- Fix warnings present in Rust 1.39 resolving missing dyn markers
- Upgrade to lazy_static - fixes #4271
- Update samples
2019-12-27 23:32:21 +00:00
Richard Whitehouse
44fda895d2
[Rust Server] Frunk - LabelledGeneric - support (#3552)
Derive the LabelledGeneric trait on Swagger models.  This allows
conversion between structurally similar types by using
https://docs.rs/frunk/0.2.2/frunk/#transmogrifying.

Exit if example fails to run
2019-08-17 11:03:38 +01:00
Richard Whitehouse
f14bac8d7d [Rust Server] Improve XML support (#2504)
- 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
2019-04-22 12:05:40 +08:00
Akihito Nakano
7674d11d75 Fix missing RequestBody.required of inline request body (#1847)
* 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
2019-01-14 12:28:21 +08:00
Jérémie Bresson
a7dfc650b6 Swagger parser update: 2.0.8-OpenAPITools.org-1 (#1721)
* Update Swagger-Parser Version

* Update samples

* surpress javadoc warning

* fix TS tests

* Set version to 2.0.8-OpenAPITools.org-1
2018-12-22 18:12:08 +08:00
Mark Thebridge
4930f75dc7 Generic JSON body support in rust-server (#1523)
* Ensure that generic JSON bodies are correctly autogenerated

Generates valid Rust for an arbitrary JSON response body of type `object` with no other schema.
2018-12-04 16:51:59 +00:00
William Cheng
65a86eee3b Merge remote-tracking branch 'origin/master' into 4.0.x 2018-11-18 18:54:29 +08:00
Benjamin Gill
32b8d7fee7
[rust-server] Always derive Debug (#1404)
* Add test for file response

* Always derive Debug

Now that we're using a byte array, we can guarantee that deriving Debug will always work
2018-11-16 12:28:05 +00:00
William Cheng
e6c97a1bc1 Merge remote-tracking branch 'origin/3.4.x' into 4.0.x 2018-11-08 18:18:12 +08:00
Benjamin Gill
5849dbaaca
Add tests for inline objects (#1331)
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.
2018-11-07 11:07:53 +00:00
Benjamin Gill
30bfebfa16
Rust server html (#1329)
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).
2018-11-05 16:14:23 +00:00
tca-ms
eccab2c025 Better context errors (#1198)
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.
2018-10-17 17:14:43 +01:00
Benjamin Gill
a3e5185e39 Ignore additional properties (#671)
* 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 `==`
2018-07-30 23:06:05 +08:00