8767 Commits

Author SHA1 Message Date
William Cheng
86228e9964
[Ruby] remove auto-generated Gemfile.lock (#3541)
* remove auto-generated gemlock file

* update test file to conform to rubocop format
2019-08-03 16:36:22 +08:00
Dennis Melzer
ba63aa55a5 Add lowercase lamda (#3501)
* Add lowercase lamda

#3381

* Add lowercase prefix for spring

#3381

* Add lamda prefix

* Add lamda lower case to @Value

* Add properties for braces

#3381

* Add property for braces

* Start CI

* Revert
2019-08-02 15:24:04 +02:00
William Cheng
d45e306480
Use partial for Ruby HTTP libraries (#3539)
* use partial for ruby http libraries

* fix isFaraday

* add back client side validation switch

* remove blank lines
2019-08-02 21:18:24 +08:00
cgensoul
1c36fa9fe3 Fixed #3521. Response headers were not processed for enums collection. (#3526)
* Fixed #3521. Response headers were not processed for enums collection.

* Replace " by '' in text fields to allow these to be used in OCaml comments.

* Added support of ByteArray (i.e. base64 encoded data) body and free form object as request body. Added support of free form object in response body as well.

* Added result as a reserved word to prevent generating model files with this name (having a result.ml model file confuses dune into thinking some other model modules depend on Result when they don't).

* Updated samples to reflect the latest changes in the OCaml generator.
2019-08-02 19:04:53 +08:00
Steven Masala
d0f0e17542 remove fixme by setting param to final and creating local variable for sanitising model name (#3525)
- general cleanup

(cherry picked from commit 88cf7e801f78a6611fc0d63479c78296e7312419)
2019-08-02 11:33:15 +02:00
Dennis Kliban
4c1133be3f Problem: faraday ruby client does not respect TLS settings (#3527)
Solution: pass in tls settings to the faraday client
2019-08-02 12:20:16 +08:00
William Cheng
ca85ecb283
[Ruby][Faraday] Various improvements (#3520)
* update ruby faraday oas v2 samples

* skip some default tests in faraday

* add ruby faraday oas v3 client

* add tests, fix url

* add tests to CI

* fix file upload

* undo changes to ruby-client-petstore.sh

* test faraday first

* combine gemspec tempaltes

* test ruby faraday in drone.io

* use smaller image

* update bundler

* use official ruby image

* skip bundler installation

* skip autotest

* install make

* use different image

* skip ruby tests in drone.io
2019-08-02 07:00:29 +08:00
Juang, Yi-Lin
93ddf6e2ef Fix DateTimeOffset nullable issue (#3530) 2019-08-02 06:58:32 +08:00
Ivan Aksamentov
581131e0fe Fix PHP Symfony non-primitive return type being forced to be an array (#3515)
* Fix PHP Symfony non-primitive return type being forced to be an array

https://github.com/OpenAPITools/openapi-generator/issues/3514

* Update PHP Symfony samples
2019-08-02 06:54:13 +08:00
Mateusz Szychowski (Muttley)
4d285939a6 [C++][Pistache] Do not use JSON for primitive types in request body (#3509)
* [C++][Pistache] Do not use JSON for primitive types in request body

Request body can contain any input, simple strings, CSV text or something else

* [C++][Pistache] Update Petstore sample version
2019-08-01 13:49:17 +02:00
Marc Schlegel
0a7527b03e [java-client][okhttp-gson] fixes for interceptors in ApiClient.java (#3502)
ApiClient for Okhttp3 must not copy the interceptors when setting the HttpClient.
Enforce invariant that the HttpClient must never be null.
2019-08-01 06:39:47 +02:00
Dennis Kliban
bcc3a9ecf7 Ruby client faraday (#3405)
* WIP: add faraday support to Ruby client

* update samples

* bin/console

* https only

* ruby-faraday: Add a gemspec template for faraday

* Add a test for ruby-faraday client options

* Remove Gemfile.lock from ruby-client-faraday

* Implement faraday client

* Problem: can't use Faraday library for ruby clients

Solution: add support for Faraday library

This patch builds on the work started by @meganemura

* Problem: Faraday is set as default library

Solution: Make Typhoeus default

This patch also updates the api_client template for Faraday to include query params with requests.
2019-08-01 11:08:34 +08:00
Erik Seliger
f90f214121 fix(typescript-angular): improve small template issues (#3466)
* fix(typescript-angular): improve small template issues

* fix: template adjustments

* fix: repair hasSomeFormParamsLogic

* Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java

Co-Authored-By: Esteban Gehring <esteban.gehring@gmail.com>
2019-07-31 22:24:02 +02:00
Erik Seliger
0e621dcc29 feat(typescript-angular): add flag for using string enums (#3464)
* feat(typescript): add flag for using string enums

* fix: adjust templates

* fix: repair logic

* fix: remove sample

* fix: add to v7 sample

* fix: remove unneeded lines
2019-07-31 21:16:49 +02:00
Justin Black
88af8964fd [python-experimental] automatically use values for enums of length1 (#3118)
* Update python client java generator

* Updates python generator mustache files

* Python sample regenerated

* Switches from getfullargspec to getargspec for python2 compatibility

* Uses getattr to get model class init method to correctly see its arguments, linting fixes to pass python tests

* Updates comment in python centerator to restart CI tests

* Adds bin/windows/python-experimental-petstore.bat

* CHanges spec update to apply to the python-experimental spec

* Moves new python templates to python-experimental

* Moves generator python java code to python-experimental

* Reverts python generator mustache files

* Regenerates python, v3 python, python-experimental samples

* Test moved to python-experimental, unused python files removed
2019-07-31 21:18:30 +08:00
Thibault Duperron
4c9d023468 Enable async option for spring-cloud library (#2670)
* Enable async option for spring-cloud library

* Samples
2019-07-31 14:22:05 +08:00
William Cheng
d46cabcd4f
Better handling of dot in inline model name (#3498)
* better handling of dot in inline model name

* do nothing if title is present

* add comment
2019-07-31 13:50:29 +08:00
julaudo
6824bd8b24 #2694 [BUG][Typescript Axios] Content-type not set (#2695)
* #2694 [BUG][Typescript Axios] Content-type not set

* Test required allOf

* re-generate typescript-axios samples

* re-generate typescript-axios samples
2019-07-30 15:47:17 +02:00
Doxoh
f90507b527 [aspnetcore] Support cookie parameter (#3490)
* Fix typo useDefaultRoutng to useDefaultRouting

* support the cookie functionality in aspnetcore

* Changes like wing328 comments
2019-07-30 18:22:15 +08:00
timmiotool
3b584c2138 validation for primitive request bodies #3491 (#3492)
* Add parameters to primitive request bodies

Signed-off-by: tim.smyth <tim.smyth@kiwigrid.com>

* Replace tabs for spaces

Signed-off-by: tim.smyth <tim.smyth@kiwigrid.com>
2019-07-29 18:06:20 +02:00
Michal Foksa
37cdc8e493 Feature/mustache lambda documentation (#3476)
* Default outputFile value is `openapi/openapi.yaml`.

* Mustache Lambdas documentation.

* Default OpenAPIYamlGenerator outputFile value is `openapi/openapi.yaml`.
2019-07-29 15:34:50 +02:00
Benjamin Gill
c684505cba
Stop deriving Eq for models (#3463)
It fails if the model contains a float, which don't implement Eq.

Fix for bug introduced in #3309.

We really need to improve the testing of the rust generator to catch this sort of mistake in future. I don't have time to do this now, though.
2019-07-29 14:01:01 +01:00
Sebastian Rühl
1bf8c15206 [BUG-1865] Added serialization support for typescript on complex object headers. (#1874)
* [BUG-1865] Added serialization support for typescript on complex object headers.

* Update api.mustache

integrate feedback from https://github.com/OpenAPITools/openapi-generator/pull/1874#discussion_r268981304

* [BUG-1865] post merge fixes

* [BUG-1865] addded windows scripts

* Apply suggestions from code review

Co-Authored-By: Esteban Gehring <esteban.gehring@gmail.com>

* [BUG-1865] regenerated samples
2019-07-29 11:31:42 +02:00
Steven Masala
b4f1581941 Fix: Remove spec 3 references keys in imports for TypeScript (#1932)
* fix name sanitation when using kebab case filenaming

* remove whitespaces

* sanitize names by removing spec 3 ref keys

* Revert "sanitize names by removing spec 3 ref keys"

This reverts commit 7e58719317bb936884f5ed0049177ef961871464.

* add pipes to datatype names

* split imports

* remove comment

* fix when using a mixture of (any|one) and standard imports

* sanitize names by removing spec 3 ref keys

* Revert "sanitize names by removing spec 3 ref keys"

This reverts commit 7e58719317bb936884f5ed0049177ef961871464.

* Merge conflict DefMerge branch 'master' into name-ref-fix

# Conflicts:
#	modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

* split imports

* remove comment

* fix when using a mixture of (any|one) and standard imports

* Fix merge error

import missing package, merge error.

* format

*  fix tests

* create test, fi regex
2019-07-29 11:30:34 +02:00
Doxoh
cf01bf4ae7 Fix typo useDefaultRoutng to useDefaultRouting (#3488) 2019-07-29 17:30:07 +08:00
scottydawg
74eeb07b22 Support importMapping definitions for TypeScriptNodeClientCodegen (#3469)
* Support importMapping definitions for TypeScriptNodeClientCodegen

* Use import mappings for all file references
2019-07-29 07:48:20 +02:00
tjnet
9cb3ae1048 remove unecessary null check as it cannot be reached due to the Null Pointer Exception (#3480) (#3481) 2019-07-29 10:34:57 +08:00
William Cheng
6e3176557c
[OCaml] various enhancements (#3483)
* add ocaml template creator

* various enhancement to ocaml generator

* update instruction

* update doc

* remove readme

* add back readme
2019-07-29 10:07:32 +08:00
cgensoul
1713c7610d [OCaml] new client generator (#3446)
* Début d'un générateur pour OCaml.

* Ajout du script bash de generation pour OCaml.

* Implémentation de la partie model du générateur OCaml.

* Suppression du fichier Model.mustache.

* Légère modification dans le générateur OCaml.

* Début d'implémentation de la génération des opérations.

* Avancées dans l'implémenatation des opérations.

* Avancée dans la gestion des enums : reste à traiter le fait que Yojson sérialize les variants comme des tableaux JSON.

* Prise en compte du fait que Yojson représente les variants constants sous forme d'un tableau JSON contenant une unique string.

* Utilisation des variants polymorphe pour les enums car il se peut que plusieurs énumérations partagent des valeurs communes ce que ne permettent pas les variants ordinaires au sein d'un même module.

* Avancées dans le générateur de code OCaml : le code produit compile et prendre en compte les pathParams, les queryParams, les headersParams, les bodyParams et la réponse JSON. Manque le support du multipart, du form encoded et des mécanismes d'authentification.

* More tests.

* Correction de problèmes dans la génération mis en évidence par l'utilisation d'un fichier OAS plus gros et complexe que Petstore.

* Mapping du case Error de Ppx_deriving_yojson_runtime.ok_error vers l'exception Failure pour avoir des types plus simples et non dépendants de Pppx_deriving_yoson_runtime dans les APIs générées.

* Ajout de la génération des fichiers d'interfaces .mli pour les APIs.

* Ajout du support des parametres de type x-www-form-urlencoded.

* Le paramètres d'url de type number étaient mal gérés.

* Cleanup.

* Replace block comment start and end sequences in input text.

* Make apis calls without a return type return unit rather than Yojson.Safe.t.

* Make modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml generate properly.

* Added generated code for modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml.

* Better handling of enums and map container and better sanitizing of generated identifiers to support all the corner cases present in modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml.

* Correcting a violation : using toLowerCase without relying on the default Locale.

* Changed authoring in partial_header.mustache.

* Deleted commented code.

* Collect enum schemas in items properties of operation parameters in the case of ArraySchema parameters. This allows correct processing of modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml.

* Collect enums also in additional properties schemas of operation parameters in the case of MapSchema parameters (if this type of parameter can is allowed).

* Removed copy-pasted Copyright notice from SmartBear.

* update doc

* Use Locale.ROOT instead of Locale.ENGLISH for toLowerCase calls.

* Make GET operations with body generate compilable code.

* Updated ocaml-client generated samples using the latest version of the OCaml code generator.

* Added [@default None] for record fields with option types so that if those fields are missing at deserialization time, None is assumed.

* Added support of api keys in query params.

* Updated generated ocaml samples to reflect latest changes in templates.

* Added [@default] on enum record fields for which the enum type has only one accepted value so that those fields can be deserialized even if the value is absent of the json payload.

* Delete useless space character in template.

* Added proper handling of http response codes.

* Updated generated ocaml samples to reflect latest changes in templates.
2019-07-28 21:50:53 +08:00
Guillaume SMAHA
049f69c55b Use range for dependencies in python-flask (#3470) 2019-07-28 10:40:10 +08:00
Chris Couzens
6358b11516 Bash skip empty query param fix (#3290)
* Bash: Update samples

I'm about to make a fix to the bash generator. I'm regenerating the
samples in this commit so that the change I make isn't lost amongst
the noise.

https://github.com/OpenAPITools/openapi-generator/pull/3290

* Bash client: Fix query params seperation

Fix bug where empty query parameters weren't separated by ampersands.

For example, this
```bash
bash bash_keycloak/client.sh -v --oauth2-bearer "$access_token" --host "$api_host" realmUsersGet realm=demo_realm2 email=foo+bar@baz.com
```
would generate the path
`/auth/admin/realms/demo_realm2/users?briefRepresentation=email=foo+bar@baz.comfirst=firstName=lastName=max=search=username=`.

It now puts ampersands around them to make
`/auth/admin/realms/demo_realm2/users?briefRepresentation=&email=foo+bar@baz.com&first=&firstName=&lastName=&max=&search=&username=`

Instead of predicting if there is going to be a `parameter_value` ahead of
time, we now put in the ampersand if there is a `parameter_value` and existing
`query_request_part`.

https://github.com/OpenAPITools/openapi-generator/pull/3290

* Bash: Skip query parameters with empty value

I have a route with many optional query parameters.
I observed that when they weren't specified, they were still included in
the routes, but without a value.

Running:
```bash
bash bash_keycloak/client.sh -v --header "Authorization: Bearer $access_token" --host "$api_host" --dry-run realmUsersGet realm=demo_realm2 email=foo+bar@baz.com username=foo
```

Would produce the route:
`http://localhost:8080/auth/admin/realms/demo_realm2/users?briefRepresentation=&email=foo+bar@baz.com&first=&firstName=&lastName=&max=search=&username=foo`

After this change it produces the route:
``http://localhost:8080/auth/admin/realms/demo_realm2/users?email=foo+bar@baz.com&username=foo

---

I discussed with @wing328 in the pull request about if empty values (eg
`username=` should produce an empty query parameter, or if the query
parameter should be removed.

We decided it should remove the query parameter.

https://github.com/OpenAPITools/openapi-generator/pull/3290

----

The OpenAPI definition I was using:

Using:
https://github.com/ccouzens/keycloak-openapi/blob/master/keycloak/6.0.json
In particular:
```json
      "/{realm}/users": {
        "get": {
          "summary": "Get users   Returns a list of users, filtered according to query parameters",
          "parameters": [
            {
              "in": "query",
              "name": "briefRepresentation",
              "schema": {
                "type": "boolean"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "email",
              "schema": {
                "type": "string"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "first",
              "schema": {
                "type": "integer",
                "format": "int32"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "firstName",
              "schema": {
                "type": "string"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "lastName",
              "schema": {
                "type": "string"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "max",
              "description": "Maximum results size (defaults to 100)",
              "schema": {
                "type": "integer",
                "format": "int32"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "search",
              "description": "A String contained in username, first or last name, or email",
              "schema": {
                "type": "string"
              },
              "style": "form"
            },
            {
              "in": "query",
              "name": "username",
              "schema": {
                "type": "string"
              },
              "style": "form"
            }
          ],
```
2019-07-27 21:48:36 +08:00
William Cheng
3e027c61da Merge remote-tracking branch 'origin/master' into 5.0.x 2019-07-27 20:53:38 +08:00
Erik Seliger
d5d8b7a118 fix(typescript-angular): use correct package with http-client (#3465) 2019-07-26 07:54:40 +02:00
William Cheng
45fcf3792a
[Java] add nullable support to the clients (#3453)
* add nullable support, update samples

* update samples
2019-07-26 10:00:27 +08:00
Benjamin Douglas
43590582c5 Java 11 native HTTP client library (#3434)
* Initial commit of Java 11 native HTTP client port

* Rebase to master and add JSR305 for @Nullable

* Update samples with @Nullable annotations
2019-07-26 09:59:21 +08:00
William Cheng
8253c28d6e
[Java] Replace "useNullForUnknownEnumValue" option with the nullable attribute (#3455)
* add nullable support to enum

* update test spec with nullable enum

* update samples

* update samples
2019-07-26 09:49:44 +08:00
Bernd Hacker
8231cbfe81 [typescript-rxjs]: support reponseType blob (#3437)
* feat(typescript-rxjs): add optional responseType to RequestOpts

* refactor(typescript-rxjs): remove redundant importMapping.clear() in codegen constructor

* feat(typescript-rxjs): update this.reservedWords

* fix(typescript-rxjs): add missing fields copied to ExtendedCodegenOperation

* feat(typescript-rxjs): add support for responseType blob

* feat(typescript-rxjs): regenerate samples
2019-07-25 15:16:54 +02:00
Freeman
a3cf964ce9 Upgrade babel packages for Javascript ES6 generator (#3424)
* Upgrade babel packages for Javascript ES6 generator

* Fix @babel/register in test script
2019-07-25 14:31:27 +02:00
Martin Delille
3f3ecb6879 add modelNamePrefix option for qt5 (#3431)
* qt5: Remove duplicate cppNamespace additional property

* qt5: Add modelNamePrefix additional property
2019-07-25 09:23:51 +02:00
Fjolnir-Dvorak
2f479f493f [Java] Fix numeric field names (#3436)
* Fix for OpenAPITools/openapi-generator#3293. Number fields in java generators are escaped now.

* Added a few tests for number to varName to persist and ensure this behaviour for future breaking changes OpenAPITools/openapi-generator#3293.

* I also added a few test for convertModelName to prevent similar breaking changes in the future. OpenAPITools/openapi-generator#3293.
2019-07-25 07:38:49 +02:00
kassim
ee538be964 [Java] add nullable annotation to pojo template for non-required fields (#3409)
* add nullable annotation to pojo template

* add jsr305 dependency

* jsr305 dependency on all java build.gradle files

* jsr305 dependency on all java pom.xml files

* update samples

* more pom updates

* more sample/template updates
2019-07-25 10:35:18 +08:00
Jérémie Bresson
a0dd7394ac [java] Support for number enum (#3328)
* [java] Support for number enum

*  [core] add isLong, isNumber, isNumeric, isFloat, isDouble to CodegenModel

* [java-gson] fix Enum TypeAdapter in BigDecimal case.
2019-07-25 10:32:50 +08: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
Gabriel Féron
2e81e612fc Fix enum types in structs (#3309)
I already contributed proper enum supports a few weeks ago, but somehow missed actually using them when they're used as a property. This PR fixes that.

I also took the liberty of fixing a bunch of unused warnings.

* Make sure we use the enum types in Rust

* Fix unused warnings in Rust and regenerate samples

* Use crate:: import path that works both with Rust 2015 and 2018

* Derive PartialEq and Eq in generated Rust structs and enums
2019-07-24 17:29:43 +01:00
Ramanth Addala
a4b1c269d8 fix(r): updated example in doc(.md) file (#3429)
* fix(r): updated doc(.md) files

* fix(r): changed enum representation
2019-07-24 23:15:21 +08:00
Jeremy Bohrer
5775813031 2745 typescript date format (#3423)
* fix axios issue

* fix typo
2019-07-23 15:44:34 +02:00
Bernd Hacker
d2576f411e [typescript-rxjs] runtime and api cleanup (#3316)
* feat(typescript-rxjs): use interfaces from rxjs/ajax, use shorthands

* feat(typescript-rxjs): regenerate samples

* docs(typescript-rxjs): extend readme by middleware howto

* feat(typescript-rxjs): stop generating empty comment when there is no description in model

* feat(typescript-rxjs): import throwIfRequired and COLLECTION_FORMATS only when needed

* feat(typescript-rxjs): generate HttpHeaders and HttpQuery only if needed, improve formatting

* feat(typescript-rxjs): conditionally import HttpHeaders and HttpQuery

* feat(typescript-rxjs): add encodeURI helper, refactor queryString helper

* feat(typescript-rxjs): improve condition for hasListContainers

* feat(typescript-rxjs): regenerate samples
2019-07-22 11:21:37 +02:00
Silas Boyd-Wickizer
76fecf744b [typescript-node] Promise-based Authentication interface (#3408) 2019-07-22 10:54:48 +02:00
Daniel Grünberger
f436904359 [typescript-angular] Add encoder configuration, fix default encoder (#3372) (#3389)
* [typescript-angular] Add encoder configuration and fix default encoder (#3372)

* Add encoder to configuration
* Fix import indention
* Default encoder workaround for https://github.com/angular/angular/issues/18261

* [typescript-angular] Refactor api.service template

* Extract encoder class variable initialized in constructor

* [typescript-angular] Updated samples

* [typescript-angular] Add missing imports

* [typescript-angular] Update samples

* [typescript-angular] Update samples

* [typescript-angular] Fix tests

* Fix typo
* Add missing interface method implementation
* Update samples
2019-07-22 10:54:14 +02:00
Daiki Matsudate
5cba55f8fb
[Swift4] Introduce XcodeGen (#3396)
* add XcodeGen.mustache

* generate code

* add dependencies
2019-07-22 17:12:34 +09:00