12694 Commits

Author SHA1 Message Date
Yuriy Belenko
6dcdf5c311 [Slim4] Add ref support to Data Mocker (#4932)
* [Slim4] Add new method to Mocker interface

* [Slim4] Add implementation and tests for new method

* [Slim4] Add test fixture to encrease code coverage

* [Slim4] Add ref support to mockArray method

* [Slim4] Add mockFromRef method

* [Slim4] Add ref support to mockObject method

* [Slim4] Add ModelInterface

* [Slim4] Refresh samples

* [Slim4] Add ref support to mockFromSchema method

* [Slim4] Run all test suites by default test command

As it turnes out to generate coverage report for a whole project I need
to run all test suites at once.

* [Slim4] Fix enum option of string mocking
2020-01-10 16:27:43 +08:00
Jérémie Bresson
c27a6ed2bf [jaxrs-spec][quarkus] update to version 1.1.1.Final (#4935)
* [java][quarkus] update to version 1.1.0.Final

* [java][quarkus] update to version 1.1.1.Final
2020-01-08 21:30:36 +08:00
Jim Schubert
e23f2aa6aa
[cli] Full config help details (#4928)
* [cli] Dump additional generator info via config-help (plain text)
* [cli] Dump additional generator info via config-help (markdown)
2020-01-07 13:33:58 -05:00
Ryan N Johnson
d51354783f Add RequestFile to typescript-node model template (#4903)
RequestFile is defined in the [api-all.mustache
template](ac4ead9e78/modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache (L29)),
and it gets used [as a special
case](ac4ead9e78/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java (L92))
[in the model.mustache
template](ac4ead9e78/modules/openapi-generator/src/main/resources/typescript-node/model.mustache (L21)).

When this special case is triggered and `RequestFile` is used in a model
file, Typescript complains that the type is not found.

```
TSError: Unable to compile TypeScript:
path/to/model.ts:15:16 - error TS2304: Cannot find name 'RequestFile'.

15      'myFile'?: RequestFile;
                   ~~~~~~~~~~~
```

This solution is to import `RequestFile` by adding it to the model
template.

Here is an openapi schema that would trigger this use-case:

```yaml
openapi: 3.0.0
components:
    schemas:
        IUploadMyFileBody:
            type: object
            properties:
                myFile:
                    type: string
                    format: binary
```
2020-01-06 10:09:56 +01:00
Jim Schubert
ec1e9a4c9b
[csharp] enum suffix changes enumValueNameSuffix to enumValueSuffix (#4927)
* [csharp] Change enum value suffix name

'enumValueNameSuffix' and 'enumNameSuffix' were introduced in a recent
commit. This changes 'enumValueNameSuffix' to 'enumValueSuffix' to
better differentiate between the two options. This also adds a caveat to
the default description which explains that this flexibility may cause
issues when used by client generator.

* [csharp][aspnetcore] Regenerate samples
2020-01-05 16:18:19 -05:00
scott dallamura
9b893ef3c1 [C#] allow customization of generated enum suffixes (#4301)
* [C#] allow customization of generated enum suffixes
2020-01-05 10:25:08 -05:00
Matt Traynham
38185d8558 [Kotlin] Correct isInherited flag for Kotlin generators (#4254)
* Correct isInherited flag for Kotlin generators

* Update Kotlin Client inheritance test to check variables
2020-01-05 10:10:03 -05: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
79d11d7129
[Rust Server] Fix panic handling headers (#4877)
[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
2020-01-05 14:46:09 +00:00
Jim Schubert
c2ee4aefe1 Initial CODEOWNERS (#4924) 2020-01-05 22:23:04 +08:00
Jim Schubert
25036e48d5
[scala] Support for Set when array has uniqueItems=true (#4926)
* [scala] Set support for unique arrays

This includes and builds upon community contribution for better Set support in Scala.
It makes property + model work as expected with Set and default values
across all Scala generators. Included tests to account for new changes.

This also reverts the community contribution to remove ListBuffer
imports and change the default for array to ListBuffer. Users should use
the instantiation types map to modify the desired array instantiation
type. Any new default should target a new minor release after community
discussion, as it affects all existing SDKs generated with
openapi-generator.

* [scala] Improve default handling of monadic collection type

* [scala] Regenerate samples

* Update ScalaPlayFrameworkServerCodegen.java

Scala Play defaulted to List and should continue to do so.

Co-authored-by: František Kocun <frantisek.kocun@gmail.com>
2020-01-05 09:20:56 -05:00
William Cheng
965efdd965
remove nodejs server samples, scripts (#4919) 2020-01-05 21:53:22 +08:00
Andrii
6dc3216f6d Added ability to work with defaultHeaders and fixed authentication for code generated by openapi-generator for typescript-node (#4896)
* Added ability to work with `defaultHeaders` and fixed authentication for code generated by openapi-generator for typescript-node:
 - added getter/setter for `defaultHeaders` property
 - fixed authentication for clients that support several auth methods (use auth method only if auth credentials are set)

* Update petstore templates
2020-01-05 21:41:51 +08:00
William Cheng
7073859aa8
replace petstore_api with packageName (#4921) 2020-01-03 22:54:52 +08:00
William Cheng
759ab1390a remove base_object_spec.mustache from ruby client (#4918) 2020-01-03 15:59:30 +09:00
William Cheng
41f3cba85f
avoid using hardcode prefix in example (#4917) 2020-01-03 13:37:39 +08:00
LudoO
8e1bb3ddff [dart-dio] Fix basepath (#4911)
* Fix basepath

* regenerate sample petstore
2020-01-03 11:25:29 +08:00
Jérémie Bresson
e675360b9e [java][client] jackson update (#4907)
* [java][client] update jackson-databind-version to 2.10.1

* [java][client] update jackson-version to 2.10.1

* Update samples

* [google-api-client] add missing generic parameter to fix compile error

* Update samples
2020-01-03 11:03:12 +08:00
William Cheng
7c31b7f206
[Swift] Minor improvements to swift 5 generator (#4910)
* minor improvements to swift 5 generator

* update readme

* update samples
2020-01-03 10:42:01 +08:00
AlexG
1cb99e3497 [cpp-restbed] Added "out-of-the-box" functionality (#4759)
* Added cpp-restbed "out-of-the-box" functionality
* handling class dependencies
* added method override to clean interfaces of ambiguity
* added default values for shared pointers
* fixed _name and name parameters generating the same getters and setters
* updated enum handling
* updated Petstore samples
* updated templates for automated object generation

* fix whitespace

* removed model initialisation

* added model brace initialisation
2020-01-02 20:36:22 +08:00
Bruno Coelho
5cc5fbe76a New generator swift5 (#4086)
* [swift5] introduce new generator

* [swift5] add Swift Package Manager integration and update dependencies

* [swift5] run petstore

* [swift] update Swift 5 generator with Swift 4 changes

* [swift] update Swift 5 generator with Swift 4 changes

* [swift] make CodableHelper more customizable

* [swift] update pet projects

* [swift] update pet projects

* [swift] add nullable support

* [swift] make enums conform to CaseIterable

* [swift] date formatter add support for ISO8601 with and without milliseconds

* [swift] add urlsession support

* [swift] remove unecessary sample unwrapRequired

* [swift] rename JSONEncodableEncoding.swift to JSONDataEncoding.swift

* [swift] use result in generator internals

* [swift] cocoapods remove deprecated docset_url and add watchos deployment target

* [swift] Add ability to pass in a dedicated queue for processing network response (Fix for 230)

* [swift] update pet projects

* [swift] update docs

* [swift] add support for combine

* [swift] update docs

* [swift] update windows bat scripts

* [swift] update windows bat scripts

* [swift] update swift pet project tests

* [swift] update depencies

* [swift] make urlsession the default http client

* [swift] add urlsession sample project

* [swift] add urlsession sample project

* [swift] update docs

* [swift] improve combine unit tests

* [swift] update docs
2020-01-02 20:21:45 +08:00
Josh Burton
39ba6bbfb1 [dart-dio] Adds support for multipart form data post body (#4797)
* [dart-dio] Adds support for multipart form data post body

* [dart-dio] Fixes issues around formData
2020-01-02 14:03:37 +08:00
Bruno Coelho
9d53ee4b69 [kotlin][client] make Request date converter toJson as default (#4884)
* Fix for Issue #2205

Because when we have tags on OpenAPI Specification, there can be more than 1 Feign Beans being generated and the title field is share by all the clients. This makes the code to stop working in runtime.
Here is a PR which uses the classVarName instead, which follows the standards and should be enough to solve this issue.

For more info please refer to: https://github.com/OpenAPITools/openapi-generator/issues/2205

* fix java feign parameter request name (#4883)

* update sprign cloud feign sample

* [JAVA][SPRING][2195] added missing getter for enum value (#2346)

* [2195] added missing getter for enum value

* updated samples

* re-generate spring samples

* Removed @JsonValue from toString and regenerated samples

* re-generate spring samples

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* update samples

* [kotlin][client] make Request date converter toJson as default

* [kotlin][client] update windows scripts

* [kotlin][client] update docs

* [kotlin][client] update scripts

* [kotlin][client] update scripts

Co-authored-by: Filipe Manuel Couto Pinheiro <filipemcpinheiro@gmail.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
Co-authored-by: Lukáš Vasek <bilaak@gmail.com>
Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
2020-01-02 13:46:49 +08:00
Tomasz Jakub Rup
d643b2706a [go][client] fix when schema have multiple servers (#4901) 2020-01-02 13:44:52 +08:00
Hui Yu
85f6ed5338 [C-libcurl] The JSON key name in request/response body should not be escaped even though it is a C key word. (#4893) 2020-01-02 13:24:23 +08:00
sullis
178a3e24bd upgrade to JUnit 4.13 (#4899) 2020-01-02 13:20:29 +08:00
Sai Giridhar P
89e963c072 [r] Ignoring README.md in Rbuildignore (#4898)
* fix(r): Removing an unnecessary file from build R library

* fix(r): Removing an unnecessary file from build R library
2020-01-02 13:16:58 +08:00
Lukáš Vasek
f37d26cc73 [JAVA][SPRING][2195] added missing getter for enum value (#2346)
* [2195] added missing getter for enum value

* updated samples

* re-generate spring samples

* Removed @JsonValue from toString and regenerated samples

* re-generate spring samples

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
2019-12-29 16:21:32 +08:00
William Cheng
43a5411436 Merge branch 'master' of https://github.com/openapitools/openapi-generator 2019-12-29 16:19:13 +08:00
William Cheng
85f43a3000
fix java feign parameter request name (#4883) 2019-12-29 14:55:08 +08:00
William Cheng
da8500db95 Merge branch 'patch-1' of https://github.com/filipepinheiro/openapi-generator into filipepinheiro-patch-1 2019-12-29 14:22:54 +08:00
William Cheng
b450ce8a5a Merge remote-tracking branch 'origin/4.3.x' into 5.0.x 2019-12-28 12:34:30 +08:00
William Cheng
81e15ed0bf Merge remote-tracking branch 'origin/master' into 4.3.x 2019-12-28 12:00:09 +08: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
William Cheng
adf9c12f73
[Dart] fix option tests (#4874)
* fix dart dio option tests

* minor format change

* fix dart option provider

* minor change to tests

* rearrange test order

* update test value

* comment out set author test

* commet out tests
2019-12-27 22:57:35 +08:00
benjaminSchilling33
24155b31e9 Added Dart config parameters to fulfill pubspec requirements for publishing to pub (#3911)
* Added three configuration values for Dart 2 to be able to publish the generated code to pub without changes:

pubAuthor - contains the name of the author
pubAuthorEmail - contains the email address of the author
pubHomepage - contain the homepage of the project

Changed the name of the output directory from docs to doc as this is the path required by pub

* Added three configuration values for Dart 2 to be able to publish the generated code to pub without changes:

pubAuthor - contains the name of the author
pubAuthorEmail - contains the email address of the author
pubHomepage - contain the homepage of the project

Changed the name of the output directory from docs to doc as this is the path required by pub
2019-12-27 16:45:07 +08:00
Mathieu Lemoine
69b8831cbe [Kotlin] enumPropertyNaming UPPERCASE should separate words with _ (#4062)
* [Kotlin] enumPropertyNaming UPPERCASE should separate words with _

* Add unit cases for issue 4062

Co-authored-by: William Cheng <wing328hk@gmail.com>
2019-12-27 16:37:29 +08:00
Jim Schubert
376e419d0b Support models with multi-level hierarchy (via roxspring) (#4503)
* Example of broken multi-level hierarchy

* Support for multiple levels of hierarchy in model objects

* Support for multiple levels of hierarchy in generators

* Regenerated samples

* Temporarily skip scalaz sample verification, which is having issue with Java version in CI container

* Re-enable scalaz in verify samples

Co-authored-by: Rob Oxspring <roxspring@imapmail.org>
2019-12-27 15:42:32 +08:00
Hui Yu
daec02b8c5 [C-libcurl] Fix build error when the request operation has more than 1 parameter. (#4870) 2019-12-27 14:42:05 +08:00
Sebastien Rosset
9cab534034 [Java] Fix serialized name of discriminator in JSON.mustache (#4672)
* Use propertyBaseName instead of propertyName for discriminator

* Revert "Use propertyBaseName instead of propertyName for discriminator"

This reverts commit 389c5471ba0a71a8ba558c2859e64f08a5186f00.

* Use propertyBaseName instead of propertyName for discriminator
2019-12-26 16:12:58 +08:00
Javier Luque Sanabria
d9c3af54e6 [Kotlin][Client] Update Reserved Keywords (#4793)
* Update reservedWords from here: https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java

* Order keywords.
2019-12-26 16:07:42 +08:00
Yuriy Belenko
ad4b9c711b [MySQL] snake_case table and column names (#4860)
* [MySQL] Add identifierNamingConvention option

Possible values are "original" to not transform original names and
"snake_case".

* [MySQL] Add option tests

* [MySQL] Update doc

* [MySQL] Add original name to comment
2019-12-26 15:05:36 +08:00
Stephane Carrez
a8bc3360fd Fix 3522: [BUG][Ada] Wrong style for generated Ada model types and missing security scopes (#4863)
* [Ada] Operation security scopes are ignored when generating the server (#1043)
- Update fromOperation() to keep the operation required scopes for each auth
  method and store that information in the x-scopes vendor extensions attribute
- Update postProcessOperationsWithModels() to process the operation required
  scopes and build a list of authMethods which only contain the required scopes
  for the operation and store these authMethods in the x-auth-scopes attribute.
- Update postProcessAuthMethod() to handle the logic of filtering and building
  the operation authMethod (new instances are created because we must not
  modify the global authMethod definitions)
- Update the Ada server templates to use the x-auth-scopes instead of authMethods
  Add a URL prefix parameter for the Ada server instantiation

* Fix Ada code generator
- update to generate Ada style type names (broken by the use of Camelize)
- update the templates for Ada Util and Swagger libraries

* Update generated GNAT project to add the 'utilada_xml' dependency

* Update the Ada samples

* Fix compilation of the petstore Ada sample
2019-12-26 14:50:35 +08:00
Hui Yu
4b01943b06 [C-libcurl] Assign the data type to the function parameter when it is "Free Form Object" in OpenAPI description(swagger.json) (#4861) 2019-12-26 14:49:28 +08:00
Richard Whitehouse
0c92b0c4a4
[Rust Server] Handle multiple response type (#4441)
- Ensure response IDs are unique, even if the first sentence is identical
- Handle responses where different responses produce a different type of data
- Use the correct mime type for plain text and byte streams
- Tidy up whitespace in client-mod.mustache
- Specify locale for String.format
- Add test for multiple response types
- Update samples
2019-12-24 15:09:22 +00:00
Yuriy Belenko
2949b53820 [Slim4] Add integration tests (#4858)
* [Slim4] Add integration tests

* [Slim4] Remove unnecessary syntax check script

Composer package called "phplint" processes the same syntax check and
even faster. It can use cache when files hasn't been changed.

* [Slim4] Exclude composer.lock from codebase

Travis CI fails, it cannot install dependencies from lock file under
different PHP(7.1.33) version.
2019-12-23 11:39:49 +08:00
William Cheng
a95e3e3684
Fix boolean option in asciidoc generator (#4856)
* fix boolean option in asciidoc generator

* minor code format chagne
2019-12-22 18:18:16 +08:00
Josh Burton
e90fa5c4df Fixes issue where only some instances of List or Map were replaced with Built equivalents (#4645)
If there was a type that had a nested type of List or Map, e.g. `Map<String, List<String>>` only the outer types would be replaced with the Built variants, causing issues when running the builder.
2019-12-22 16:05:32 +08:00
Man
c0994c479d #4848 [asciidoc] add option to not generate metadata (#4852)
* #4848 [asciidoc] add option to not generate metadata (asciidoc attributes)

cli / additionalParameters: generateHeaders=true|false

* #4848 [asciidoc] new options ascidoc generator

* #4848 [asciidoc] add option to not generate metadata (asciidoc attributes)

cli / additionalParameters: generateHeaders=true|false
2019-12-22 15:34:29 +08:00
Yuriy Belenko
ca4f718748 [Slim4] Add ModelUtils and StringUtils (#4855)
* [Slim4] Add StringUtils and ModelUtils classes

* [Slim4] Refresh samples
2019-12-22 15:04:30 +08:00