Commit Graph

4479 Commits

Author SHA1 Message Date
wing328
6651f6bfa1 Merge remote-tracking branch 'origin/2.4.0' 2018-01-22 14:16:55 +08:00
Jim Schubert
8724719960 [csharp] Support arrays of arrays for properties and models (#7400)
* [csharp] Support composition on toJson

Previous implementation assumed specification only supports polymorphic
associations (via discrimator), although the code didn't seem to be
setup correctly for that in the first place. That is, the parent object
must define the discriminator (see
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support),
so NOT HAS parent AND HAS discriminator doesn't make sense.

From a C# perspective, base classes should have the method marked
virtual and derived classes should override the method. This supports
both composition and polymorphic definitions.

* [csharp] this.Configuration in api template

Unprefixed Configuration property access leads to ambiguous references
when spec defines a Configuration model.

* [csharp] Models/properties support nested arrays

Previous implementation didn't support multiple levels of array with
array items as OpenAPI spec supports. This means an object defined as
type: array with items = type: array|items=double (which is common in
GIS) would not be possible.

This implementation assumes generics in the nested type definitions, so
the above would generate List<List<double?>> for model parent types as
well as property type declarations.

* [csharp] Regenerate integration test sample

* [csharp] Set "Client" case sensitive as reserved

* [csharp] Regenerate security sample

* [csharp] Regenerate samples
2018-01-22 14:14:17 +08:00
Jim Schubert
1c4e6b7d46 [csharp] Fix ToJson to work with composition and polymorphism (#7399)
* [csharp] Support composition on toJson

Previous implementation assumed specification only supports polymorphic
associations (via discrimator), although the code didn't seem to be
setup correctly for that in the first place. That is, the parent object
must define the discriminator (see
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support),
so NOT HAS parent AND HAS discriminator doesn't make sense.

From a C# perspective, base classes should have the method marked
virtual and derived classes should override the method. This supports
both composition and polymorphic definitions.

* [csharp] Regenerate integration test files

* [csharp] Regenerate samples

* [csharp] Regenerate security sample
2018-01-22 14:13:50 +08:00
Jim Schubert
ed7af73f6b [csharp] Reference this.Configuration in client api template (#7394)
* [csharp] this.Configuration in api template

Unprefixed Configuration property access leads to ambiguous references
when spec defines a Configuration model.

* [csharp] Regenerate samples
2018-01-22 14:04:19 +08:00
jarlesat
99fc272465 [JAX-RS][Spec] Removes throws Exception. (#7437)
* Issue-7435 Removes throws Exception.

* Issue-7435 Updates jaxrs-samples.
2018-01-22 13:48:59 +08:00
Stephane Carrez
7d2b49085f Fix 7457: [Ada] wrong order for generated structures in *-models.ads (#7462)
* Fix the comparison between two model types to compare them recursively
and make sure we sort the model types according to their dependencies

* Run bin/ada-petstore.sh to update the generated Ada client samples
2018-01-22 13:27:39 +08:00
Stephane Carrez
2b2b85eec7 Fix 7459: [Ada] wrong JSON in POST operations (#7460)
* Fix Ada client generated code to avoid having a spurious body name for parameters passed in the body

* Run bin/ada-petstore.sh to update the generated Ada client samples
2018-01-22 13:21:09 +08:00
Tristan Sloughter
c73118524c [erlang-client] Erlang request utils (#7257)
* [erlang-client] fix body param from being included path and base path to remove host

* [erlang-client] move request logic out of api functions to utils module

* [erlang-client] add support for passing http client configuration to requests

* [erlang-client] update auth handling

* [erlang-client] remove underscore2, replacing with original underscore + replaceAll
2018-01-22 13:18:35 +08:00
magnolia
6db63c7a1f deleted unnecessary notes (#7454)
https://github.com/swagger-api/swagger-codegen/issues/7398
2018-01-20 14:31:43 +08:00
ccozzolino
59ff4c198b [Java][library: vertx] Add default value and required parameter support to vertx server temp… (#7410)
* Add default value and required parameter support to vertx server templates. Fix for #7409.

* Added missing serviceId declaration to workaround #allParams section clearing the vendorExtensions map
2018-01-20 14:31:06 +08:00
Esteban Marin
ef832e7157 [Feature][Angular] improve docs angular import (#7363)
* #7354: improve docs about importing multiple ApiModules, prevent https://github.com/angular/angular/issues/20575#issuecomment-356261374

* #7354: prevent https://github.com/angular/angular/issues/20575#issuecomment-356261374 add error message about importing the HttpModule / HttpClientModule

* #7354: generate sample files

* #7354: generate README.md also for non-npm packages
2018-01-20 14:24:33 +08:00
Kane Lai
a61d23265d Fixed incorrect renaming of header and query param to camel cases for Kotlin Client template (#7420)
* - Fixed incorrect renaming of header and query param to camel cases

* Generated petstore code base on modified Kotlin template
2018-01-19 17:30:04 +08:00
magnolia
7853308c8e Rebuild Scalatra sample (#7431)
When creating the following PR, sample was generated without reflecting the last change.

https://github.com/swagger-api/swagger-codegen/pull/7393

With this commit, it will be synchronized
2018-01-19 16:20:41 +08:00
magnolia
1ee85de94e Added Intelli J ignore (#7423)
.idea
*.iml
2018-01-19 16:20:12 +08:00
etherealjoy
ea4b948428 [qt5cpp] Add nullptr guard to prevent crash when empty model is being serialized (#7434)
* Small fixes to prevent crash when empty json body is provided.

* Updated PetStore example for Qt5
2018-01-19 15:36:45 +08:00
William Cheng
30c1448d78
Fix build.gradle for Java RESTEasy client (#7448)
* update release 2.3.1

* add jeff9finger to java tech committee

* fix build.gradle for java resteasy
2018-01-19 13:21:39 +08:00
magnolia
7b8e409cf9 Added gitignore generation function (#7402)
Copy gitignore template from client
2018-01-15 21:00:26 +08:00
William Cheng
389344726e
Split CircleCI test into JDK7, JDK8 specified tests (#7405)
* split out circleci pom for jdk7, jdk8

* update circle config to use jdk7 pom
2018-01-15 16:46:33 +08:00
Jinkui Shi
612cfb7af4 [Akka-scala] Clean unused dependencies such swagger-core #7329 (#7329) 2018-01-15 14:14:10 +08:00
Euan Kemp
027df610b1 [Rust] Handle error response statuses (#6865)
* [Rust] Consider error statuscodes to be errors

* [Rust] Introduce 'ApiError' type for 4xx/5xx resp

This updates the previous commit which added an 'ErrorStatus' variant to
an 'ApiError' variant.

It does not specialize the error to the specific possible error
responses yet, rather returning a 'serde_json::Value' for any case.

This will lose any error messages which cannot be parsed as json and
instead return a json-parse error.

A future change should update the generated signatures such that the
returned future's error type is specialized to the specific errors that
may be returned by that api (and possibly a catchall json::Value still).

* [Rust] Regenerate petstore samples

* [Rust] Add error example to petstore sample
2018-01-15 11:38:11 +08:00
wing328
15e7255154 Merge branch 'issue-7044' of https://github.com/joeboyscout04/swagger-codegen into joeboyscout04-issue-7044 2018-01-14 23:41:46 +08:00
wing328
44211c8811 Merge branch '2.4.0' of https://github.com/swagger-api/swagger-codegen into 2.4.0 2018-01-14 23:19:28 +08:00
Carl E Leiby
25a127240a Generated retrofit2 petstore files 2018-01-14 23:18:28 +08:00
Reijhanniel Jearl Campos
3bd2da9a8b [Java] #3204 - Fix build warnings (#7364)
* [Java] #3024 - Add build-helper-maven-plugin version to retrofit client template

* [Java] #3024 - Add build-helper-maven-plugin version to feign client template

* [Java] #3024 - Add build-helper-maven-plugin version to jersey client template

* [Java] #3024 - Add build-helper-maven-plugin version to resteasy client template
2018-01-14 21:13:56 +08:00
wing328
44853c31b6 update rust default user agent to promote swagger codegen 2018-01-14 18:25:04 +08:00
Tristan Bourvon
66be7a7910 [Rust] Add user agent handling for rust template (master) (#7375)
* Add user agent handling for rust template

* Run ./bin/rust-petstore.sh
2018-01-14 18:18:58 +08:00
magnolia
d5c355a596 [Scalatra] Updated the version of Scalatra to the latest (2.6.2) (#7393)
* Updated the version of Scalatra to the latest (2.6.2)

 - Updated Scalatra 2.6.2 (latest)
 - Updated Scala 2.12.4
 - Updated sbt 1.1.0
 - Reduced dependent artifacts to a minimum
 - Cleaned up build.sbt
 - Changed the package name from client to server
 - Set log output (logback)
 - Updated web.xml for servlet 3.1

* rename package 'com.wordnik' -> 'io.swagger'

* Added rolling file appender to logback.xml
2018-01-14 18:11:37 +08:00
Euan Kemp
3029b7b0fb [Rust] Format example with rustfmt (#7339)
This was handled via 'cargo fmt' on the current nightly rust. I also
moved a few lines around and deleted an old comment.
2018-01-14 18:03:12 +08:00
etherealjoy
0bf430a803 Qt5cpp Add support for nested containers (#7340)
* Disable creation of empty json fields and fields for primitives which were not set, but using default values
modelnamePrefix will be the one passed from command line or SWG if none

* Updates after review
Also common http files are splitted
Update Petstore examples

* Small Fixes for cleaning up arrays of arrays/maps

* Changes
- Api Body pass by Reference, avoid seg fault due to deletion of auto constructed object passed as parameter.
- Support Maps and Arrays upto a depth of 2
- Refactor Helpers to handle Maps and simplify code

* Remove size check due to possible incorrect type

* Update PetStore Examples for Qt5 C++ and small fixes for QDate/QDateTime

* Updates after review. Fixes typo and remove usage of auto keyword.

* Restored usage of auto keyword.
2018-01-14 17:47:54 +08:00
Akihito Nakano
809e1f4c93 [PHP] Cleanup tests (#7333)
* Regenerate test/UserApiTest.php

The same implementation as testLoginUser() is in tests/UserApiTest.php

* Delete test/Client/ObjectSerializerTest.php

The same implementation is in tests/ObjectSerializerTest.php

* Update Petstore sample

- bin/php-petstore.sh
- bin/security/php-petstore.sh
2018-01-14 17:47:08 +08:00
Ben Mordue
429b96ae7e [JAVA] equals and hashCode for models with byte[] and binary strings (#7341)
* equals and hashCode methods for POJOs with byte array vars

* Also fix equals and hashCode for binary vars

* Ran script to update samples
2018-01-14 17:39:32 +08:00
wing328
fb73b8c4de update r petstore samples 2018-01-14 17:18:40 +08:00
wing328
97298bdb03 Merge branch '2.4.0' of https://github.com/swagger-api/swagger-codegen into 2.4.0 2018-01-14 17:14:43 +08:00
sneumann
9e06f7063f Fix assignment of new object instance to variable (#7379)
* #7359 Fix - use reflection to instantiate non-generated class (#7360)

* add tests for java vertx petstore

* add swagger example to README.md (#7368)

* Fix assignment of new object instance to variable

Fixes `Error in foobar$fromJSONString(s) : object 'CategoryObject' not found`
Discussion in https://github.com/swagger-api/swagger-codegen/issues/6520#issuecomment-357132746 ,
thanks @wing328 for encouraging.
2018-01-14 17:14:35 +08:00
Euan Kemp
0f6696089f [Go] Use consistent indentation in readme (#7336)
* [Go] Use consistent indentation in readme

* [Go] Regenerate petstore sample
2018-01-14 17:05:18 +08:00
antihax
72abb20f2e [Go] Fix operation files clobbering model files. [2.4.0] (#7337)
* Prevent operation files clobbering model files.

* Update Tests
2018-01-14 17:00:17 +08:00
wing328
73c338be58 Merge remote-tracking branch 'origin/master' into 2.4.0 2018-01-13 15:54:41 +08:00
William Cheng
8aef689d1b
[Java] allow setting boolean getter (is, has, get) in templates (#7344)
* allow setting java boolean getter (is, has, get) in templates

* update msf4j boolean getter

* update jaxrs-spec boolean handler

* update jaxrs boolean getter

* update reasteasy, spring, cxf boolean getter

* update inflector boolean getter

* update java play boolean getter

* update java boolean getter

* update spring samples
2018-01-13 15:19:02 +08:00
SergeyLyakhov
4241b11d97 [Java][jersey2] Fix logging for jersey2 + java6 (#6715). (#7348)
* [Java][jersey2] Fix logging for jersey2 + java6 (#6715).

* Fix formatting according to comments.
2018-01-12 21:16:23 +08:00
Jim Schubert
75c0180c71 [scala] Escape reserved words, support Array[Byte] (#7378)
* [scala] Escape reserved words, support Array[Byte]

Previously, Array[Byte] was compiling to ArrayByte. This provides a type
mapping to output the correct type.

This also escapes reserved words with grave accents, as is most common
in Scala. Escaping with an underscore prefix breaks serialization (in
Jackson, for example) unless templates are modified manually. Escaping
using grave accent should unblock most serializers from requiring
template modifications.

* [scala] Regenerate integration test outputs

* [scala] Regenerate samples

* [scala] Remove unused imports in related codegen files
2018-01-12 21:14:30 +08:00
wing328
50b599719d add tests for java vertx petstore 2018-01-11 16:36:23 +08:00
ccozzolino
247fbd4435 #7359 Fix - use reflection to instantiate non-generated class (#7360) 2018-01-11 16:31:37 +08:00
wing328
3930b5b0a1 Merge remote-tracking branch 'origin/master' into 2.4.0 2018-01-11 13:40:35 +08:00
Jim Schubert
65bda3e7b6 [scala] updates for client default values, required attributes (#7286)
* [scala] Fix default values in scala client

This uses consistent logic for optional types with default values in the
scala client. Also, uses Option(default) instead of Some(default) to
guard against people defining defaultValue = null. Option(null) becomes
None while Some(null) defines a null value explicitly and will break
maplike operations.

* [scala] Regenerate client sample

* [scala] Add missing json4s import, which will be added by another PR but allows current samples to generate

* [scala] Include integration tests for required attributes support

* [scala] Support string types with formats

This adds support for better support of type=string and
format={date,date-time,binary,byte}. Previously, binary and byte were
inconsistently defined as strings rather than byte arrays, while
date/date-time were parsing default values into formats that did not
match OpenAPI/Swagger 2.0 specifications for full-date and date-time.

We may want to consider pulling in json4s-ext to support wider date
formats and moving to date=LocalDate and date-time=ZonedDateTime.

This will have breaking changes for consumers expecting binary/byte to
be strings rather than byte arrays.

* [scala] Unique parameter names in integration test, to avoid seemingly conflicting names

* [scala] Regenerate client sample

* Sort file listings in AssertFile.java

Per File#list() javadocs:

There is no guarantee that the name strings in the resulting array
will appear in any specific order; they are not, in particular,
guaranteed to appear in alphabetical order.

I'm unable to repro directory listing failures on OS X High Sierra or
Ubuntu 16.04 under Parallels, so it's not clear to me if listing order
is indeterminate per-platform or the behavior is just not defined and
up to the platform's installed runtime. Sorting the array of strings
prior to comparison should resolve this issue on every platform/runtime.

* [scala] exclude api tests for integration test gen script

Script should match options in the integration test class

* [scala] Temporarily disable client integration tests

CI doesn't seem to pick up template changes in integration tests.
Disabling scala client integration tests, pending investigation of the
issue.

* [scala] Remove redundant json4s import

* [scala] Regenerate integration test

* [scala] Regenerate sample
2018-01-10 13:24:57 +08:00
Jean-François Côté
ebf4efe3ea Fix issue #6867 : The apiPackage option was ignored (#7316)
* Fix issue #6867 : The apiPackage option is ignored in the template for Java Play Framework.

* use openjdk7 in travis to ensure it works with jdk7
2018-01-10 13:15:49 +08:00
Joseph Elliott
673be4e88f exclude commons package from org.apache.oltu.oauth2 to provide a more long-term fix. 2018-01-08 14:41:57 +01:00
Joseph Elliott
c642d8a89b Roll back oltu_version to 1.0.0 to fix #7044 2018-01-08 14:25:32 +01:00
wing328
16e3226c8a Merge remote-tracking branch 'origin/master' into 2.4.0 2018-01-08 18:01:20 +08:00
Mehdi Jouan
c7f12d6c2d [Spring][Java] fix support of long values for @Max and @Min annotations (#7227)
* add support of long values for @Max and @Min annotations

* run shell scripts for java and spring

* fix import issue after running shell script
2018-01-08 00:22:06 +08:00
William Cheng
f7779c545e
refactor abstract scala codegen (#7334) 2018-01-08 00:20:38 +08:00