16 Commits

Author SHA1 Message Date
Benjamin Gill
eb793ae279
[rust] Make it easier to test rust client generator (#3543)
As we discovered in #3463, there are various bits of the rust client generator that are currently untested. This PR adds tests for various generator-specific types, and also files.

Follows the example of the rust-server generator for making it easy to add new test specs. This should make it easier for future contributors to make sure that their contributions are tested
2019-09-27 16:27:28 +01:00
Jim Schubert
ee7c8a82e8
[BUG][CLI][GENERATOR] NullPointer when not setting outputDir (updated) (#3752)
* Fixes NPE when no outputDir is set

* Fix behaviors of default values for values not provided by user

* Easier handling of default behavior in settings.

* Fixes for dynamic config deserialization (specifically, ruby client sample fix)

* Tests for WorkflowSettings (defaults, modified defaults, nulls)

* Test modification of WorkflowSettings defaults for both class constructor and builder
2019-08-25 19:19:52 -04:00
Benoît Courtine
28a16bea24 [Rust][Client] Correct the Rust client generated documentation (#3419)
Fixes #3418. Only generated API markdown files are impacted.
2019-07-24 17:33:11 +01:00
Benoît Courtine
26b8d1f4c2 Better Rust client imports (#3332)
* Better Rust client imports.

* No more "unused_imports" in models for serde_json::Value.
* No more compilation problem for apis requiring serde_json::Value.
* "crate::" prefix for models and apis imports, for compatibility with Rust 2018 edition.

* Rust samples regeneration using new code.
2019-07-18 10:08:48 +01:00
Michael Edwards
242d296082 Idiomatic Rust returns for Error conversions (#2812)
* Idiomatic Rust returns for Error conversions

* Regenerate Rust samples
2019-06-14 09:26:36 +01:00
Gabriel Féron
3df525ee33 Add enum support to rust and skip none option serialization in clients (#2244)
* Add support for enum schemas and properties to the rust generator

Also:
* Skip serializing a field with serde if it's optional and empty
* Fix borrow checker error when using &std::path::Path (should be std::path::PathBuf)
* Add script to generate sample with rust-reqwest
* Regenerate petstore sample for both rust targets
* Remove go code from README.md

* Fix formatting of serde skip_serializing_if attribute
2019-06-07 17:28:43 +01:00
William Cheng
8408e0235b Revert "update rust samples"
This reverts commit f83d09fc01b2f5a37beff34c18d02d3d43a48370.
2019-04-22 22:26:33 +08:00
William Cheng
f83d09fc01 update rust samples 2019-04-22 21:57:31 +08:00
tecywiz121
a0d907cf27 Support nullable fields in the Rust generator (#2353)
* Use Option for nullable fields in Rust (closes #2337)

* Update Rust's petstore
2019-03-12 09:20:54 +08:00
Benoît Courtine
888068d122 Rust reqwest improve (#1890)
* Resolves #525 for Rust client generator with reqwest library.

* Use Reqwest "query" method to generate query URL.

* urlencode URL string parameters.

* Generate rust-reqwest client, and verify it compiles and work as intended.

* Map file params (to "&std::path::Path") and support multipart operations (with file params) in Reqwest library.

* Cleanup: template compression to remove unecessary blank lines in generated code.
2019-02-01 15:02:16 +08:00
Benoît Courtine
f4eb96933a [Rust] Client library choice between hyper and reqwest (#1258)
* Port of PR https://github.com/swagger-api/swagger-codegen/pull/8804.

* Correction of conflict with PR #528 (missing template file).

* Add rust-reqwest samples to Circle CI tests.

* Add integration test pom.xml file with launcher to trigger cargo execution.

* Deduplicate Maven project name.

* Fix "api_key" header for Petstore.

* Better API key management.

* Fix query param for lists of objects other than strings (numbers, etc.).

* Update to reqwest 0.9, and refactor of header management (using reqwest transition feature).

* Merge scripts generating rust-hyper and rust-reqwest samples.

* Consistent full stops.

* Use raw variables in all Rust mustache templates.

* Replace production build in CI with a quick simple check.

* Update samples.

* Finish Reqwest 0.9 migration (removing "hyper 0.11" transition feature).

* Configuration implements Default trait.

* API template reorganized: HashMap is not required anymore.

* Revert "Merge scripts generating rust-hyper and rust-reqwest samples."

This reverts commit 970f996566a740045f2a986fd70fc70f11952925.

* Remove deprecated "-XX:MaxPermSize" java arg.
2018-10-26 10:24:14 +01:00
Jérémie Bresson
059a3efe46 Regenerate samples (#367) 2018-05-08 16:44:51 +08:00
William Cheng
18a40deb30
Update rust client with Petstore OAS2 (#148)
* update rust client with petstore oas2

* update rust with oas2 petstore, fix default value

* fix type mapping for file, update api_doc for rust client

* update rust client with oas3
2018-05-04 01:38:40 +08:00
Jeremie Bresson
53597764c3 Add OpenAPI spec 3.0 support (beta)
Co-authored-by: Akihito Nakano <sora.akatsuki@gmail.com>
Co-authored-by: Jeremie Bresson <dev@jmini.fr>
Co-authored-by: Jim Schubert <james.schubert@gmail.com>
Co-authored-by: Martin Delille <martin@phonations.com>
Co-authored-by: Tomasz Prus <tomasz.prus@gmail.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2018-04-17 09:19:10 +02:00
Ahmed Charles
60766c6210 Make the Rust codegen compile. (#6411)
* Use the right package name for the Rust crate.

* Change getters on models to return Option for non-required fields.

* Cleanup Rust generation and get example compiling again.

* Use underscore names for functions.
2017-09-02 00:06:55 +08:00
wing328
4cb7f1d613 [Rust] add new Rust client generator (#6105)
* add rust generator (1st release)

* update based on feedback

* fix reserved keyword

* fix string parameter

* Convert String to &str in trait definition

* Only pass pathParams to uri builder

* Fixed the html escaping in return type

* Fixed the hashmap constructor

* Added models into API scope

* removed models subimport, reference from super

* update returntype in method signature

* Fixed the remaining templates inconsistencies

* Fixed issues that floated up in kubernetes swagger file

* add hash support, fix docstring

* fix map parameter, update api.mustache

* use baseName for parameter

* use fully-qualfiied model name

* add rust tests

* fix test cases

* Rust gen slightly more idiomatic (#6247)

* Go -> Rust in README

* Remove leftover go file in rust sample

* rust: Regenerate sample

* rust: Rename *Impl -> *Client

* rust: one-line use line

More in line with common style

* rust: Replace tabs (in java) with 4 spaces

* Added trivial getter implementation (#6249)

* update rust petstore samples
2017-08-06 16:59:08 +08:00