12694 Commits

Author SHA1 Message Date
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
Martin Delille
1413775e0e qt5 client: strip whitespace (#3406) 2019-07-21 22:23:15 +02:00
Prateek Malhotra
84e2f60d6b typescript-fetch: fix basic type errors (#3380)
* use proper response for simple object return types
* exclude api and/or model support files and imports if none are generated

Signed-off-by: Prateek Malhotra <someone1@gmail.com>
2019-07-19 08:04:27 +02:00
Jim Schubert
944e1c3468
[fix] Assign template directory to additional properties (#3385)
* [fix] Assign template directory to additional properties
2019-07-18 09:50:54 -04: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
Slavek Kabrda
0fec25e92e [Go][experimental-client]: make struct members pointers, provide custom marshalling (#3371)
* [Go][experimental-client] Properly define packageName for go-experimental sample client

* [Go][experimental-client] make structure members pointers, provide custom marshalling.
2019-07-18 15:52:37 +09:00
Josh Burton
1aa8a2bec4 [dart-jaguar] Fixes error accessing default converters (#3361)
`this.converters` was causing errors as the default converters are declared outside of the API client.
2019-07-18 15:28:15 +09:00
Jérémie Bresson
4223743ee0 [java rest-assured] prevent reqSpec reuse between requests (#3375)
* [java rest-assured] prevent reqSpec reuse between requests

* Update sample
2019-07-18 14:46:44 +09:00
james-beer
29a85d54a2 Adds default property values in ASP .NET Core models (#3369)
* Fixes docker-entrypoint.sh

* Adds default property values to C# model templates (#3359).
2019-07-18 14:22:12 +09:00
Michal Foksa
a85bd0f8f9 Include common lambdas in generators (#3368)
* Include commonly used Mustache lambdas in DefaultCodegen.
* Use or extend common Mustache lambdas from DefaultCodegen.
* Extract OnChangeLambda to own file.
* Javadoc fixed in addMustacheLambdas().
2019-07-18 06:28:40 +02:00
Jean-François Côté
610ca28681 Fix #3349 : [typescript-fetch] Proposition to follow spec (#3351)
* Fix 3349 : Proposition to follow spec closely

* Fix #3349 : Changes suggested by code review. Add an option for the single request parameter.

* Fix #3349 : Add sample with the use of the single request parameter

* Fix #3349 : Small fix that wasn't passing the tests

* Fix #3349 : Remove cariage return that might create an error

* Fix #3349 : Add chmod to make new sh file executable and fix the CircleCI issue

* Fix #3349 : Add windows sample generation

* Fix #3349 : Rename everything because of default value change

* Fix #3349 : Indentation fix

* Fix #3349 : Add 755 to typescript-fetch-petstore-multiple-parameters.sh

* Fix #3349 : Auto generation of the documentations

* Fix #3349 : Revert back a change that was auto-generated.
2019-07-17 22:30:27 +02:00
christof-vollrath-spring-media
8417c5bed0 [typescript-node] fixed enum generator for top level enums #665 (#2266)
* [typescript-node] fixed enum generator for top level enums #665

* [typescript-node] fixed enum generator for top level enums in models.mustache #665

* Remove wrong copyright line
2019-07-15 15:41:40 +02:00
hello-brsd
81e073df2c [typescript-fetch] fix access token type (#3323) 2019-07-15 08:03:09 +02:00
hello-brsd
2fbf0f33b3 [typescript-fetch] support additional properties (#3325) 2019-07-15 07:59:01 +02:00
hello-brsd
3eac8391f5 [typescript-fetch] support custom stringify for query string (#3327)
* [typescript-fetch] support custom query stringify

* [typescript-fetch] support custom query stringify
2019-07-15 07:58:08 +02:00
hello-brsd
d117506b8a [typescript-fetch] fix collection formats reference (#3324) 2019-07-15 07:57:07 +02:00
Jérémie Bresson
41d5750ddb [JaxRS-Spec] add openApiSpecFileLocation parameter (#3344)
* [JaxRS-Spec] add openApiSpecFileLocation parameter

* Update samples
2019-07-14 18:06:44 +08:00
Mateusz Szychowski (Muttley)
c1df082d65 [C++][Pistache] Add compatibility for nlohmann-json 3.5.0 (#3306)
* [C++][Pistache] Replace contains with find on json object

This makes generator compatible with nlohmann-json 3.5.0

* [C++][Pistache] Update Petstore sample
2019-07-13 13:31:14 +02:00
Jim Schubert
4843dfc244 Updates to address recent lodash Object prototype vulnerability (#3348) 2019-07-13 16:43:05 +08:00
Josh Burton
f04ef76d07 [dart-jaguar] Adds option to customise the generated API client name (#3234)
* [dart=-jaguar] Adds option to customise the generated API client name

* [dart-jaguar] Removes explicit clientName CLI property and derives client name from pub name

* [dart-jaguar] Updates samples

* Reverts import changes
2019-07-13 12:32:24 +08:00
Michal Foksa
e81e650627 1. Operations are grouped together by resourcePath so that operation s with same resourcePath can be rendered one after the other. (#3202)
2. Lambdas registered: lowercase, uppercase, onchnage, etc.
2019-07-13 00:41:26 +08:00
Shunsuke Tadokoro
09b4bbc1e1 Correct CLI option (#3340) 2019-07-12 23:59:12 +08:00
Jérémie Bresson
99ee68128d
[java-client][okhttp-gson] add missing import for bearer authentication (#3343) 2019-07-12 06:55:23 +02:00
Jérémie Bresson
15f8c2c78b [code] indicate replacement methods in the javadoc (#3329)
See PR #2946
2019-07-10 23:14:27 -04:00