Commit Graph

3659 Commits

Author SHA1 Message Date
Erik Timmers
157e6b7fab [angular] Add option to generate tagged unions (#7245)
Using the option `taggedUnions` will create a union type for each parent
type instead of extending interfaces. The union types are tagged by using
the discriminator values.

And also:
* Add support for aliases;
* Add support for read-only properties.
2018-02-01 17:20:50 +08:00
William Cheng
36f69a034d
remove trailing spaces in qt5 c++ templates (#7525) 2018-02-01 13:35:09 +08:00
Jon Schoning
2d0bafb6b2 [haskell-http-client] default InlineMimeTypes=true (#7534)
- default CLI option InlineMimeTypes to True, since it produces cleaner code

- update bounds on dependancies
2018-02-01 12:26:13 +08:00
William Cheng
6b9d38d40a
remove trailing spaces in ada template (#7527) 2018-01-30 14:39:13 +08:00
William Cheng
eb35870d11
remove trailing spaces in r templates (#7526) 2018-01-30 11:02:13 +08:00
wing328
36b042d605 update ts aurelia petstore samples 2018-01-29 16:42:16 +08:00
Konstantin Simon Maria Möllers
7faaa091cd Fix generated module imports in Aurelia APIs (#7465) (#7520) 2018-01-29 15:46:51 +08:00
wing328
cf21ac0327 update spring petstore samples 2018-01-29 01:38:13 +08:00
wing328
6bc84eeee1 add rest-assured to circleci jdk8 test 2018-01-28 22:33:24 +08:00
Victor Orlovsky
6debf749ae [NEW API CLIENT] Rest-assured (#7492)
* Rest-assured http client has been added

ApiClient has been added

@Deprecated has been added for operation

{{{returnType}}} has been fixed

build.gradle.mustache, build.sbt.mustache, api_doc_mustache has been added

Samples has been added for rest-assured

Useless supporting files has been removed for rest-assured

Sample has been added for rest-assured

* Tests has been added

* Doc and tests has been fixed, JSON.mustache moved to common
2018-01-28 22:29:23 +08:00
William Cheng
c69925b53a
[Kotlin] Fix issues with threetenbp (#7516)
* fix kotlin threetenbp client

* fix typo in kotlin sample path
2018-01-28 21:40:22 +08:00
wing328
a811a48c3f minor fix to kotlin client genrator due to merge conflict 2018-01-28 17:18:15 +08:00
Jon Schoning
9fba9c3255 [haskell-http-client] add config options: cabalPackage, cabalVersion, baseModule, requestType, configType (#7515)
- add new config options:

    cabalPackage
      Set the cabal package name, which consists of one or more alphanumeric words separated by hyphens

    cabalVersion
      Set the cabal version number, consisting of a sequence of one or more integers separated by dots

    baseModule
      Set the base module namespace

    requestType
      Set the name of the type used to generate requests

    configType
      Set the name of the type used for configuration
2018-01-28 14:59:04 +08:00
Stephane Carrez
4bd8fc6e8a Fix 7511: [Ada] Client call is not correct with multiple parameters and application/x-www-urlencoded (#7512)
* Fix calling the 'Call' procedure to submit the request for the Ada client when a request
has form parameters

* Rebuild the files by running bin/ada-petstore.sh
2018-01-28 14:54:36 +08:00
micheleISEP
3035bc629b [Ada] Hotfix/ada model sort (#7491)
* Ada generator generates "=>" (correct syntax) instead of "->". Fixes #7450

* Updated the Ada petstore samples

* Committing "VERSION" file and the rest of the petstore samples

* Redone the algorithm to sort the models by their dependencies, to create correct *-model.ads files.

To fix #7485

* changed tabs into spaces
2018-01-28 14:48:51 +08:00
Jean-François Côté
d1933b5fca Fix a problem in the generation of typescript-jquery when we have enum in a query param (#7506) 2018-01-28 14:48:33 +08:00
William Cheng
a2410b210c
Add auto-generated rockspec file to Lua API client (#7475)
* add luarocks spec

* remove trailing spaces

* remove rockspec filename option

* update lua rockspec

* update rockspec based on feedback

* remove configuration which is not needed

* remove api_client, which is no longer needed
2018-01-27 17:09:45 +08:00
wing328
15b3dfbb80 update java petstore samples 2018-01-26 10:02:24 +08:00
Benjamin Roedell
47111b3241 Issue 4824 fix gson deserialize format byte (#7473)
* Build sample prior to code changes so differences are easier to decipher

* Add byte array type adapter for okhttp-gson (java8 only)

* Unit revealed that Gson (or GsonFire) defaults to escape = (equal sign) out of base64 string.  Add disableHtmlEscaping() to gsonbuilder.

* Update specs and samples to include format=byte and include junit test of byte array serialization and deserialization.

* Implement recommendations by @cbornet including: Use okio.ByteString for base64 conversions instead of java 8 lib since the okhttp-gson client already includes okio. Remove setting to disableHtmlEscaping. Rename LocalByteArrayAdapter to ByteArrayAdapter.

* Update spec and sample for java okhttp-gson library client

* Undo addition of profilePhoto property.  A format byte property is already available under the format_test definition.

* Put previously deleted tests back. Modified testFindPetsByTags() to verify exception since the server now returns a 500 for this request.

* Update test to pass when run against docker containerized server swaggerapi/petstore (heads up, this test fails if calling out to the internet published version of http://petstore.swagger.io)
2018-01-26 09:52:49 +08:00
Jens Radtke
76907cacde fix: declare property headerSelector (#7495)
The property was created dynamically, it's a more clean approach to
declare it as a member of the class.
2018-01-26 00:49:35 +08:00
William Cheng
2394fac677
update swagger annoatation version to 1.5.17 (#7500) 2018-01-25 23:29:20 +08:00
William Cheng
df10c725ab
Add lua test script, minor fix to Lua API files (#7490)
* add lua test script, minor fix to api files

* fix model import, avoid null header issue

* add space before equal sign
2018-01-25 22:01:04 +08:00
etondoze
d1a296412e Upgraded swagger-parser and swagger-core versions (#7497) 2018-01-25 21:35:11 +08:00
ehyche
a3d0f1d4bd Swift4: make generated models structs instead of classes (#7345)
* Split up model template into partials

* Change models from class to struct.

This fixes issue https://github.com/swagger-api/swagger-codegen/issues/6941.

In this change, we make our Swift4 generated model objects struct instead of class. However, in order to do this, we needed to handle the following edge cases:

* Inheritance and polymorphism (allOf)
  * With classes, we use inheritance. So therefore, the parent properties are ONLY on the parent generated class, and the model object which derives from the parent class picks up those properties through inheritance.
  * However, structs do not support inheritance. So we simply duplicate the parent allOf properties in the child struct.
* We have to handle the case where the property name on the struct may be different than the property name in the JSON. By default, the Codable protocol assumes that the JSON property name is the same as the struct property name. If they need to be different, then we generate a CodingKeys string enum, which contains the mapping between struct property name and JSON property name.
* additionalProperties. We cannot use the default Codable implementation for the additionalProperties, since it will look for an actual dictionary called "additionalProperties" in the JSON. Therefore, for model objects which have additionalProperties, we must generate our own implementation for the Decodable and Encodable protocols.

I have run ./bin/swift4-all.sh and ./bin/swift4-test.sh to re-generate all of the sources, and I have verified that the generated code in samples/clients/test/swift4/default builds and the unit tests pass.

* Update VERSION in .swagger-codegen

* Update generated code for swift4-test schema
2018-01-25 21:33:11 +08:00
Jeffrey Slort
2b84118c9f removed isomorphic-fetch typing dependency (#6894)
* removed isomorphic-fetch typing dependency
removed postinstall command

* space

* regenerated samples

* updated security samples

* fixed missing url module

* added prepublish hook

* regenerated samples

* added npm build to build
2018-01-25 21:20:58 +08:00
wing328
0b4b25afff update all c# pestore samples 2018-01-25 21:17:57 +08:00
Esteban Marin
20305139b5 [Feature][TypeScript] request param enum as literal unions (#7433)
* #7365: use enums string / number literals for request parameter if it is an enum

* #7365: use enums string / number literals for request parameter if it is an enum

* #7365: use enums string / number literals for request parameter if it is an enum

* #7365: improve docs

* #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion()

* #7365: move code to AbstractTypeScriptClientCodegen, remove redundant code in TypeScriptAngularClientCodegen, change type Object to Number in numericEnumValuesToEnumTypeUnion()

* #7365: allow parameter data type customizations

* #7365: re-enable disabled unit test assertions

* #7365: remove enum handling from type declaration generation

* #7365: generate all typescript samples

* #7365: re-enable disabled unit test assertion
2018-01-25 18:36:14 +08:00
Jörn Ahrens
a5e26a44ff [Dart] - Rework Dart client generator to be flutter-compatible (#7418)
* copy mustache templates from dart generator

* Start with generator by copying the DartClientCodegen for now

* at least we know this is not for a browser..

* First working version for a simple swagger configuration

* remove browserClient parameter, since it doesn't make sense for flutter

* Take care of complex types to support object hierarchies

* add null safety

* add small test for options

* add flutter-petstore scripts

* generate flutter petstore output

* Add new flutter test project

* move generated client to make it usable

* use generated swagger petstore plugin

* add support for lists of objects

* add DateTime support

* fix listFromJson implementation

* fix NPEs in DateTime operations + place order in sample

* Small readme changes

* bugfixes

* Use flutter-compatible implementation as default dart implementation

* fix generated samples

* Make lists serializable, now all dart test cases are working again

* better list implementation

* use StringBuffer

* removed FlutterClientCodegen

* fix browser client

* fix dependencies

* swagger-browser-client for browserClient testcases

* fix scripts

* removed flutter scripts

* add map support and simplify code via using .toJson contract

* remove unneeded devDependencies

* Regenerated samples

* fix call to mapFromJson, it is not a constructor

* remove pointless string serialization

* regenerated dart samples
2018-01-25 18:18:53 +08:00
William Cheng
61e58d6496
Add R namespace file (#7467)
* add r namespace file

* rename NAMESPACE mustache file
2018-01-22 22:32:22 +08:00
micheleISEP
43f0e86923 Ada code generator corrected: "=>" instead of "->". Fixes #7450 (#7456)
* Ada generator generates "=>" (correct syntax) instead of "->". Fixes #7450

* Updated the Ada petstore samples

* Committing "VERSION" file and the rest of the petstore samples
2018-01-22 17:40:34 +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
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
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
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