8767 Commits

Author SHA1 Message Date
Jiri Kuncar
a09271e76d
[java] Support templated servers (#4998)
* [java] Support templated servers

* Deprecate old signature of invokeAPI method

* throw ArrayIndexOutOfBoundsException

* Update modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache

* [java] Regenerate samples

Co-authored-by: Jim Schubert <james.schubert@gmail.com>
2020-02-19 09:27:45 -05:00
Mostafa Moradian
79caba8d84
[k6] OpenAPI code generator for k6 API load-testing tool (ES5.1+) (#5300)
* Add generator for converting OpenAPI spec to k6 script

* Fixed names and URL

* Add @wing328's proposed changes to fix the builds
2020-02-19 16:04:39 +08:00
Akihito Nakano
37556c2d96
Fix: "isAlias" of CodegenModel (#2758)
* Add test case to reproduce the issue

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

* Fix: an alias of "an alias of simple OAS type" has an incorrect property `isAlias: false`

* Use ModelUtils instead of referring the "type" value directly

* Delete an unnecessary condition

* Tweak: the order of conditions

* Fix wrong "isAlias" value on ComposedSchema
2020-02-19 14:54:54 +08:00
William Cheng
7882c614b9
update wording about title field (#5366) 2020-02-19 11:50:41 +08:00
Alexander Eggers
a7f2791783
[Kotlin][Client] Enum toString handling (#5327)
* Added toString to enum_class script

This toString avoids using the enum var name and uses the enum's value instead. This will fix cases when enum var name and value are quite different.

* Updated enum template

Co-Authored-By: Jim Schubert <james.schubert@gmail.com>

Co-authored-by: Jim Schubert <james.schubert@gmail.com>
2020-02-18 21:30:13 -05:00
Jim Schubert
db47b95fc9
[cli][core] Add support for dry-run and display (#5332)
* 👕🎨 Minor refactor DefaultGenerator

This cleans up some lint warnings and improve general code cleanliness
of DefaultGenerator.

Specifically:

* logger strings are now using the built-in log formatter rather than
  constructing new strings regardless of log level.
* Diamond operators are used where possible
* Some long-unused commented code has been removed
* Lambdas are used where possible
* Redundant operations are merged (HashMap constructor used rather than
  subsequent putAll on a collection, for example)

* [cli][core] Add support for dry-run and display

CLI now supports `--dry-run`, which will output a file change status
similar to git status --porcelain.

The user may also specify `--verbose` for a one-liner below each file
explaining why the change operation might take place.
2020-02-18 20:36:17 -05:00
Ermolay Romanov
1ec2c26053
[BUG][typescript-rxjs] Fix nully type coalescing in Configuration getters (#5329)
* [typescript-rxjs] fix coalescing in Configuration

- eliminate nully "" (empty string) value via conditional check
- use concrete "string" type in typeof check
    ("function" may be returned for Object types

* [typescript-rxjs] update petstore sample

* run petstore-all

- run the script for updating all petstores
   ./bin/typescript-rxjs-petstore-all.sh
2020-02-18 21:28:26 +01:00
Sai Giridhar P
4f7d45f603
[r] Handling CRAN feedback for example snippets (#5345)
* fix(r): Updating donttest to dontrun

* fix(r): Updating donttest to dontrun
2020-02-18 21:26:29 +08:00
Hui Yu
f9a040d1a7
[C-libcurl] Guard memory free for query parameters to avoid coredump (#5356)
* [C-libcurl] Guard memory free for query parameters to avoid coredump

* [C-libcurl] Guard memory free for query parameters to avoid coredump (2nd)
2020-02-18 21:19:11 +08:00
PeterUstinox
9c28f68504
fix typo in maven sample script comment (#5354) 2020-02-17 17:03:57 -05:00
pallxk
15b8210e1f
[JavaScript] Avoid setting Content-Type header if body is not used (#5344) 2020-02-17 23:31:27 +08:00
LoveIsGrief
910ce9fa89
python: Add gitlab-ci.mustache (#5342)
* python: Add gitlab-ci.mustache

It does the same stuff as in the .travis.yml but just for Gitlab CI

#5340 - Python .gitlab-ci.yml

* python: Run all scripts in bin

find bin/ -type f -name 'python*.sh' -exec {} \;

Had to update all samples
2020-02-17 22:36:21 +08:00
Alexey Makhrov
acf85921e4
[typescript] Remove incomplete support of Date type (#5314)
* Remove DateTime mapping from concrete TypeScript generators that do not have full support for Date deserialization

* Fix model unit tests

* Regenerate samples
2020-02-17 07:52:50 +01:00
Sebastien Rosset
527c118210
[codegen] Improve java code comments and argument documentation; Fix issue with ComposedSchema that has undeclared properties (#5316)
* improve documentation

* Add use case of composed schema with additional properties
2020-02-16 20:23:00 -05:00
Bruno Coelho
ffb196151f
[kotlin][client] improve debug experience (#5286)
* [kotlin][client] remove null message on server error

* [kotlin][client] avoid breaking change

* [kotlin][client] add response to client and server exceptions

* [kotlin][client] improve message on ClientException and ServerException
2020-02-16 11:00:14 -05:00
Jim Schubert
dc50585401
[templates] Update templates vendor ext standards (#5295)
* [templates] Update to vendor extension standard keys

* Fix missed value in Java template, also implements=>x-implements. Evaluate Haskell Client changes

* Fix missing accept/content-type update for vendor extension format
2020-02-15 16:26:32 -05:00
William Cheng
118b5e7747
[C++] minor improvements (#5319)
* minor code format, make sure cpp samples updated

* add new files
2020-02-14 10:58:15 +01:00
Alexander Rashed
3f490ea7ee
typescript-angular: single request parameter documentation (#5308)
* Feature: Add JSDoc to request parameter interface members

* Add petstore after generation changes
2020-02-14 09:34:45 +01:00
William Cheng
edd7cab22a
[Java] mark Feign 10.x (instead of 9.x) as the default (#5310)
* set feign 10x as default, mark 9x as deprecated

* update doc
2020-02-14 13:58:44 +08:00
rtp
a50bb28e78
added implementation of declared function. (#5253) 2020-02-13 23:37:40 +01:00
eimerej
346cfc62f3
[cpp-restsdk] fix crashes and constness (#5123)
* []c++[cpprest]fix some constness and invalid access to null  entities

* update petstore sample
2020-02-13 20:59:33 +01:00
duxiaofeng
5a5c3db938
fix #5282: Base Path can't be set to '<empty string>' (#5305)
Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
2020-02-13 16:36:48 +01:00
Peter Steiner
eecd8c056a
Java importmapping 3589 (#4350)
* type aliasing issue

* Add example OpenAPI document from issue 3589

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

* Add test to reproduce the issue

- type of TypeAlias changed from 'string' to 'object'
  (not sure if importMapping is supposed also for 'string' types...)
- there might be better ways to write the test, it's kind of a brute
  force test (generate a file and parse it with a regexp)

* Remove duplicate test file

* Add new method override handleMethodResponse

Fixes broken unit test after merge from master

Co-authored-by: bkoziak <bkoziak@gmail.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-02-13 22:05:53 +08:00
Timo Rohrberg
f5265853ba
[Java][okhttp-gson] Use builder api of OkHttpClient to avoid UnsupportedOperationEx (#5177)
* 3432 Use builder api of OkHttpClient to avoid UnsupportedOperationEx

The reason for the UnsupportedOperationException was an invalid access to the interceptors list of OkHttpClient. That list is unmodifiable as stated by the JavaDoc. Instead accessing the list directly, the interceptors should always be passed when building the client by the builder api.

* 3432 Use builder api of OkHttpClient to avoid UnsupportedOperationEx

The reason for the UnsupportedOperationException was an invalid access to the interceptors list of OkHttpClient. That list is unmodifiable as stated by the JavaDoc. Instead accessing the list directly, the interceptors should always be passed when building the client by the builder api.

* 3432 Follow-up fix to make samples compile again

* 3432 Updated sample implementation for okHttp-Gson-ParcelableModel
2020-02-13 21:55:10 +08:00
Bruno Coelho
9475556f47
[kotlin][client] respect sortModelPropertiesByRequiredFlag (#5211) 2020-02-13 18:51:38 +08:00
Austen
7fa3ce31ac
Update babelrc (#5270)
change absoluteRuntime to false which is the usual default. 
fixes issues brought up here https://github.com/OpenAPITools/openapi-generator/pull/4677
2020-02-13 18:31:55 +08:00
William Cheng
fe4cecba02
fix NPE in rust server generator (#5304) 2020-02-13 18:25:26 +08:00
Arun Nalla
466bacb308
Add missing keywords in rust (#5244) 2020-02-13 15:38:58 +08:00
Henré Botha
930afadc87
Fix docs for --enable-post-process-file (#5299) 2020-02-13 15:07:07 +08:00
Henré Botha
324fe70ab3
Edit documentation for -c (#5288) 2020-02-13 15:05:52 +08:00
Simon Alling
58006982a8
Fix typo: "default GitHub in PRs" (#5302) 2020-02-13 15:04:05 +08:00
Sebastien Rosset
b627fb1137
[codegen][validation] Add support for 'null' type (#5290)
* initial commit for null type

* Add openAPI attribute to validation and recommendation

* improve code comments. the warning used to notify the users to use  instead of defining the schema inline, but now the InlineModelResolver has been enhanced

* Add validation rule for the supported values of the 'type' attribute
2020-02-12 18:41:18 -05:00
Guido Knoll
f2c1bdbf6f
fixes Format Date is converted to Date-Time (#5287) 2020-02-12 10:50:39 +01:00
Åsmund Grammeltvedt
e157b05206
[typescript] Don't hardcode the date type if user has mapped it (#5266)
* [typescript] Don't hardcode the date type if user has mapped it

If the user has set --type-mappings Date=foo, respect this setting
instead of hardcoding the date type.

* Use default type mappings for date/date-time

* Use typeMapping mechanism correctly

* Add default mapping for angular and node to preserve behavior

* One more change to keep current behavior

* Add default type mappings to the other TS generators
2020-02-12 10:49:45 +01:00
Jim Schubert
aa7cd4f5af
[docs] Upgrade to Docusaurus 2 (#5271)
* [docs] Upgrade to Docusaurus 2

Due to formatting issues with Docusaurus 1 and code blocks, and upcoming
4.3 and 5.0 releases, this is an upgrade to have more control over
formatting and other functionality.

This adds behavior to have light/dark themes.

As a consequence of upgrading, columnar format on ul element in
generated generator docs had to be moved to css. This will not impact
users viewing the markdown on GitHub because it didn't display the
column format.

This upgrade should improve syntax highlighting and performance.

* Fix user page layout, choose theme with clear diff colors
2020-02-11 21:22:58 +08:00
William Cheng
72a595b10a
update pom in maven plugin test (#5261) 2020-02-11 10:50:37 +08:00
Slavek Kabrda
0693a83cfe
[go-experimental] Add oneOf support (#5150)
* [go-experimental] Add oneOf support

* Fix docs for the oneOf models

* isOneOfInterface => x-is-one-of-interface

* Add proper warnings when inline models are used in oneOf choices

* Add a convenience method to oneOf implementing structs to cast them as the oneOf interface

* Update modules/openapi-generator/src/main/resources/go-experimental/model.mustache

Co-Authored-By: Jiri Kuncar <jiri.kuncar@gmail.com>

* Fix retrieving data from additionalDataMap

* Add basic tests

Co-authored-by: Jiri Kuncar <jiri.kuncar@gmail.com>
2020-02-10 16:26:32 -05:00
Åsmund Grammeltvedt
a8015ad8c1 [typescript] Make additional properties access safer (#5207)
* [typescript-fetch] Make additional properties access safer

Instead of asserting that any key access returns a valid property, force
the consumer to check that the value is defined.

* Update tests

* Put null-safe additional props behind and flag and share

* Undo over copy

* Update docs

* Rearrange code

* Move to unit tests
2020-02-10 07:47:29 +01:00
Jim Schubert
2aa8a6d033
[core] Log some things in model/url utils once (#5233) 2020-02-09 00:19:25 -05:00
Jim Schubert
4602596df2
[maven]📝 Docs and minor refactoring (#5251)
The maven documentation was missing a few option, a couple of option
properties, and was inconsistent regarding selective generation for apis
an models. This adds properties and options where appropriate and
updates the docs. All options in the README have been reordered to match
property declaration order in CodegenMojo, hopefully making it easier
for maintainers to recognized when there are docs missing or out of
date.

This also slightly refactors the code in CodegenMojo to reduce the
cyclomatic complexity of the `execute` method.
2020-02-08 20:50:14 -05:00
Jaroslaw Zawila
561335f5e5
Add support for bearer token scala-akka #5067 (#5069)
* Add support for bearer token scala-akka #5067

* Update api.mustache

Include master's isKeyInCookie support

* [scala-akka] Update bearer token feature in doc

Co-authored-by: Jim Schubert <james.schubert@gmail.com>
Co-authored-by: Jaroslaw Zawila <jaroslaw.zawila@gmail.com>
2020-02-08 17:08:45 -05:00
Slavek Kabrda
13162b8eee [go-experimental] Preserve capitalized acronyms in structure na… (#5006) 2020-02-08 15:38:29 -05:00
John Flanigan
c6ad35cac8
[feature] Add option to disable stripping of common prefix enum (#5166) 2020-02-08 15:29:50 -05:00
Bruno Coelho
4208f3da82
[swift][client] validate http status code (#5226)
* [swift][client] validate http status code

* [swift][client] remove spaces in empty lines
2020-02-09 00:33:36 +08:00
Keenan Pepper
9126a5636f
Use EXISTING_PROPERTY for JavaSpring as well (#5243)
This fixes issue #3796 for JavaSpring. It's a very straightfoward extension
of #5120 for the JavaSpring generator (that PR was just for the Java generator).
2020-02-08 09:09:46 -05:00
Fabian von Feilitzsch
c943ecfe28
[Python] 5094 followup - Reduce redundancy in docs (#5161)
* Reduce redundancy in python docs

This is a followup to PR #5094, which had a few unresolved comments at
merge time. This reduces the amount of redundant lines in the api
example doc templates, and ensures that referenced Configuration objects
are actually instantiated.

* Regenerate samples
2020-02-06 13:58:17 -08:00
Alexey Makhrov
197cea3248
[core][typescript][perl] Ensure model.parent is also added to model.allParents with multiple inheritance (#5182)
* Add real assertions in DefaultCodegenTest.java testAllOfXXX methods

* Add test to DefaultCodegenTest for an allOf composition with a single ref and no own props

* Ensure model.parent is also added to model.allParents when multipleInheritance is supported

* Cleanup: remove LOGGER.debug, renamed refedParentNames to refedWithoutDiscriminator
2020-02-06 20:21:06 +01:00
Sebastien Rosset
cc0fe06d1c
[python] use datetime aware object (#5209)
* python use aware datetime object

* python use aware datetime object

* python use aware datetime object

* python use aware datetime object

* python use aware datetime object

* python use aware datetime object
2020-02-06 09:48:23 -08:00
Jim Schubert
8d6286dfae
[core] Normalizing vendor extension naming (#5192)
* [core] Normalizing vendor extension naming

According to [OAS 2.0][1] and [OAS 3.0][2] Specifications:

> Allows extensions to the OpenAPI Schema. The field name MUST begin with x-,
>  for example, x-internal-id. The value can be null, a primitive, an array or an object.
>  Can have any valid JSON format value.

This commit attempts to define a [clear identifier design format][3] of
maintaining lower-kebab casing and following the x- prefix defined by
OAI Specification.

Following a convention that matches that used by others (see [autorest][4]), we will remove
any confusion about naming strategies for template authors and
customizers. Following the lower-kebab convention will allow us to
convert from camelCase and missing prefixes to the desired format. For
example, these conversions are simple to make for template consistency:

* customValue => x-custom-value
* x-customValue => x-custom-value
* x-custom-value => x-custom-value

This convention also allows us to define a single standard for use
across all generators. This means no occurrence of x-operationId in one
generator and x-operation-id in another.

[1]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#patterned-objects
[2]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#specificationExtensions
[3]: https://tools.ietf.org/html/draft-wilde-registries-01#section-3.4
[4]: https://github.com/Azure/autorest/tree/master/docs/extensions

* Incorporate feedback to avoid race/blocking in OnceLogger

* Remove unnecessary additional log config

* Add tests,comments for OnceLogger

* Test caffeine cache with FakeTicker
2020-02-06 22:52:58 +08:00
Aleksandr Nekrasov
1bba3a563e
[scala] fix akka-scala-client template compilation warnings (#5106)
* fix akka-scala-client template compilation warnings

add COOKIE location authorization key
regenerate template

* fix scala akka-http client model imports

* fix #4004 custom package name in reference.conf

* fix scaka-akka codegen test
2020-02-06 22:15:43 +08:00