12694 Commits

Author SHA1 Message Date
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
mcpummec
8779fc6485
pass key to http params for date objects (#5225) 2020-02-06 14:43:10 +01:00
Dheeraj Nalluri
7799ddebe1
[typescript-angular] Use security scheme name for API key lookup (#5220)
* [typescript-angular] Use security scheme name when looking up API keys.

* [typescript-angular] Updated samples.
2020-02-06 10:20:30 +01:00
Jim Schubert
4fa096f604
[bug][kotlin] Fix compile of reserved word in client (#5221)
* [kotlin] Fix compile of reserved word in client

A number of places in the client code need to be escaped for reserved
words.

That is, this should be:
(git log formatted): `as` rather than as
(markdown formatted): \`as\` rather than `as`

There are only a handful of places using `{{paramName}}` which HTML
encodes backticks, rather than `{{{paramName}}}` which outputs literal
values.

Added unit test to maintain the reserved word standard for Kotlin.

* don't use kotlin-codegen-escaped parameters in parameter-map

Co-authored-by: Andreas Müller <andreas@stapelspeicher.org>
2020-02-06 00:49:52 -05:00
Sebastien Rosset
9d2c39dc43
Add openAPI attribute to validation and recommendation (#5216) 2020-02-05 23:40:32 -05:00
gaetPax
b6b7284e4c
[Java] update feign form dependency version (#5179)
* [Java-Feign-issue 5173] - update feign form dependency version

* [Java-Feign-issue 5173] - updated feign versions in sample project

* [Java-Feign-issue 5173] - fix OAuth in Feign10 sample

* [Java-Feign-issue 5173] - updated OAuth Feign template

* update feign samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-02-05 23:10:16 +08:00
Akihito Nakano
c27da984d1
[kotlin] Fix non-compilable code (#5205)
* The "name" field has to be a string

* Avoid duplicate double quotes
2020-02-04 22:01:18 -05:00
Tatsuro Shibamura
7e54196967
[csharp-netcore] Remove use of dynamic type and optimize reference (#5206)
* Change unnecessary `dynamic` to `object`

* Optimize package reference

* Fixed JsonSubTypes reference

* Update sample project

* Remove redundant method calls

* Update sample project

* Update README template
2020-02-05 10:51:48 +08:00
Bruno Coelho
5bf501af40
[swift5] update visibility modifiers (#5204) 2020-02-05 09:51:29 +08:00
fritzlitester
a0eb149df5
Fix query parameter (#5131)
* fix map as query parameter, use RequestPart instead of RequestParam in
FormParams, add filename for parameters of type file

* fix brace

* fix tests

* run bin/windows bat files

* test if this solves linending problem part 1

* test if this solves linending problem part 2

* test if this solves linending problem part 3

* test if this solves linending problem part 4

* test if this solves linending problem part 5

* test if this solves linending problem part 6

* manually set back version in pom

* update spring samples

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-02-04 22:08:36 +08:00
William Cheng
100b01844a Merge remote-tracking branch 'origin/master' into 5.0.x 2020-02-04 15:31:10 +08:00
Sebastien Rosset
67e4cc8be1
[Python] Python HTTP signature update (#5154)
* improve python documentation and add import to __init__package.mustache

* improve python documentation and add import to __init__package.mustache

* add signing_info parameter conditionally

* add code comments and remove 'Content-Length' header from example

* Remove debug log statement

* set access_token to None by default

* set access_token to None by default

* fix unit tests for Python experimental

* fix trailing space
2020-02-03 09:39:17 -08:00
Sebastien Rosset
dcc914421e
[codegen] Performance optimizations: use of cache for camel case and sanitized strings (#5152)
* use of cache for camel case and sanitized strings

* use of cache for camel case, sanitized strings and underscored words
2020-02-03 22:56:42 +08:00
Daniel Frąk
149778a7e7
[typescript-angular]: objects as query parameters no longer break when fields are null (#5197)
* #5174 fix [BUG] [typescript-angular]: objects as query parameters break when fields are null

* #5174 Shell scripts run

* #5174 Code style fix

* #5174 Regenerate typescript-angular samples

* #5174 Regenerate typescript-angular samples a second time
2020-02-03 13:33:05 +01:00
Ben Cox
fbcb8e0c7e
[java-jersey2] Fix empty body when form parameters supplied (#5169) 2020-02-03 17:11:59 +08:00
Yutaka.Miyamae
a6807a73e5
[Kotlin]Formatted according to the kotlin style guide (#5196)
* Do not put a space
https://kotlinlang.org/docs/reference/coding-conventions.html#horizontal-whitespace

* Use 4 spaces for indentation
https://kotlinlang.org/docs/reference/coding-conventions.html#formatting

* Put spaces around the `=` sign
https://kotlinlang.org/docs/reference/coding-conventions.html#method-call-formatting

* Indent the expression body by 4 spaces
https://kotlinlang.org/docs/reference/coding-conventions.html#expression-body-formatting

* run ./bin/kotlin-springboot-petstore-all.sh
2020-02-03 16:17:26 +08:00
Jim Schubert
97ff9b4be7
[cli] Optional colorized outputs (#5193) 2020-02-02 17:36:53 -05:00
Sebastien Rosset
9e32d43570
[bug] fix null pointer exception while evaluating recommend… (#5191) 2020-02-02 15:34:49 -05:00
Tatsuro Shibamura
f356de606b
[csharp-netcore] Improved Multimap and ClientUtils implementation (#5122)
* Improvement Multimap impl

* Fixed missing semi-colon

* Fixed compile error using .NET Standard 2.0

* Fixed compile error using .NET Standard 2.0

* Update sample projects

* Apply modifications to additional code flows
2020-02-03 00:15:33 +08:00
Matt Traynham
26c9c64634
[kotlin][client] Add inheritance to Kotlin Client templates (#4453)
* Add inheritance to Kotlin Client templates

* Correct white spacing issues

* Rebuild kotlin client samples
2020-02-01 22:12:11 -05:00
Jim Schubert
a496c2011f
[docs] Initial FeatureSet generator documentation (#5188)
* Flatten feature sets for display

* [cli] Add feature set output to config-help

This includes markdown and plain text outputs for config-help.

* [docs] FeatureSet on generator docs
2020-02-01 20:51:55 -05:00
Sebastien Rosset
8d8c106c3a
[Go] Support HTTP signature (#4959)
* add support for ECDSA keys

* Add support for HTTP signature

* use bytes.Buffer instead of strings.Builder

* Add unit tests, compliance with HTTP signature draft version 12

* Support (expires) parameter

* Validate list of signed headers does not have duplicate values

* move method to ProcessUtils

* Add http-signature security scheme

* add http_signature_test to security scheme

* remove http signature from petapi

* Add separate OAS file with support for HTTP signature

* Include HTTP signature in README file

* Add generated files for HTTP signature

* Add helper function to return public key, and add more unit tests for signature validation

* some people save their private key with file extensions other than .pem, so I am relaxing the validation of the private key suffix
2020-02-01 15:42:15 -05:00
Tatsuro Shibamura
8197a8a47b
Explicitly set netCoreProjectFile only for .NET Core target (#5151) 2020-02-02 00:26:27 +08:00
Tatsuro Shibamura
a8435d153e
[csharp-netcore] Remove unnecessary legacy project definitions (#5108)
* Remove unnecessary csproj definitions

* Removed deprecated files generation

* Fixed code generator compile error

* Update sample code

* Update sample projects

* Revert "Removed deprecated files generation"

This reverts commit c6841c2b54fac74d31a1cf59ea73d50c430609ba.

* Revert "Fixed code generator compile error"

This reverts commit cc0bd070e75d9fbc9620045105631fef8ca6fc1b.

* Regenerate missing project.json file
2020-02-02 00:08:09 +08:00