Commit Graph

6089 Commits

Author SHA1 Message Date
Oliver Hoffmann
20f48b04fc Make efficient use of entrySet iterator. (#7105) 2017-12-08 00:35:11 +08:00
Benjamin Gill
a57fb0c7db [rust-server] add license and description to Cargo.toml (#7080)
* Move errant file to 'rust-server'

Rust2 was the old name

* Add license and description to Cargo.toml

For rust-server, getting them from the swagger

* Valid Java doesn't have uninitialised variables...

* Default license to "Unlicense"

* Set license to "Unlicense" for generated crates
2017-12-08 00:28:29 +08:00
Luciano Jr
da942ab80c Update code style (#7127) 2017-12-08 00:25:28 +08:00
Jinkui Shi
01b6330202 [Scala] [ISSUE-7085] Scala template code format refactor (#7086)
* [Scala] [ISSUE-7085] Scala template code format refactor

* upgrade scala version to 2.11.12 and upgrade dependency version
2017-12-08 00:20:19 +08:00
Akihito Nakano
1ff3b00ac5 [PHP] Add generator version (#7124)
* Add generator version

* Update samples

- bin/php-petstore.sh
- bin/security/php-petstore.sh
2017-12-08 00:02:52 +08:00
Anton Antonov
2d56f247ce Fix typo (#7131) 2017-12-07 23:52:13 +08:00
topce
b0f61f394c fix issue 7048 (#7108) 2017-12-07 23:50:26 +08:00
Max K
e75523a684 [AspNetCore SERVER] Added support for ASP.NET Core 2.0 (#7114)
* Updated to .NET Core 2.0

* Fixed issue with IConfiguration vs. IConfigurationRoot

* Ran bin/aspnetcore-petstore-server.sh

* Updated to .NET Core 2.0

* Fixed issue with IConfiguration vs. IConfigurationRoot

* Ran bin/aspnetcore-petstore-server.sh
2017-12-06 11:02:13 +08:00
Jean-François Côté
40f1de8a58 [Typescript jQuery] Add README.md (#7113)
* Add README.md to the typescript jquery client generator

* Fix from code reviews about the addition of README.md. Made the fix in fetch too since it was a copy paste
2017-12-06 10:34:29 +08:00
Max K
645d71ed3b Operation now returns StatusCode Stubs as well (#7098)
* Operation now returns StatusCode Stubs as well

* Updated mustache file to use comments

return StatusCode(..) is now commented out.

* Change default(..) to not escape the type

default(dataType) --> default(&dataType)

* Return IActionResult no matter what..

* Updated formatting

* Ran bin/aspnetcore-petstore-server.sh
2017-12-05 22:14:00 +08:00
William Cheng
ffa0151445
fix msf4j return type annotation (#7110) 2017-12-05 17:23:04 +08:00
Sridhar-1987
a4fbbb5999 Pass optional as null (#7066)
* Pass optional as null

* Addressing review comments

* Addressing review comments-2

* Addressing review comments-3
2017-12-04 22:18:32 +08:00
Ramzi Maalej
61e706ba6f [Akka-Scala] Add build.sbt to Akka-scala (#7076)
* Add build.sbt to Akka-scala

* Add readme.md and build.sbt to petstore sample
2017-12-01 12:03:10 +08:00
ehyche
76d3cb5002 Swift4: Fix issue 6746 - problem with arrays of primitives (#7072)
* Update samples using latest codegen and templates

* Fix issue 6746 - problem with array models where array element type is a primitive
2017-12-01 10:30:24 +08:00
antihax
831e8d7c87 [Go] Add context to all requests for tracing, logging, cancellations, etc. (#6997)
* Add context to all requests for tracing, logging, cancellations, etc.

* Fix compile error with when call has no parameters.
2017-11-30 00:30:35 +08:00
William Cheng
5994a2fb2d
use {{{mediaType}} instead of {{mediaType}} (#7073) 2017-11-29 16:17:51 +08:00
yelhouti
ce11e035d8 fix spring cloud config variable names (#7068)
remove leading space
2017-11-29 11:05:03 +08:00
Sergey Shoshin
adda792010 #7026 [Swift] tvos support added (#7034) 2017-11-28 12:23:23 +08:00
Tomasz Prus
efe16fda8c [python/tornado] ssl improvements (#7061) 2017-11-28 10:06:29 +08:00
demtnt
dca7a1507b As per documentation https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestPart.html @RequestParam should be used instead of @requestpart if not file. (#6861) 2017-11-27 22:06:37 +08:00
Ben Mordue
02bcc55e23 Do not apply content-type header if no request body (#6648)
* Do not apply content-type header if no request body

* Set content-type header if there are form params

* Add tests

* Run update script

* Regenerated sample clients
2017-11-27 18:33:28 +08:00
Maxim Zinchenko
a8642dbdfc [Java][Spring][Server] Issue #4680 (#6890)
* Issue #4680 correct values for enum with escaped double quotes

* Issue #4680 regenerate samples

* Issue #4680 remove new lines

* Issue #4680 fixed scripts

* Issue #4680 update samples under CentOS
2017-11-27 18:30:39 +08:00
Greg Marzouka
75c2d5ed4c [Scala] Default Option parameters to None (#6538)
* Add sensible defaults for not required params in scala

* Also default to None for async methods
2017-11-27 17:06:28 +08:00
Ramzi Maalej
0c3c4ccf82 Use maven plugin to set required maven version (#7032) 2017-11-27 16:59:14 +08:00
craffael
fc5ec6271a [NancyFx] Fix for issue #7024, date field mapped to ZonedDateTime (#7025)
* add support for async routes/endpoints

you can now set --optional-properties async=true to generate
a nancyfx server stub that uses asynchronous programming.

(cherry picked from commit 126869cb0b967e8063417e11993cf6326ce8ffd4)

* add nancyfx-petstore-server-async.sh to generate sample of async nancyfx.

* Rename async => asyncServer

* update bin/nancyfx-petstore-server-async.sh

* rename async => asyncServer in api.mustache + small bugfix

* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh

* remove additional new line in api.mustache + add space after if

* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh

* Map `date` fields to LocalDate c# type + add a JsonConverter for LocalDate.
2017-11-27 16:46:09 +08:00
Erik Janssen
1b90a05754 [Scala][Finch] Adding security definitions to Finch (#6891)
* #6818: support for security definitions and some refactoring

* adding support for Either

* adding dates with TimeZone (date-time) and Local (date)

* cleanup

* generating code
2017-11-27 16:38:12 +08:00
naelrashdeen
5d59dd10ec [PHP][Symfony] Further enhancements (#7001)
* Further enchancements for PHP-Symfony. Fixes issues described in #6999

* Ran shell script to update petstore sample
2017-11-27 16:25:50 +08:00
Gingonic
a565a94a06 Removed wrong import of StrictJsonDeserializationVisitor (#6948)
* Removed wrong import

* Run samples
2017-11-27 16:16:42 +08:00
Tristan Sloughter
3d3a30a533 [Erlang] erlang client: properly handle optional parameters (#7042)
* erlang client: properly handle optional parameters

* [Erlang Client] handle multiple path params in the same path
2017-11-27 16:11:14 +08:00
topce
8a0de971e4 Remove rxjs operators (#6989)
* do not import rxjs-operators if using HttpClinet

* generate code

* do not import operators if they are not needed
2017-11-24 13:24:46 +08:00
Keni Steward
8eb33f9d1b [Typescript][Angular]Issue #6902 Return Client Response for Angular 4.3 and above with Observe string (#6955)
* Updated swagger-ui wget url to https

* Issue #6902 Add Observe/ReportProgress pass through variables to the response for each api call for angular 4.3 and above

* Issue #6902 Fixed problem where extra comma as generated and should
not have been.

* Issue #6902 Fixed compiltion issue for Angular 4.3
2017-11-24 01:50:07 +08:00
William Cheng
a4531b695e
use python client toOperationId logic (#7035) 2017-11-23 17:41:50 +08:00
Oliver Hoffmann
10107ac7ec Upgrade to resteasy-jackson2-provider (#7017)
* Upgrade to resteasy-jackson2-provider

* Upgrade to resteasy-jackson2-provider
2017-11-23 17:35:49 +08:00
Ramzi Maalej
ebfdc05199 [Akka-Scala] Add readme file (#7027)
* Add readme file

* Add readme file to Scala generator
2017-11-23 16:46:35 +08:00
Ken Geis
5ea3499188 fix swager typo (#7028) 2017-11-23 12:03:52 +08:00
Lukasz Konopski
0f92baeb04 Inheritance support java client okhttp gson (#6636)
* #6636 inheritance support for java client okhttp with gson parser

* #6636 generate samples
2017-11-22 21:28:13 +08:00
Guillermo Pastor
65bb761952 Fix: Resolve problem with UUID class not found if there is almost one parameter with format as uuid (#6617)
* feat: java.util.UUID if parameter is UUID

* solve git problem
2017-11-22 16:54:11 +08:00
François Rosé
acefe3f385 [CppRest] Add Object and fix modelbase includes (#6905)
* Objects are represented by `ModelBase.h`, not `Object.h` which does not exist.

* Use correct relative imports for files in the `model` and `api` folders.

* [CppRest] Update cpprest petstore client sample.

* Implement `Object` class to support arbitrary types.

* [CppRest] Update cpprest petstore client sample.

* [CppRest] Add newly generated files to petstore client sample.

* [CppRest] Add `Object` to CMakeLists.
2017-11-22 12:19:13 +08:00
François Rosé
d9cea0f97e [CppRest] Support optional parameters (#6959)
* Use boost::optional for parameters that are not required.

* Update sample petstore client.
2017-11-22 12:13:05 +08:00
William Cheng
803f337d24
[Scala][Lagom] rename generator from scala-lagom to scala-lagom-server (#7014)
* rename scala-lagom to scala-lagom-server

* add back pom.xml and shell script

* update scala-lagom-server path in circleci pom.xml

* make shell script executable

* rename batch file
2017-11-21 23:24:02 +08:00
William Cheng
573b5518be
[Scala][Lagom] minor enhancements (#7011)
* rename lagom scala, minor enhancements

* add scala lagom to circle ci

* test sala lagom with jdk8 only
2017-11-21 17:34:09 +08:00
gmkumar2005
32abb72769 [LagomScala] Add Scala API generator for lagomframework #6900 (#6901)
* Initial Commit

* Removed unneeded class, Updated names as per naming conventions, Removed licensing info from  generated code

* Moved samples from client folder to server

* Fixed naming issue with scripts in the bin

* improved code format for api

* fixed compile issue and improved formatting

* fixed compile issue and improved formatting
2017-11-21 15:40:04 +08:00
Kenny Jones
63fce58931 [Java][Spring] Resolve serialization warning from RFC3339DateFormat (#6960)
Adds `serialVersionUID` to RFC3339DateFormat.java to avoid Java warning.
2017-11-21 12:14:02 +08:00
Daiki Matsudate
a5e4abe5ec [Swift4]Update templates for swift 4 (#6921)
* update versions of dependencies on swift4 and swift3

* change syntax for swift4

* run petstore script

* change enum case from UpperCamel to lowerCamel

* remove unneeded break statements

* avoid wrapping conditionals in parentheses

* avoid force casting

* run pod update on petstore/swift4/rxswift

* update project for swift 4

* run swift4-petstore-all.sh

* fix compile error

* avoid use iso8601 date strategy for encoder / decoder

* resolve file references
2017-11-21 11:33:52 +08:00
manuc66
b06ccec11e [csharp] Update JsonSubTypes to 1.1.3 and use nuget dependency (#6969)
* the result I want to obtain

* add csharp-petstore-net-40.bat for windows

* just ran bin\windows\csharp-petstore-all.bat

* Removed those directories:
- samples\client\petstore\csharp
- samples\client\petstore\csharp-dotnet2

then ran :
bin\windows\csharp-petstore-all.bat

* - update JsonSubTypes to 1.1.3 by using nuget dependency (the package is compatible with net40)
- allign all version of Newtonsoft.Json to 10.0.3

* the result of bin\windows\csharp-petstore-all.bat

* ran bin\security\windows\csharp-petstore.bat
2017-11-21 11:26:58 +08:00
topce
04ee374328 [TypeScript][Angular] fix problem with strict compilation (#6978)
* fix probelme with strict compilation

* commit generated files
2017-11-21 01:21:45 +08:00
JacC510
181680b0af - fix duplicate problem (#6981)
* - fix duplicate problem

* style guide adjustment

* replace tab with 4-space

* replace tab with 4 -space
2017-11-21 00:42:19 +08:00
Peter Stuart
79bac2ca04 Fix typo. (#6991) 2017-11-18 15:48:02 +08:00
Alex Goldring
9be12f9d03 Removed harmful content-type check (#6977)
https://github.com/swagger-api/swagger-codegen/issues/6226
2017-11-17 23:33:59 +08:00
William Cheng
15bbb52b22
check for dot in path and throw exception if found (#6986) 2017-11-17 20:18:06 +08:00
Tomasz Prus
73cb68ee7b [python] fix tests, tornado ssl fix (#6968)
* fix: non-zero exit code if tests fail

* tests: use local petserver to run tests

* fix: non-zero exit code if tests fail

* tests: use local petserver to run tests

* fix: creating ssl context in old version of Python

* chore: remove unused target from Makefile

* doc: changes from upstream

* fix: tornado client raises NotImplementedError in older version of Python
2017-11-17 17:33:39 +08:00
Shuma Yoshioka
85b0d0ff78 [TypeScript][Node] Resolve errors for strict compile (#6933)
* [TypeScript][Node] Resolve TS7017 error

* Run `bin/typescript-node-petstore-all.sh`

* Run `bin/security/typescript-node.sh`

* Add `strict` option to ts-node config

* Run `bin/typescript-node-petstore-all.sh`

* Fix `strict` option syntax in typescript-node/tsconfig.mustache

* Sync tsconfig.json

* Sync package.json

* Delete typings.json

* Sync tsconfig.json

* Resolve TS2345 error

* Resolve TS2322 in integration-test (Delete non-effective codes)

* Add @types/rewire to test

* Resolve TS7017 errors

* Run `bin/typescript-node-petstore-all.sh`

* Run `bin/security/typescript-node.sh`
2017-11-16 17:00:48 +08:00
Ben Mordue
818ff8f245 Add readTimeout field (#6961) 2017-11-16 16:59:02 +08:00
Jim Schubert
2c9f98ce38 [csharp] clean boolean additional properties 6784 (#6899)
* [csharp] Convert "false" properties to booleans

It appears as though "false" strings in additionalProperties are no
longer treated as false booleans. This may be an issue elsewhere, but a
simple fix is to always explicitly set the boolean value in a generator
class back to the additionalProperties map to convert boolean Strings to
boolean Objects.

* [nancyfx] Clean up async default option handling

* [nancyfx] Include asyncServer=false in sample script

* [csharp] Regenerate samples

* [csharp] Resolve .net 4 generation issues

Some functionality is missing from .NET 4.0, such as IReadonlyDictionary
and Type.GetTypeInfo().

This commit resolves compilation of generated .NET 4.0 code, requiring
no conditional versioning of Newtonsoft.Json.

* [csharp] Regenerate .net 4.0 sample

* [csharp] Resolve .NET 4.0 sample compile

Sample build.sh wasn't accounting for targeting different FCL correctly.
That is, when passing "net40" to the -sdk option, it would use the
default -sdk:4 and -langversion:6. These don't necessarily match with
what is installed on a machine with only .NET 4.0 (which is our targeted
use case here).

To resolve, we need to define another version-specific value for passing
to the mcs -sdk option (see man mcs for details).

This option currently isn't overridable in the client codegen class.
Also, langversion is set specifically to the version of C# available to
the targeted SDK version. If there is need, we may extend this to
something like:

langversion=${MCS_LANG_VERSION:-6}

To allow users to run as:

   env MCS_LANG_VERSION=5 sh build.sh

I haven't done this because I doubt there's much of a use case via this
script. I'm assuming most consumers will build via IDE or MSBuild.

* [csharp] Revert bin/csharp-petstore.sh to 3.5

* [csharp] Regenerate .NET 3.5 sample

* [csharp] Resolve nuget issue with existing files

* [csharp] Update -all.sh, regenerate samples
2017-11-15 22:36:37 +08:00
Atanas Bozhkov
970de01bdf [Swift4] Add throw to reserved words (#6952)
* * Added `throw` to Swift4 Reserved words.

* * Regenerating Swift4 Petstore project
2017-11-15 21:45:30 +08:00
William Cheng
744c7d904a
remove spaces, empty lines from qt5cpp client (#6956) 2017-11-14 23:28:06 +08:00
Charles Capps
47f1865e69 [Java][google-api-client] Fix minor bugs in google api client (#6951)
* Fix minor bugs in google-api-client templates

* Update samples
2017-11-14 12:02:59 +08:00
Keni Steward
d719daab22 Updated swagger-ui wget url to https (#6954) 2017-11-14 11:24:50 +08:00
James Schubert
64fafb5db3 [all] sys props in CodegenConstants 2017-11-13 21:56:42 -05:00
James Schubert
a0d5079bce Merge branch 'master' into csharp-enum-cleanup
* master: (101 commits)
  [Swift4] Allow for custom dateformatter to be used (#6672)
  [haskell-http-client] fix bug when generating models-only (#6931)
  fix typo: crediential => credential
  minor typo fix
  [csharp] fix enum serialization of first value (#6873)
  [PHP] Improve docs and README (#6935)
  Binary mode for file deserialization in python (#6936)
  add python tornado test to travis
  [Python/tornado] add integration tests and fix bugs (#6925)
  Fix PHP passes response body to ApiException (#6923)
  [TypeScript][Node] Resolve TS2532 error (#6932)
  skip "all" shell script
  minor formatting change
  Fixes Issue #6841, Map for accessing additionalProperties is generated. (#6886)
  add tsloughter as owner erlang
  WIP: initial commit for Erlang client generator (#6502)
  add back php client test
  Switch Travis image from MacOS to Linux (#6937)
  add link to ebook
  [Scala] Default case class Option types to None for non-required fields (#6790)
  ...
2017-11-13 21:46:40 -05:00
Dawid van Graan
5af788cb9f [Swift4] Allow for custom dateformatter to be used (#6672)
* Add a custom dateformat to be set

* Samples updated

* Update CodableHelper.swift

Change to correct format: decoder.dataDecodingStrategy = .base64

* Update CodableHelper.mustache

Add `decoder.dataDecodingStrategy = .base64` back

* Update CodableHelper.swift

Fix `decoder.dataDecodingStrategy = .base64`

* Update CodableHelper.swift

Fix `decoder.dataDecodingStrategy = .base64`
2017-11-13 22:15:43 +08:00
Jon Schoning
b3133a2d74 [haskell-http-client] fix bug when generating models-only (#6931) 2017-11-13 20:44:46 +08:00
wing328
473dfded21 fix typo: crediential => credential 2017-11-13 18:42:23 +08:00
Jim Schubert
28e2fcee78 [csharp] fix enum serialization of first value (#6873)
* [csharp] Treat enum models consistently

C# works differently from most languages in that enums are not
considered objects. This means default(EnumType) will choose a default
of the first enum option. This isn't desirable because it breaks the
required = false functionality of swagger specs, which defines a
property which isn't required to exist in the message body.

Rather than force consumers to use enum values such as UNSPECIFIED, UNKNOWN,
NOT_SET, etc... we can treat enums as primitives. This means any
non-required enum will become Nullable<EnumType> regardless of whether
it is defined as an inline enum or a referenced enum model.

* Categorizing C# integration test for enums as general

* [csharp] Remove enum-ref integration test

* [csharp] Clean up general enum support integration test, validate different enum usage cases.

* [csharp][all] Assign one-based int to string enums

The EmitDefaultValue=false for string based enums will prevent the first
enum value from being serialized, because as 0 it is considered the
default.

This commit assigns an explicit numerical value to all non-integer
enums. This assignment has no effect on the
serialization/deserialization values, and only assigns the compiled
integer.

NOTE: This will have an effect of requiring recompilation of any code
that references the client/server models. This is because:

    public enum Pet { Available }

Source files referencing Pet.Available as defined above will have a
constant 0 in place of the enum value.

    public enum Pet { Available = 1 }

Source files referencing Pet.Available as defined above will have a
constant 1 in place of the enum value.

After compilation, Pet.Available in both instances lose their semantic
values and refer to the byte representation of their integral values.

For more info, see
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/enum
2017-11-13 16:02:03 +08:00
Akihito Nakano
9ca9887de4 [PHP] Improve docs and README (#6935)
* Fix wrong client class, add details about client

* Improve example for Configuration

* camelcase

* Improve README like api doc

* Update samples
2017-11-13 13:56:45 +08:00
Gabriele Bonetti
62444a7aaf Binary mode for file deserialization in python (#6936)
* use wb mode in file deserialization

* add auto generated files from security/python-petstore.sh
2017-11-13 12:50:10 +08:00
Tomasz Prus
4e967e696c [Python/tornado] add integration tests and fix bugs (#6925)
* tests: add integration test for python-tornado

* [python-tornado-client] tests: increase timeout for test_upload_file

* [python-tornado-client] fix: tornado client passes tests
2017-11-13 12:03:55 +08:00
Alexandre Demode
63d28cf75b Fix PHP passes response body to ApiException (#6923) 2017-11-13 11:30:46 +08:00
Shuma Yoshioka
053061ec9f [TypeScript][Node] Resolve TS2532 error (#6932)
* [TypeScript][Node] Resolve TS2532 error

* Run `bin/typescript-node-petstore-all.sh`

* Run `bin/security/typescript-node.sh`
2017-11-13 11:23:56 +08:00
wing328
2ef65d1488 Merge branch 'master' of https://github.com/swagger-api/swagger-codegen 2017-11-12 22:23:30 +08:00
wing328
444a05ce21 minor formatting change 2017-11-12 22:21:54 +08:00
etherealjoy
ca58053339 Fixes Issue #6841, Map for accessing additionalProperties is generated. (#6886)
The issue #6884 is still present and requires fixing outside of mustache file as well.
2017-11-12 22:16:26 +08:00
Tristan Sloughter
b9651e5775 WIP: initial commit for Erlang client generator (#6502)
* WIP: initial commit for Erlang client generator

* add models types and function type specs

* fix type specs when models are the type and support QS lists

* make method lowercase in postprocessoperations

* add model encode function

* add erlang client sample

* add windows client sample script

* proper return type spec and handle return error messages
2017-11-12 22:02:05 +08:00
Greg Marzouka
f921f4f4da [Scala] Default case class Option types to None for non-required fields (#6790)
* [Scala] Default case class Option types to None

* Update Petstore sample
2017-11-10 15:57:40 +08:00
Gustavo Paz
b404dafa02 Issue 6694 2.3.0 (#6845)
* The get method template is modified to return the value of the enum instead of the enum itself.

* Update of the Petstore CXF server sample

* Update of the Petstore CXF client sample

* Update of the Petstore CXF server annotated base path sample

* Update of the Petstore CXF server non spring application sample
2017-11-10 15:32:05 +08:00
Andrew Norman
372a08763d adding "Read Timeout" getters and setters for the Jersey and OkHttp (#6853)
* adding "Read Timeout" getters and setters for the Jersey and OkHttp
based ApiClients

adding "Write Timeout" getters and setters for the OkHttp based
ApiClient

adding tests for the OkHttpClient covering the new getters and setters

* generated files from the bin scripts
2017-11-10 12:12:40 +08:00
afrolovsky
9a44512d03 @JsonProperty annotation for jaxrs-spec server model classes (#6911) (#6916) 2017-11-09 21:46:26 +08:00
François Rosé
485b186129 [CppRest] Unique header guards (#6904)
* [CppRest] Generate unique header guards based on the package names.

* [CppRest] Update cpprest petstore client sample.
2017-11-09 17:59:45 +08:00
François Rosé
7a83081f18 [CppRest] Remove U macro (#6903)
* [CppRest] Replace U macro with conversion function for default string values.

* [CppRest] Replace U macro with conversion function in templates.

* [CppRest] Update cpprest petstore client sample.
2017-11-09 17:58:21 +08:00
Jim Schubert
92ac1edd78 [csharp] Treat enum models consistently (#6851)
* [csharp] Treat enum models consistently

C# works differently from most languages in that enums are not
considered objects. This means default(EnumType) will choose a default
of the first enum option. This isn't desirable because it breaks the
required = false functionality of swagger specs, which defines a
property which isn't required to exist in the message body.

Rather than force consumers to use enum values such as UNSPECIFIED, UNKNOWN,
NOT_SET, etc... we can treat enums as primitives. This means any
non-required enum will become Nullable<EnumType> regardless of whether
it is defined as an inline enum or a referenced enum model.

* Categorizing C# integration test for enums as general

* [csharp] Remove enum-ref integration test

* [csharp] Clean up general enum support integration test, validate different enum usage cases.
2017-11-09 17:14:47 +08:00
wing328
8b251555ac update php symfony petstore, remove spaces in empty line 2017-11-09 16:36:25 +08:00
cydrickn
fbc28797d1 [PHP][Symfony] Update Controller.mustache (#6842)
* Update Controller.mustache

* Use debug instead of environment
2017-11-09 16:29:41 +08:00
Jinkui Shi
92a1c3a449 [issue-6860] fix NPE of Could not generate api (#6868) 2017-11-07 15:46:20 +08:00
James Schubert
018c8d3ece Remove unused imports 2017-11-06 21:12:56 -05:00
Keni Steward
39a9c5587f [Typescript][Node] Fixes inccorect enum generation for enumsMap when Array<Enum> is defined fixes part of Issue #5681 (#6862) 2017-11-07 01:19:58 +08:00
Keni Steward
626fa7531b [TypeScript][Angular] Attempts to fix issues that causes enums that are not generated with a class to not generate correctly (#6833)
* Attempts to fix issues that causes enums that are not generated with a class to not generate correctly

* Fixed issue with incorrectly generating enums
2017-11-05 16:34:24 +08:00
Jeffrey Slort
cf813f5c8e Feature/replace isomorphic fetch with portable fetch (#6739)
* Replaced isomorphic fetch with portable fetch

* Ran scripts in bin

* reference custom.d.ts in api.ts

* ran scripts and added custom.d.ts files to git

* Ran scripts in bin after merge

* regenerated security tests
2017-11-05 15:37:54 +08:00
wing328
2bce479c1c
minor code format enhancement to ts angualr (#6888) 2017-11-05 12:05:45 +08:00
wing328
37184a1cd8
Minor fix to body parameter in required parameter list (#6885)
* minor fix to required parameter list

* better if then else block
2017-11-05 10:22:36 +08:00
James Schubert
1058728777 [csharp] Clean up ref/inner enum struture
Enums defines as ref models have a different object structure
(CodegenModel) than those defined as inner enums (CodegenProperty). To
make these look as similar as possible, we walk all ref model enums and
reassign enumVars with the same properties inherited from the top level
CodegenProperty so CodegenModel enums can use the same templates as
inner enums.
2017-11-04 17:22:23 -04:00
Jon Schoning
cd1c2b13e3 [haskell-http-client] refactor & promote accept mimetype to request; simplify templates (#6866)
* add AuthMethodException

* rename cli prop

* simplify templates
2017-11-05 01:41:53 +08:00
Meindert Deen
a5586044cd Implemented fix for #6006. Mime-type support (#6751)
* Implemented fix for #6006. Mime-type support for accepts and
content-type.

* Review comments of @macjohnny incorporated

* merge with latest and retest

* merge with latest and retest. Now correctly generated with new Maven build
2017-11-05 00:26:42 +08:00
Kenny Jones
b6699f6068 [python] Convert unicode to six.u (#6881)
`unicode` does not exist in py3, therefore since six is already imported
switch to using `six.u` so that `unicode` is used on py2 and `str` is used
on py3.
2017-11-04 23:24:51 +08:00
Jim Schubert
7b269eaf4a Kotlin sanitize model names 6864 (#6874)
* [kotlin] better sanitize model names

* [kotlin] Regenerate samples
2017-11-04 23:23:08 +08:00
stkrwork
659e64206a - Updated cpp generators to name boolean getter functions with an is at the beginning (ex. isActive) (#6880) 2017-11-04 22:04:38 +08:00
Giulio Pulina
4dafa5b92a Updated version (2.2.3) in swagger-codegen-maven-plugin example in README (#6876) 2017-11-03 22:08:30 +08:00
Charles Capps
c2eb53ab1d [Java] Templates to support google-api-client library (#6838)
* Add support for the google-api-client

* When there's no return type, just return (no parsing the response)

* Update the deserialization to use a Jackson typeref.

* Delete the auth mustache files as we don't need them

* Stop generating unneeded auth files; get SBT/gradle working with the generated module

* Add builder-style methods to the google-api-client ApiClient for getting API instances

* Update the README to reflect the new client library option

* Generated overloaded methods to send query params as a Map<String, Object>

* Add files for Sample codes

* Add type in angle brackets to support Java 6

* Required query params must be added to the Map of params. Update sample code.

* Use explicit types instead of diamonds to support Java6 in one more place.

* Clean up javadoc warnings in generated code / remove pointless return statements

* Clean up extra newlines in generated code
2017-11-03 18:46:07 +08:00
Jim Schubert
0ee46c32a2 [all] Better error message for missing libraries (#6856) 2017-11-02 17:55:42 +08:00
Jean-François Côté
16373b9f70 Fix the fake endpoint example. Now all cases are handled by the java play framework! (#6850) 2017-11-02 17:54:34 +08:00
Jim Schubert
e7594c42d0 [kotlin] Nested enum naming fix, and naming options via CLI (#6858)
* [kotlin] Nested enum naming fix, and naming options via CLI

* [kotlin] Add option test for enum property naming

* [kotlin] Escape all reserved/keywords for enums
2017-11-02 17:35:11 +08:00
Erik Timmers
980dd7c6ab Add TypeScript default value mappers (#6828)
Fixes #6765.
2017-11-02 17:16:30 +08:00
Akihito Nakano
e8635632a4 [PHP] Fix #6770: Debug flag is not passed (#6808)
* Add testcase which reproduces issue #6770

* Pass debug option if needed

* Update samples

* bin/php-petstore.sh
* bin/security/php-petstore.sh

* Api throws exception when failed to open debug file

* Pass debug option if needed (Async)

* Extract instance method

* Update samples

* bin/php-petstore.sh
* bin/security/php-petstore.sh
2017-11-02 17:14:00 +08:00
Kenny Jones
74f70a1924 [python-client] Modify python templates to resolve linting errors (#6839)
The linting results for the generated samples are as follows
where the first number is the BEFORE and the second is AFTER.

pyclient            7714 vs. 120
pyclient3           7717 vs. 120
pyclient3-asyncio   7584 vs. 120
pyclient-tornado    7633 vs. 120
pyclient3-tornado   7633 vs. 120

For the complete details please see the following gist.
https://gist.github.com/kenjones-cisco/2eb69a7e8db75e9fd53789f01570d9f2

Enforces linting for python clients by running flake8 for the generated
python client.
2017-11-02 00:47:14 +08:00
wing328
eba4affbb4 fix async option in C# nancyfx generator 2017-11-01 22:52:16 +08:00
craffael
8fec429158 [NancyFx] Support Async (#6755)
* add support for async routes/endpoints

you can now set --optional-properties async=true to generate
a nancyfx server stub that uses asynchronous programming.

(cherry picked from commit 126869cb0b967e8063417e11993cf6326ce8ffd4)

* add nancyfx-petstore-server-async.sh to generate sample of async nancyfx.

* Rename async => asyncServer

* update bin/nancyfx-petstore-server-async.sh

* rename async => asyncServer in api.mustache + small bugfix

* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh

* remove additional new line in api.mustache + add space after if

* run ./bin/nancyfx-petstore-server.sh and ./bin/nancyfx-petstore-server-async.sh
2017-11-01 22:50:49 +08:00
Euan Kemp
c97b63d2bb [Rust] Implement 'object' type conversion (#6846)
* [Rust] Use serde Value for objects

This hopefully fixes the previous TODO; it at least fixes compilation
errors for the specific swagger model I'm working with.

* [Rust] Update Cargo.toml to specify versions

Letting the version float freely is scary, to say the least.

This gives it a better chance at being future-proof.

When the crate author had a recommended selector I picked that,
otherwise I went semver compatible.

* [Rust] Regenerate the example
2017-11-01 22:00:56 +08:00
Renaud Amar
9272b3e768 [Ruby] Fix "build_from_hash" function for Ruby enums (#6812)
* Modify build_from_hash to compare value against enum's value rather than const name

* Updated Petstore sample
2017-11-01 21:47:22 +08:00
James Schubert
72b9ab6cab [csharp] Clean up general enum support integration test, validate different enum usage cases. 2017-10-31 14:37:12 -04:00
James Schubert
8be610b9a4 [csharp] Remove enum-ref integration test 2017-10-31 12:49:50 -04:00
James Schubert
08c8773b50 Categorizing C# integration test for enums as general 2017-10-31 12:48:29 -04:00
James Schubert
7b5e5c8289 [csharp] Treat enum models consistently
C# works differently from most languages in that enums are not
considered objects. This means default(EnumType) will choose a default
of the first enum option. This isn't desirable because it breaks the
required = false functionality of swagger specs, which defines a
property which isn't required to exist in the message body.

Rather than force consumers to use enum values such as UNSPECIFIED, UNKNOWN,
NOT_SET, etc... we can treat enums as primitives. This means any
non-required enum will become Nullable<EnumType> regardless of whether
it is defined as an inline enum or a referenced enum model.
2017-10-30 15:48:18 -04:00
ehyche
95ef1bf62e Swift3: properly percent-escape path parameters (#6705)
* Add addiitional files from upstream

* Remove mis-added files

* Swift3: Properly percent-escape path parameters

This change fixes the following issue:

https://github.com/swagger-api/swagger-codegen/issues/6400

The problem was that path parameters were not properly percent-escaped before being placed into the URL path. This leads to creation of an invalid URL, which then fails.

So therefore, in the API template where path parameters are handled, we propertly percent escape them, using the characters which are allowed in URL paths.

In addition to this template change, then this PR includes the following changes:

1. Resulting changes in all generated code due to the above template change.
2. I added the objcCompatible run to the swift3-petstore-all.sh so that I could re-generated all of the generated code with a single script.
3. I added a unit test in UserAPITests.swift which verifies that paths are properly escaped.
4. In order to make the unit test work, then I needed access to RequestBuilder<T>.URLString to verify that the path was properly escaped. However, RequestBuilder<T>.URLString had "internal" access control so it was inaccessible from the unit test. So therefore, I made four contants in RequestBuilder<T> to be public. This should not harm anything, since they are constants ("let's") and cannot be changed from the outside of the class after initialization.
5. There were also some stray changes which look like they were caused by having not run bin/swift3-petstore-all.sh in a while.
2017-10-30 15:40:00 +08:00
niku
bc302f7151 [Elixir Client]Improve elixir client typings (#6821)
* [Elixir Client] Update the sample

It just executes
% bin/elixir-petstore.sh
without any code changes.
It have been affected by updating the sample swagger specification of 07b408a44a

* [Elixir Client] Fix typings in RequestBuilder

Fix following dialyzer warnings in the sample:

```
lib/swagger_petstore/api/another_fake.ex:30: Function test_special_tags/2 has no local return
lib/swagger_petstore/api/another_fake.ex:30: Function test_special_tags/3 has no local return
lib/swagger_petstore/api/another_fake.ex:32: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'patch') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:29: Function fake_outer_boolean_serialize/1 has no local return
lib/swagger_petstore/api/fake.ex:29: Function fake_outer_boolean_serialize/2 has no local return
lib/swagger_petstore/api/fake.ex:34: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:57: Function fake_outer_composite_serialize/1 has no local return
lib/swagger_petstore/api/fake.ex:57: Function fake_outer_composite_serialize/2 has no local return
lib/swagger_petstore/api/fake.ex:62: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:85: Function fake_outer_number_serialize/1 has no local return
lib/swagger_petstore/api/fake.ex:85: Function fake_outer_number_serialize/2 has no local return
lib/swagger_petstore/api/fake.ex:90: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:113: Function fake_outer_string_serialize/1 has no local return
lib/swagger_petstore/api/fake.ex:113: Function fake_outer_string_serialize/2 has no local return
lib/swagger_petstore/api/fake.ex:118: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:142: Function test_client_model/2 has no local return
lib/swagger_petstore/api/fake.ex:142: Function test_client_model/3 has no local return
lib/swagger_petstore/api/fake.ex:144: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'patch') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:181: Function test_endpoint_parameters/5 has no local return
lib/swagger_petstore/api/fake.ex:181: Function test_endpoint_parameters/6 has no local return
lib/swagger_petstore/api/fake.ex:195: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:230: Function test_enum_parameters/1 has no local return
lib/swagger_petstore/api/fake.ex:230: Function test_enum_parameters/2 has no local return
lib/swagger_petstore/api/fake.ex:242: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:266: Function test_inline_additional_properties/2 has no local return
lib/swagger_petstore/api/fake.ex:266: Function test_inline_additional_properties/3 has no local return
lib/swagger_petstore/api/fake.ex:268: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake.ex:293: Function test_json_form_data/3 has no local return
lib/swagger_petstore/api/fake.ex:293: Function test_json_form_data/4 has no local return
lib/swagger_petstore/api/fake.ex:295: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/fake_classname_tags123.ex:29: Function test_classname/2 has no local return
lib/swagger_petstore/api/fake_classname_tags123.ex:29: Function test_classname/3 has no local return
lib/swagger_petstore/api/fake_classname_tags123.ex:31: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'patch') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:30: Function add_pet/2 has no local return
lib/swagger_petstore/api/pet.ex:30: Function add_pet/3 has no local return
lib/swagger_petstore/api/pet.ex:32: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:57: Function delete_pet/2 has no local return
lib/swagger_petstore/api/pet.ex:57: Function delete_pet/3 has no local return
lib/swagger_petstore/api/pet.ex:62: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'delete') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:86: Function find_pets_by_status/2 has no local return
lib/swagger_petstore/api/pet.ex:86: Function find_pets_by_status/3 has no local return
lib/swagger_petstore/api/pet.ex:88: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:112: Function find_pets_by_tags/2 has no local return
lib/swagger_petstore/api/pet.ex:112: Function find_pets_by_tags/3 has no local return
lib/swagger_petstore/api/pet.ex:114: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:138: Function get_pet_by_id/2 has no local return
lib/swagger_petstore/api/pet.ex:138: Function get_pet_by_id/3 has no local return
lib/swagger_petstore/api/pet.ex:140: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:163: Function update_pet/2 has no local return
lib/swagger_petstore/api/pet.ex:163: Function update_pet/3 has no local return
lib/swagger_petstore/api/pet.ex:165: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'put') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:191: Function update_pet_with_form/2 has no local return
lib/swagger_petstore/api/pet.ex:191: Function update_pet_with_form/3 has no local return
lib/swagger_petstore/api/pet.ex:197: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/pet.ex:223: Function upload_file/2 has no local return
lib/swagger_petstore/api/pet.ex:223: Function upload_file/3 has no local return
lib/swagger_petstore/api/pet.ex:229: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/store.ex:30: Function delete_order/2 has no local return
lib/swagger_petstore/api/store.ex:30: Function delete_order/3 has no local return
lib/swagger_petstore/api/store.ex:32: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'delete') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/store.ex:54: Function get_inventory/1 has no local return
lib/swagger_petstore/api/store.ex:54: Function get_inventory/2 has no local return
lib/swagger_petstore/api/store.ex:56: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/store.ex:79: Function get_order_by_id/2 has no local return
lib/swagger_petstore/api/store.ex:79: Function get_order_by_id/3 has no local return
lib/swagger_petstore/api/store.ex:81: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/store.ex:104: Function place_order/2 has no local return
lib/swagger_petstore/api/store.ex:104: Function place_order/3 has no local return
lib/swagger_petstore/api/store.ex:106: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:30: Function create_user/2 has no local return
lib/swagger_petstore/api/user.ex:30: Function create_user/3 has no local return
lib/swagger_petstore/api/user.ex:32: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:56: Function create_users_with_array_input/2 has no local return
lib/swagger_petstore/api/user.ex:56: Function create_users_with_array_input/3 has no local return
lib/swagger_petstore/api/user.ex:58: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:82: Function create_users_with_list_input/2 has no local return
lib/swagger_petstore/api/user.ex:82: Function create_users_with_list_input/3 has no local return
lib/swagger_petstore/api/user.ex:84: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'post') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:108: Function delete_user/2 has no local return
lib/swagger_petstore/api/user.ex:108: Function delete_user/3 has no local return
lib/swagger_petstore/api/user.ex:110: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'delete') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:133: Function get_user_by_name/2 has no local return
lib/swagger_petstore/api/user.ex:133: Function get_user_by_name/3 has no local return
lib/swagger_petstore/api/user.ex:135: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:159: Function login_user/3 has no local return
lib/swagger_petstore/api/user.ex:159: Function login_user/4 has no local return
lib/swagger_petstore/api/user.ex:161: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:185: Function logout_user/1 has no local return
lib/swagger_petstore/api/user.ex:185: Function logout_user/2 has no local return
lib/swagger_petstore/api/user.ex:187: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'get') breaks the contract (map(),'Elixir.String':t()) -> map()
lib/swagger_petstore/api/user.ex:211: Function update_user/3 has no local return
lib/swagger_petstore/api/user.ex:211: Function update_user/4 has no local return
lib/swagger_petstore/api/user.ex:213: The call 'Elixir.SwaggerPetstore.RequestBuilder':method(#{},'put') breaks the contract (map(),'Elixir.String':t()) -> map()
```
2017-10-29 00:46:07 +08:00
Jon Schoning
4fc52c5524 [haskell-http-client] add support for enums (#6803)
* support enums for models and operation parameters

* add generateEnums cli option (default: true)

* bump stack resolver: lts-9.10
2017-10-29 00:45:13 +08:00
wing328
b259f3bb8b remove newline from query parameter template (resteasy) 2017-10-27 23:13:43 +08:00
Andrea Formica
c566963268 Topic resteasy queryparams defaultvalue (#6726)
* Correct default value for resteasy query parameters

* clean up: add default value in query params for resteasy mustache templates
.

* clean up

* add space following wing328 recommandation.
2017-10-27 23:12:29 +08:00
Jean-François Côté
18ba90f5ac [JavaPlayFramework] Add parameters for beanValidation in the application.conf + fix bugs (#6794)
* Add configuration to split input and output bean validations. When useBeanValidation is used, the variable are created in the application.conf file and can be tweaked by environment. For example, dev and stage can have true to both but only have input in prod.

* Refactor of mustache tags for more clarity

* sample generation with refactor

* Fix a couple of bugs with the fake-endpoint yaml but there is still 2 cases where it doesn't work.
2017-10-27 22:48:27 +08:00
wing328
cab4fc0fed add support for csharp net40 (#6792) 2017-10-27 22:47:02 +08:00
Christophe Bornet
fe2ed67f20 Remove Accept request header from api signature (#6704)
* Remove Accept request header from api signature

* Inject HttpServletRequest to get request header and clean templates

* Use constructor injection for HttpServletRequest

* Implement example in default controller responses
2017-10-27 22:45:30 +08:00
Giulio Pulina
f14e07280a Fix #6391. Avoid Retrofit crashing because of @Path params defined after @Query params (#6796) 2017-10-27 22:35:01 +08:00
Kenny Jones
28d14e34c4 [python-flask] Apply template tweaks to improve lint results (#6826)
The linting results for the generated samples are as follows
where the first number is the BEFORE and the second is AFTER.

flaskConnexion          1843 vs. 20
flaskConnexion-python2  1841 vs. 19

For the complete details please see the following gist.
https://gist.github.com/kenjones-cisco/edc9d71ef7fd2bf23714ecbb693d52b3
2017-10-27 22:18:14 +08:00
korkut89
f472b623f0 Fix RefProperty bug for flattening MapProperty's inner properties. (#6823) 2017-10-26 23:55:00 +08:00
Kenny Jones
54b670b7e0 [python-flask] Create main function and entrypoint (#6814)
Enable the creation of the entrypoint so that the server can be started
using a named command instead of needing to always use `python -m` to
run the server.
2017-10-26 20:38:30 +08:00
Stephan E
f78d958ec0 Fix ruby model generation with objects and additionalProperties (#6816)
* Fix model generation with objects and additionalProperties

* Generate Ruby Petstore

* Generate Ruby Security Petstore
2017-10-26 19:59:38 +08:00
Keni Steward
4f3c86aa14 Adding forRoot instead of forConfig and forcing only 1 instantiation of the ApiModule (#6775)
* Added forRoot and constructure duplicate check

* added imports

* updated providers display format

* updated examples

* Moved providers so users don't hav eto use forRoot if they don't want.

* Updated the readme
2017-10-26 17:57:30 +08:00
Jérémie Fraudeau
681b1c20ea [Scala][Finch] Fix interpretation of queryParams and headers (#6809)
* [Scala][Finch] Fix interpretation of queryParams and headers

* [Scala][Finch] Updates the sample for Finch generated server
2017-10-26 16:44:06 +08:00
wing328
6814530d69 fix enum in path parameter (spring) (#6810) 2017-10-25 22:30:36 +08:00
Asad Saeeduddin
49974c51bd Change return type from any -> Response (#6774)
* Leftover updates to sample file

* Change return type any -> Response

* Update samples
2017-10-25 12:34:37 +08:00
Halil İbrahim Şener
f42a4a51dd [javascript] Use babel-preset-env instead of es2015 and upgrade babel-cli and babel-core (#6799) 2017-10-25 11:12:41 +08:00
Brian Kim
044bfdac39 Fix #6166 by adding @Deprecated annotations in Java jersey2, okhttp-gson, resteasy libraries (#6801) 2017-10-25 11:10:03 +08:00
Dimitar Ivanov
ab338f8cb9 Erlang-server: fix dialyzer; fix min and max checks (#6752) 2017-10-25 10:57:53 +08:00
Esteban Marin
f4ac6feae2 Bugfix/6727 import http client module (#6757)
* [angular-typescript] imports HttpClientModule

HttpModule has no effect, since the new `HttpClient` is now used. fixes #6727

* #6727: import http client module or http module, depending on setting

* #6727: import http client module or http module, depending on setting

* #6727: generate samples
2017-10-25 10:53:20 +08:00
Esteban Marin
66cbab1947 Bugfix/6649 angular http client empty body (#6754)
* fix empty body issue

* #6649: add line break

* #6649: improve indentation

* #6649: improve indentation

* #6649: generate code

* #6649: generate samples

* #6649: fix method docs
2017-10-24 22:51:58 +08:00
korkut89
1f9dc4dd2e Fix required bug (#6733)
flatten methods replaces original ObjectProperty objects with new
RefProperty objects which required variables are false as default.
Newly created objects' required variables are set as the original
property.
2017-10-24 11:34:24 +08:00
wing328
698149573d fix r body parameter null issue (#6786) 2017-10-24 10:45:25 +08:00
Keni Steward
f7471add70 Fixed spacing in model.mustache (#6788)
* Added v4/v4.3 to typescript-angular-petsotre-all and renamed from angular2 to angular

* refactored typescript-angular-petstore-all.sh

* changed profile id for typescript-angularjs to properly have angularjs instead of just angular.

* Spacing at end of model template

* Corrected backwards compatible enum typing
2017-10-24 10:42:03 +08:00
naelrashdeen
b034e4446a [PHP][Symfony] Enhancements (#6615)
* Removed commented code

* Input validation is now supported as strict JSON validation

* [PHP][Symfony] Improve the implementation
Closes #6614

* Generated code is tested to assure it compiles and updated README to dynamically load dependencies via composer

* Updated shell script because shippable tests were failing
2017-10-23 22:50:56 +08:00
Steve Harrigan
a63e3f14f5 [TypeScript-Angular] Path URI Encoding Update (#6769)
* Replaced the method for updating path to prep for URL encoding.
The new method will switch TypeScript-Angular variables from snake_case to camelCase in the URL generation.

Imported StringBuffer, Matcher, and Pattern, since the new solution needs them.
Some extra whitespace on blank lines was removed.

* Since these were not up to date with the current master, I ran them and am commiting them here.
This way, the changes are shown here instead of after future commits.

* Simplified the code for the path conversion A LOT.
New version is much simpler to follow, and very efficient - only one iteration through the length of the string.
Removed regex Matcher and Pattern classes, since they weren't needed anymore.
2017-10-23 21:40:50 +08:00
Edward Wells
c6b6249f1c Fixed Python client docstrings (#6780)
* Updated api_client and configuration docstrings

ApiClient: Removed host param, added configuration and cookie param

Configuration: Docstrings are only read from the @property decorated
function, not the setter, moved the more descriptive docstrings from the
setters to property functions

* Ran bin/python-petstore.sh
2017-10-23 18:44:37 +08:00
Gustavo Paz
7cbd36e75b [Java][JAXRS-CXF] Improve API documentation in the CXF Server stub and Client generation (#6708)
* Inclusion of API documentation in CXF Server stub generation

* Inclusion of API documentation in CXF client generation

* Update of the Petstore CXF server sample

* Update of the Petstore CXF client sample

* Update of the Petstore CXF server annotated base path sample

* Update of the Petstore CXF server non spring application sample

* Changed {{{appDescription}}} to {{appDescription}} to use the HTML-escaped value in handling special characters like <, > in the description following the correction made by @wing328

* Update of the Petstore CXF samples
2017-10-22 23:00:48 +08:00
kinok
649811d542 [JavaScript] Handle custom request.agent (#6737)
* Handle custom request.agent

* better semantic
2017-10-20 15:00:27 +08:00
Jon Schoning
d0ec683a86 revert changes to fakes yaml (#6758)
* revert changes to fakes yaml

the yaml currently includes invalid definitions that do not exist: ('#/definitions/xmlObject').
revert to known good yaml state.

* update template creators
2017-10-20 11:06:28 +08:00
Peter Grman
8a5c361c1a Bugfix/6750 name clash between npm request and parameter called request (#6753)
* rename request to $request

* update examples files

* rename $request to localVarRequest

* rename oder variables to localVar...
2017-10-20 11:04:16 +08:00
wing328
f0b7daeec6 [Rust] rename rust2 to rust-server (#6747)
* rename rust2 to rust-server

* update rust-server batch file to use petstore test spec
2017-10-19 20:17:08 +08:00
Ramkumar Chandrasekaran
3472c68e0b bug fixes (#6743) 2017-10-19 18:16:56 +08:00
Benjamin Gill
1d89ab6e08 [New Generator] Rust API client/server generator (#6613)
* Rust API client/server generator

* `Future::boxed()` has been deprecated - replace with `Box::new(...)`

* rebasing to rust

* MMMLS211 use empty vec over none

* MMMLS211 rebuild after merge from rust

* MMMLS211 YAML array examples not wrapped in Some()

* MMMLS211 Array parameters bad mustache fix

* MMMLS211 don't parse map containers

* MMMLS211 Tidy container types

* MMMLS-211 rebuild example

* MMMLS211 mvn rebuild

* Percent-decode parameters contained in the path

* Produce warnings when unknown fields are present

We still accept unknown fields and discard them. However, to improve
diagnosability, we now write a warning log and return a `Warning`
header.

Note that this is server-only

* Markup

* MMMLS211: Make optional arrays Options again

* 211 markups

* Temporary attempt at tweaking Cow ownership tweak while merging changes from rust branch

* Remove to_string call while parsing path parameters, which requires definining a temporary var in a block because rust can't tell where a Cow reference gets dropped

* Fix rustfmt to the correct version

* Fix rustfmt to the correct version

* Add more response information to ApiError in client

* Re-add missing brace

* Code review markups

* Allow converting out of wrapper types

* Store arrays in new-types too

* Use a new hyper_client every request

* Add vec-like traits to array types

* Xml support - new branch

* Moved conversion from serde_xml_rs::Error to ApiError from swagger-rs to client code until upstream PR is accepted

* MMSUB-172 Don't set Content-Type when there's no body.

If we don't have a body we've serialized, then don't declare
any content type for the nonexistent body.

This is really important for 204 No Content responses, but it's
also morally important for all other non-bodied responses.

* MMSUB-172 Move to swagger 0.6.

* Manually implement debug for the client

* Allow `Context` to be bound to `Api`, and not passed on every function call

* Support "." in parameter names

* Support generate's "--reserved-words-mappings" option

* Support "." in parameter names

* Support generate's "--reserved-words-mappings" option
2017-10-19 17:37:02 +08:00
Gustavo Paz
d37894199b [Java][JAX-RS-CXF] Add JsonProperty to POJO (#6710)
* Included Open Systems International in the list of companies using Swagger Codegen

* Force Jackson to use the real names of the properties of the Data type defined in the YAML

* Update of the Petstore CXF server sample

* Update of the Petstore CXF client sample

* Update of the Petstore CXF server annotated base path sample

* Update of the Petstore CXF server non spring application sample

* Changed {{name}} for {{baseName}} following the correction posted by @wing328

* Update of the Petstore CXF server sample
2017-10-19 16:58:16 +08:00
Will Neild
e4abddf253 Fix spring api operation annotation (#6700)
* * Fix apioperation annotation using generics in class reference for spring server generation

* * Regenerate classes for new spring template
2017-10-18 16:38:12 +08:00
Jon Schoning
5219035b3a [haskell-http-client] handle Alias models + refactoring. (#6712)
* handle Alias models with newtypes

* add inlineConsumesContentTypes cli option

* generate swagger.yaml instead of swagger.json

* check for/validate unhandled authMethods

* refactoring
2017-10-18 10:47:56 +08:00
Asad Saeeduddin
c4d5ba1533 Prefix local vars to prevent conflict with params (#6717)
* Prefix local vars to prevent conflict with params

Fixes #6698

* Update test snapshots
2017-10-18 09:58:36 +08:00
alex-fisher
ff9c723208 ContentType selection fix for csharp. (#6633)
* ContentType selection fix for csharp.
Updated to reflect java implementation. Previously any request body of type string was having the content type overridden to 'application/json'.  This prevented custom json ContentTypes

* updated the petshop codegen for C#

* Fixed content type selection test for csharp

* Replaced tabs with 4 spaces

* Removed trailing space / string comparison
2017-10-17 23:37:22 +08:00
François Rosé
be3e33f472 [C++] Sanitize operation ids. (#6664)
* [C++] Sanitize operation ids.

* [C++] Handle reserved words in `toOperationId`.

* [C++] Re-order reserved words alphabetically.

* [C++] Add missing reserved words.
2017-10-17 23:14:34 +08:00
Giacomo
abe1be1a14 JAXRS-SPEC: fix container return type (#6659)
* JAXRS-SPEC: fix container return type

* Run
./bin/jaxrs-spec-petstore-server.sh
./bin/jaxrs-spec-petstore-server-interface.sh
2017-10-17 22:51:37 +08:00
wing328
5143fb58a4 revise go header, minor formatting fix (#6695) 2017-10-17 22:31:06 +08:00
niku
62627f20bc [Elixir Client]Improve elixir client typings (#6665)
* [Elixir Client] Improve primitive typings

* [Elixir Client] Add type to models

Fix following dialyzer warnings in the sample:

```
:0: Unknown type 'Elixir.SwaggerPetstore.Model.ApiResponse':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.Client':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.Order':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterBoolean':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterComposite':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterNumber':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.OuterString':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.Pet':t/0
:0: Unknown type 'Elixir.SwaggerPetstore.Model.User':t/0
```
2017-10-17 21:59:25 +08:00
Akihito Nakano
07b408a44a [PHP] Fix #5338: InvalidArgumentException (#6685)
* Add endpoint definition which reproduces #5338 bug

* Update samples

* Add test case which reproduces #5338 bug

* Fix "InvalidArgumentException: Invalid resource type: object"

* Update samples

- ./bin/php-petstore.sh
- ./bin/security/php-petstore.sh
2017-10-17 21:22:49 +08:00
wing328
5c14f907d6 add beta to scalaz generator 2017-10-16 22:33:12 +08:00
Taylor Brown
488aa989bf Adding a new Scala client codegen (#6572)
* Adding a Scalaz codegen client

* Fixing imports and removing commented code

* Adding the bash file and updating the Pet store samples for Scalaz.

* Finalizing Scalaz generation so that it works for the Petstore.yaml

* Removing some unnecessary files and comments

* Removing some files that were accidentally generated for the wrong Scala
2017-10-16 22:07:57 +08:00
P.Y. Laligand
1050aa9a06 Added support for enums in Dart. (#6516)
* Added support for enums in Dart.

* Pick non-private names for enum values.

The _ prefix denotes a private member in Dart, so avoid generating enum values starting with this character.

* Properly encode enum values into query paramters.

* Various cleanups.

* Add support for x-enum-values extension.
Use class instead of enum for better ergonomy.
Better generated enum names.

* Fixed test.

* Support enum descriptions.
2017-10-16 21:28:21 +08:00
Jean-François Côté
8b70f24371 There was no validation when a required field was null, creating crash and null pointer exception further down the line in the business code. Now, it throws a InvalidArgumentException. (#6673) 2017-10-16 21:23:05 +08:00
Logan Patino
12a85bb09d Add enum support for flask (#6684) 2017-10-16 11:34:31 +08:00
Yukio Ejiri
8bcceb4a10 [kotlin] Fix causing NoClassDefFoundError at runtime on Android device (#6661)
* Fix causing NoClassDefFoundError at runtime on Android device.

* Add samples modified by bin/kotlin-client-petstore.sh
2017-10-16 11:05:41 +08:00
Javier Velilla
3067da2877 Swagger eiffel:fix (#6674)
* Updated api client, Required parameters {{#required}} .. {{/required}}, are mapped to Eiffel
Void Safety Rules, optional parameters are translated to detachable TYPE.
Validation Rules are mapped to preconditions, at the moment maximun and minimun
validation has been added.
Improved API_CLIENT.parameter_to_tuple feature to accept a LIST [ANY] instead of LIST [STRING_32].
Improved model template to generate the model output.

* Updated API_CLIENT.parameter_to_string feature, missing STRING representation.

* Updating sample using the latest modifications.
2017-10-16 11:02:19 +08:00
Elias Ovchynnikov
3f7f6b8599 Add operationId as nickname to @ApiOperation (#6688)
* Add operationId as nickname to @ApiOperation

* Refresh samples after adding nicknames to @ApiOperation
2017-10-16 10:18:32 +08:00
stkrwork
027fb2fe47 - Removed unnecessary line in in Restbed Codegen Constructor (#6675)
- Updated samples
2017-10-15 23:38:46 +08:00
Vincent Batts
eb453791b6 golang: trailing whitespace fails gofmt (#6669)
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-10-13 17:02:20 +08:00
naelrashdeen
5ffdee4479 [PHP][Symfony] Generate valid PHP code (#6578)
Fixes #5985

We were experiencing syntax issues when generating the Petstore example. See some of the examples below:

StoreApiInterface.php
namespace Swagger\Server\Api;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Swagger\Server\Model\Order;
**use maparray&lt;string,int&gt;;**
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

UserApiInterface.php
public function createUsersWithArrayInput(**User[]** $body);
public function createUsersWithListInput(User[] $body);
As far as I know, it is not possible to use array of objects in this way.

PetApiInterface.php
namespace Swagger\Server\Api;

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Swagger\Server\Model\Pet;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Swagger\Server\Model\ApiResponse;
**use string[];**
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

public function findPetsByStatus(string[] $status);
public function findPetsByTags(string[] $tags);
2017-10-12 17:40:11 +08:00
ehyche
b716b378c4 Swift4: Add additional initializer for initializing model object with properties. (#6642)
* Add addiitional files from upstream

* Remove mis-added files

* Add additional swift4 initializer for initializing model object with properties.

This change fixes this issue: https://github.com/swagger-api/swagger-codegen/issues/6641

It adds an additional initializer which allows model objects to be initialized using the properties. For exxample, if we had this model:

    "ErrorInfo": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "description": "Example Error object"
    },

This we generate an initializer for this model object like this:

    public init(code: Int?, message: String?, details: [String]?) {
        self.code = code
        self.message = message
        self.details = details
    }

* Add hasVars checks around initializers and re-run all scripts to re-generate
2017-10-12 17:35:59 +08:00
Yukio Ejiri
590754f4f4 [kotlin] Fix syntax errors on localVariableHeader in api.mustache (#6660) 2017-10-12 17:31:09 +08:00
Javier Velilla
3bd24c3e5c Updated api client, Required parameters {{#required}} .. {{/required}}, are mapped to Eiffel (#6653)
Void Safety Rules, optional parameters are translated to detachable TYPE.
Validation Rules are mapped to preconditions, at the moment maximun and minimun
validation has been added.
Improved API_CLIENT.parameter_to_tuple feature to accept a LIST [ANY] instead of LIST [STRING_32].
Improved model template to generate the model output.
2017-10-12 17:28:00 +08:00
wing328
30a176126a revise wordings for powershell generator 2017-10-11 21:16:53 +08:00
Jon Schoning
db67840ded [haskell-http-client] bug fixes; path & newtype generation issues (#6638)
* fix path generation/param-substitution issues

* fix newtype de-duplication issues

* refactoring only

* correct version in comments

* prevent duplicate MimeTypes

* sort parameter newtypes
2017-10-10 23:01:48 +08:00
Esteban Marin
dc88ed99ae [angular-typescript] fix using form data (#6574)
* #6457: fix sending form params

* #6457: fix sending form params using files

* #6457: fix sending form params with files for angular 4.3

* #6457: generate samples

* #6457: [typescript-angular] fix form data submission in IE/Edge

* re-apply [typescript-angular] add customized encoder to use '+' char in query parameter #6306 (#6334)

* adapt for HttpClient: [typescript-angular] add customized encoder to use '+' char in query parameter #6306 (#6334)

* generate samples

* #6457: fix url parameter encoder imports for angular <4.3

* #6457: generate samples
2017-10-10 22:55:50 +08:00
ehyche
02d25f5a14 Swift4: Fix inline enum issue (#6640)
* Add addiitional files from upstream

* Remove mis-added files

* Fix compilation issue with Swift4 inline enums.

This change fixes this issue: https://github.com/swagger-api/swagger-codegen/issues/6607

The problem was that I was using "datatype" instead of "datatypeWithEnum" in the model.mustache file.

When you have a the following model property:

"myInlineStringEnum": {
  "type": "string",
  "enum": [
    "inlineStringEnumValue1",
    "inlineStringEnumValue2",
    "inlineStringEnumValue3"
  ]
}

Then we were generating:

public enum MyInlineStringEnum: String, Codable {
  case inlinestringenumvalue1 = "inlineStringEnumValue1"
  case inlinestringenumvalue2 = "inlineStringEnumValue2"
  case inlinestringenumvalue3 = "inlineStringEnumValue3"
}

However, when we decode this, we were using type of the enum ("datatype") rather than the enum type itself ("datatypeWithEnum"). So we were generating:

myInlineStringEnum = try container.decodeIfPresent(String.self, forKey: "myInlineStringEnum")

rather than:

myInlineStringEnum = try container.decodeIfPresent(MyInlineStringEnum.self, forKey: "myInlineStringEnum")
2017-10-10 22:53:17 +08:00
Graham Johnson
1bdb104738 Add Serializable import to JaxRS-spec models if serializableModel is set (#6651) 2017-10-10 22:45:47 +08:00
Jihun Lee
676af62122 Updated feign library dependency to io.github.openfeign (#6652)
Changed groupId from “com.netflix.feign” to “io.github.openfeign” from
gradle and sbt mustache templates.
2017-10-10 22:41:18 +08:00
wing328
3b134319fa add java version to pom in resteasy eap java8 2017-10-09 22:51:58 +08:00
Jean-François Côté
e6d4362012 Fix for regression in issue: https://github.com/swagger-api/swagger-codegen/issues/6472 (#6480) 2017-10-09 22:51:32 +08:00
wing328
164f5bbb72 fix underscore to handle spaces (#6637) 2017-10-09 09:28:31 +08:00
wing328
81e0357561 fix NPE reported in #6519 (#6635) 2017-10-08 18:38:23 +08:00
Sasa Vilic
41b7950dcd Fix class path for DeferredResult (#6452) 2017-10-08 18:29:48 +08:00
Lukasz Konopski
73b38dd19e #3904 Inheritance support java client retrofit gson (#4729)
* merge with master

* remove zoo specific artifact names

* fix duplicate doublequote

* #3904 add samples for retrofit2

* #3904 clean json field retrieval

* #3904 allow non-abstract parent class
2017-10-08 18:25:38 +08:00
Halil İbrahim Şener
1f9f8c5a3e [JavaScript] Fix licenseNames (#6605)
* [JavaScript] Fix licenseName in package.mustache

* Fix invalid SPDX license expression in resources/2_0

* Update JavaScript samples
2017-10-08 17:15:21 +08:00
jarlesat
8a7940f199 Issue 5431 Support jaxrs client api interfaces (#6412)
* Adds the ability to create code for an interface-based jaxrs client.

* Adds shell script and sample files for jaxrs-spec-interface

* rebase into adds shell

* Fixes bug in creation of Produces/Consumes in method annotation. Allows for instance "application/json; charset=utf-8"

* Fixes generated pom.xml

* Generate pom.xml by default

* Prettier output from api.mustache

* Fixes bug in mediatype, allowing charset-specification in swagger.yaml.

* Merges generation of interface-based jaxrs client/api into jaxrs-spec.

* Moves jaxrs-spec server interface to match location of jaxrs-spec server

* Makes Generated-annotation in genereated classes slightly prettier.
2017-10-08 15:28:12 +08:00
Adrian Moos
eab9c72a42 represent swagger enums as union of literal types (#6233)
* represent swagger enums as union of literal types

enabling their easy use in angular templates, structural subtyping
among enums (in particular, different instances of the same enum
are now mutually assignable), improving type safety by preventing
incorrect widening, and permitting numeric enum values
(albeit without descriptive names)

Fixes #6206, #5146, #3500

* update samples

* restore blank lines at end of file

* fix typo
2017-10-07 21:42:46 +08:00
Greg Marzouka
cc756b5563 [Scala] Properly handle csv collectionFormat (#6540)
* Add support for lists of path parameters (eg instances), and default params for optional case classes

* Update Petstore sample

* Revert defaulting of case class fields to None

* Update Petstore sample
2017-10-07 18:24:08 +08:00
Jon Schoning
5b32e886f4 [haskell-http-client] add support for auth methods (#6622)
* add support for auth methods

* use newtypes for required params

* fix duplicate operationId issues

* prevent aliasing of vendorextension references in fromOperation

* add --fast to stack ci build
2017-10-07 17:12:48 +08:00
Andrea Rossi
0db4b32384 [objc] Let the developer specify the timezone to be used for date serialisation (#6628)
* [objc] Update deployment target to 8.0

Updates the test project deployment target to 8.0, as that's the lowest
supported by the latest XCode.

* [objc] Update petstore tests based on current master

Makes sure the tests are based on the latest version of master.

* [objc] Allow specifying the serialization timezone

Now it's possible to specify the timezone used for serializing dates
2017-10-07 13:44:35 +08:00
Gareth T
567ae3fd12 [GO CLIENT] Fix issue with generating code for API key (#6630)
* [GO CLIENT] Fix Go security query parameter generation by using correct string literal and using the Add method.

* Add generated files.
2017-10-07 12:05:48 +08:00
Akihito Nakano
42313af7a1 [PHP] Fix: Type object not handled properly in setParameterExampleValue (#6619)
* Add test which reproduce the warning #5338

https://github.com/swagger-api/swagger-codegen/issues/5338#issuecomment-292502895
`[main] WARN io.swagger.codegen.languages.PhpClientCodegen - Type object not handled properly in setParameterExampleValue`

* Fix Type object not handled properly in setParameterExampleValue

* Update samples

- /bin/php-petstore.sh
- /bin/security/php-petstore.sh
2017-10-06 15:56:13 +08:00
wing328
2f98ade693 fix inconsistent java naming (#6624) 2017-10-06 11:03:15 +08:00
niku
86803c0c24 [Elixir] Improve Elixir Client about primitive type spec (#6623)
Fix following dialyzer warnings in the sample:

```
:0: Unknown type 'Elixir.Float':t/0
:0: Unknown type 'Elixir.Integer':t/0
```
2017-10-06 09:16:27 +08:00
Brian
61b910fb82 [R] Added ApiClient and fixed other issues (#6571)
* Added namespace mustache to be generated

* Fixed syntax issues with package generation

* Added Response and Element mustache templates

* Added ApiClient

* Fix: Only required parameters needed for api operations

* Added documentation generated code

* Regenerated petstore samples

* Fixed url paths for operations

* Fixed based on comments in issues #6520

* Regenerated petstore samples
2017-10-05 01:07:06 +08:00
Cédric Grard
e49e7a056b Typo error fix (#6620) 2017-10-04 22:46:06 +08:00
Stephane Carrez
90010da61d [Ada] Adding Ada support for client code generator (#6602)
* Ada language support (generic generator)

Implement the AbstractAdaCodegen class with the Ada keywords and global
behavior for Ada language

* Ada language support (main generator)

Implement the AdaCodegen class for the Ada client and server code generator
Initial implementation based on a mix from CppRestClientCodegen, NodeJSServerCodegen

* Ada language support: register the AdaCodegen generator class

* Ada language license template

* Ada language model templates (spec and body)

* Ada language client spec and body templates

* Ada language server spec and body templates

* Fix escaping Ada keywords for parameter name

* Generate GNAT project and update type mappings
- Use 'p_' as escape prefix for parameter names because identifiers are not allowed to start with '_'
- Add GNAT project file generation
- Update the type mappings to use the Swagger package types

* Fix generation of operations with no parameters

* Fix instantiation of Ada.Containers.Vectors package in generated model files

* New template for the GNAT project file generation

* Fix datatype generation for Ada language
- Override the getTypeDeclaration function to specify the datatype
- Fix definition of language predefined types

* Add a Serialize procedure declaration for the Ada model generation

* Add a Serialize procedure for the Ada template model generation

* Fix operation name and parameter name for Ada
- Declare and implement toAdaIdentifier function to verify and turn some identifier
  to Ada identifier following Ada style
- Override toOperationId and use toAdaIdentifier for generation of operation name
- Update toParamName to use toAdaIdentifier

* Media type support for Ada code generator
- Implement postProcessMediaTypes function to add a 'adaMediaType' member
  to each media type and map it to some Ada enumeration
- Post process the 'produces' and 'consumes' media type of an operation

* Use x-has-notes extension to avoid emitting notes when they are empty

* First generation for Ada client operation body

* Add a x-has-uniq-produces and x-has-uniq-consumes to media types
to indicate that the list contains only one item, this is necessary
for Ada generator for generation of arrays with one item only

* Add a postProcessParameter for Ada code generator to emit a x-is-model-type attribute

* Update Ada client body template for the serialization of data

* Fix postProcessParameter in Ada code generator to take into account file parameters

* Update the Ada client body to support form parameters

* Fix type name used for mapped types in the Ada generator

* Declare a Deserialize procedure for the Ada generated model

* Override the fromOperation for Ada client code generator
- Emit a x-codegen-response extension with the response description type
- Emit a x-id-model-type extension for each type property

* Update the Ada client package spec template to declare the result type

* Add support to extract response and return result in Ada client code

* Fix Ada postProcessModels to handle container properties and emit a correct x-is-model-type attribute

* Add support for Deserialize procedure in the Ada model generator

* Fix indentation of generated Ada client body package

* Add projectName option to configure the GNAT project name

* Update the GNAT project name for the Ada code generator

* Cleanup implementation and remove unused code

* Cleanup implementation and remove unused code

* Fix javadoc errors

* Use 'ada' for the language name to follow swagger-codegen convention
Add (beta) to the help description
Fix a NPE that occurs with incomplete yaml descriptions
2017-10-04 11:51:04 +08:00
wing328
bf74e33c52 rename CsharpDotNet2 to csharp-dotnet2 (#6611) 2017-10-04 00:03:35 +08:00
wing328
5175281f32 rename silex-PHP to php-silex (#6612) 2017-10-03 23:46:56 +08:00
Pierre Deman
74e31699da CsharpDotNet2Client - Use clientPackage in additionalProperties (#6581)
* CsharpDotNet2Client - Use clientPackage in additionalProperties if provided

* Give execution rights for csharp-dotnet2-petstore.sh

* Fix generation of C#.net2 apiPackage, modelPackage, clientPackage

* Fix modelPackage property missing when generating models

* Initialize clientPackage in constructor
2017-10-03 16:58:27 +08:00
craffael
1896e96648 [nancyfx] fix interface prefix (#6595)
* Retrofit2: Return ResponseBody if response if file.

Until now
--------------------
If a swagger endpoint returned a file (e.g. an image), then the Retrofit2
template has choosen the return type java.io.File. However, retrofit cannot
deal with this and throws a com.google.gson.stream.MalformedJsonException.

New:
-------------------
If a swagger endpoint returns a file, then the corresponding Retrofit2 endpoint
will return a okhttp3.ResponseBody which can be used to retrieve the file.

* fix Interface Prefix
2017-10-03 15:14:28 +08:00
wing328
28a5b74dbf add partial header to haskell http client (#6606) 2017-10-02 23:52:01 +08:00
Trond Bolsø
44bf1d69cb Fix for self-referential imports in typescript-angular client (#6450) 2017-10-02 11:24:08 +08:00
craffael
1f4013e7f1 [NancyFx] provide option to override package context (#6593)
* Retrofit2: Return ResponseBody if response if file.

Until now
--------------------
If a swagger endpoint returned a file (e.g. an image), then the Retrofit2
template has choosen the return type java.io.File. However, retrofit cannot
deal with this and throws a com.google.gson.stream.MalformedJsonException.

New:
-------------------
If a swagger endpoint returns a file, then the corresponding Retrofit2 endpoint
will return a okhttp3.ResponseBody which can be used to retrieve the file.

* Add the option packageContext for nancyFx which allows a better adjustment of the namespace.

* run nancyfx-petstore-server.bat
2017-10-02 11:10:09 +08:00
Benjamin Douglas
6e7ad13e1b Pre-calculate type aliases before processing models (#6559)
A type alias in this context is where a model is simply another name for a
primitive type, such as `MyString` in the following model definitions:

    MyList:
      type: array
      items:
        $ref: '#/definitions/MyString'
    MyString:
      type: string

It is valid to use a type alias as a property in another object or array model,
even if the object/array is defined before the alias is, as in the example
above. However, the current alias logic only looks "back" in list of previously
defined models, meaning that `MyList` would not know that `MyString` is an
alias. This change fixes the incorrect behavior by pre-calculating the list of
aliases before any models are processed. It also changes the test endpoint to
verify the correct behavior even when an object is defined before an alias it
uses.
2017-10-02 10:54:41 +08:00
Jon Schoning
8bd7d3912b [haskell-http-client] fixes for fake-endpoints (#6597)
* fix compile errors / sanitization for petstore-with-fake-endpoints-models-for-testing.yaml
* correct mimetype logic
* add makefile
2017-10-01 18:18:46 +08:00
wing328
82b6e81897 use String() to convert num, update TS angular samples 2017-09-30 17:28:07 +08:00
wing328
f3e19e0fdc fix comma in method without parameters 2017-09-30 17:23:38 +08:00
Adrian Moos
da37f40202 Add optional support for HttpClient (#6295)
* fix compilation error in eclipse

by updating package declarations in moved files
(eclipse validates that package and folder names match)

* permit specifying the full angular version

simplifying the templates by moving trivial case splits to the model

* remove dead code

this method is never called ...

* support HttpClient in addition to Http, clean up generated code

Fixes #6080

* added new sample, and regenerated existing samples

* updated samples

this time with the freshly build generator ...

* improve formatting

* updated samples

* fix compilation error in generated code

the overload for blobs does not have a type parameter

* added the first test for the utils package

* fix extra trainling commas in function argument lists

* regenerated samples
2017-09-30 17:19:39 +08:00
Jinkui Shi
063e885c2f [Scala] format the Scala code style templete (#6532)
* The templete of scala code style refactor

* more reformat

* more reformat

* generate petstore client
2017-09-29 17:24:34 +08:00
Vlad Frolov
924a8e5efe [CPPREST] Fixed multipart files upload implementation (#6518) 2017-09-29 15:46:16 +08:00
Akito Nozaki
25812fc526 Swift3: non dictionary body type (#6531)
* Adding support for non dictionary body types.

* Adding test for rest of the swift3 types

* Cleaning up implementation of makeRequest and adding better error handling.

* Adding ClientError for error produced before request is sent.

* Changing how encoding of body data is handled.

* Cleaning up code that was modified.
2017-09-29 00:16:32 +08:00
wing328
16045a1cff Merge branch 'master' of https://github.com/swagger-api/swagger-codegen 2017-09-28 14:25:25 +08:00
Kenny Jones
87a9caa33f Bugfix: Path replacement regex not working (#6580)
A previous change to make the regex a variable to allow proper linting
resulted in the regexp not having access to the value associated with
the variable and the path variable not being replaced.

Moves the regexp variable inside the for loop to allow the value to be
used and the path variable to be replaced with the provided value.
2017-09-28 14:14:47 +08:00
wing328
32b5f8d87d Merge branch 'master' of https://github.com/swagger-api/swagger-codegen 2017-09-28 14:02:55 +08:00
wing328
4c31983bd3 fix JS help text 2017-09-28 14:01:37 +08:00
Kenny Jones
d04b7642f6 Feature: Adds doc generation (#6570)
Reference #2359
2017-09-28 13:17:48 +08:00
wing328
2c7dcbe3e5 fix elixir model naming 2017-09-28 09:55:53 +08:00
yissachar
bd5b586028 Use valid JS RegEx (#6584) 2017-09-28 09:49:05 +08:00
Jeff Ching
4b9ee1f194 [Elixir] Improve Elixir client (#6550)
* Fix dependencies and generate model classes

* Better elixir client generation.

Responses are parsed and serialized by Poison into the model structs.
Use shared helper functions to generate the request.
Extract client connection configuration from api calls.

Elixir client can sanitize the operationId

Correctly output the model variables. Fix typos

Fix path replacement when there are multiple replacements

Cannot separate globally shared parameters from operations

Error handling for the tesla response

update templates

Can generate clients that compile

Can make requests - parse optional params, build query

Add oauth to connection. Fix connection directory

Add basic auth helper for creating a connection

Fix map types. Fix guard clauses for creaing connections

Add licenceInfo template. Parse config for moduleName via standard invokerPackage option

Can provide and inject a license header into all source files

fix location of connection.ex

Move shared code into reusable modules

Elixir filenames should be underscored

Fix visibility of helper functions

Parse the packageName from config options

Handle date and datetime fields with DateTime.from_iso8601

Fix indentation

Update documentation, add typespecs

Generate a standard elixir .gitignore

typespec is calculated recursively in java

Use the JSON middleware and using Poison.Decoder.decode on already parsed structs

move decoded struct into java

Fix handling of non-json responses

Switch basic auth to use the provided Tesla.Middleware.BasicAuth

Update README template to include the appDescription

Update sample elixir client

remove junk client models that don't belong with petstore

Only implement Poison.Decoder protocol if needed

Update samples with skipped Poison.Deocder impl

* Handle multipart file uploads

Handle building form params in the body

Files are handled as strings for input

* Requests with no defined return type will return the Tesla.Env response

* Run the bin/elixir-petstore.sh
2017-09-28 09:32:17 +08:00
Jakob Schelbert
e3ba06cabb Fix some bugs for the R client (#6535)
* * Fix bugs in api.mustache, model.mustache, mostly bracket errors or small typos
* Added section about installation in README.mustace
TODO: fix tests in testthat
TODO: fix bug in description.mustace regarding package name

* Updates to sample for R client caused by running ./bin/r-petstore.sh (or .\bin\windows\r-petstore.bat)

* Add R specific files to .gitignore

* [R] add additional files generated by the petstore sample. (see #6520)
2017-09-27 00:06:53 +08:00
Kenny Jones
5e9d977a03 Bugfix: Resolve lint errors for generated client (#6563)
Updates the bash client template to allow the generated client code
to be free of lint errors.

Resolves: #6562
2017-09-26 21:53:05 +08:00
Mehdy Bohlool
d2b91073e1 [python] Add default Configuration (#6554)
* Add default configuration

* Fix assert_hostname bug in rest.py

* Update petstore sample
2017-09-26 14:16:48 +08:00
lukoyanov
e2916fdc13 [Java] Play! framework + retrofit2 client exception converter, bug fixes (#6543)
* added exception converter

* underscore removal fix

* samples updated

* added test

* test whitespace
2017-09-26 14:14:04 +08:00
Greg Marzouka
0a9e3782c5 [Scala] Add support for PATCH via X-HTTP-Method-Override (#6539)
* Added support for http PATCH to the scala client using X-HTTP-Method-Override header

* Update Petstore sample
2017-09-26 12:22:01 +08:00
wing328
96137e5677 add encodeURIComponent to encode path parameters (#6551) 2017-09-25 16:28:30 +08:00
wing328
419ee1cc79 Add class prefix to tag with numbers (#6561)
* add class prefix to tag with numbers, update java to default tag name

* update codegen test
2017-09-25 15:23:27 +08:00
Kenny Jones
4b0314498b Bugfix: Handle all different types of security (#6528)
The only special handling was for security definition type `apiKey`
in `query`. All the other security configurations should result in the
same generated code.
Moves the handling of the special query parameters outside of the
`parameters without specific cardinality` section.
To cover the scenario where `elif` was being used, simply leverage the
builtin `continue` statement to stop processing the specific query
parameter and continue to the next available query parameter, if any.

Manually test with multiple different combinations.

Resolves: #6526
2017-09-24 23:07:12 +08:00
wing328
2d44d7f291 use parameter name as description if not defined (#6557) 2017-09-24 21:18:49 +08:00
wing328
f5bc5ecc04 [Scala] Decommission "async-scala" generator (#6552)
* remove async-scala generator

* remove async-scala related scripts
2017-09-24 16:43:42 +08:00
Akihito Nakano
b31a80448a [PHP] Improve Api template (#6507)
* Improve spacing in doc comment

* Improve grouping of parameter tags

* Improve line length

* Fix undefined variable $_tempBody

* Improve indent
2017-09-24 15:40:06 +08:00
Alex
ac99fe6b2d fix #6353 (#6514) 2017-09-24 14:47:40 +08:00
wing328
639f88918a [Java][RESTEasy] fix resteasy dependency issue in pom.xml (#6556)
* fix resteasy dependency issue

* add java resteasy petstore to circleci test
2017-09-24 12:49:43 +08:00
Akihito Nakano
8f8515486f [PHP] Improve Model template (#6460)
* Update samples

./bin/php-petstore.sh

* Remove unnecessary implements entry

ModelInterface, ArrayAccess are already implemented in parent

* Remove field `container` which is already defined in parent

* Change snake case to lower camel case

- invalid_properties
- allowed_values

* Improve doc commenct style

* Improve description length

* Improve length

* Doc comment short description must start with a capital letter

* Add a line between @param and @return

* Delete an additinal blank line at end of doc comment

* Udpate petstore-security-test
2017-09-23 21:36:05 +08:00
Esteban Marin
4a89d23619 [typescript-angular] apply encodeURIComponent to path-parameter (#6525)
* #6524: [typescript-angular] apply encodeURIComponent to path-parameter

* #6524: [typescript-angular2] update samples

* #6524: [typescript-angularjs] update samples
2017-09-23 17:23:45 +08:00
Jean-François Côté
1baa5fca45 [Typescript-jQuery] Fix for issue #6505 (#6541)
* Fix that prevented the default version to generate the model files

* Add generated samples
2017-09-23 16:57:48 +08:00
stoetti
07df0759d3 [TypeScript][Angular] Better support for "Accept", "Content-Type" (#6454)
* add consumes and produces as corresponding headers if present

* add check for empty array
fix copy/paste error

* fix styling

* add isJsonMime
filter produces- and consumes-Arrays for json-mime items
2017-09-23 15:48:05 +08:00
WendellDuncan
8698444fb2 Propsed fix for the ApiClient runtime crash (#6523) 2017-09-23 15:34:12 +08:00
Brad Crumb
c5c639b62b Zend Expressive fix and upgrade to version 2 (#6461)
* upgraded zend-expressive from version 1 to 2

* Changed error handler for compatibility with Zend Expressive 2

* generated newest sample files for Petstore ze-ph

* removed ErrorMiddleware because it is never been used anymore. Regenerated samples

* removed ErrorMiddleware Template from Codegen

* remove ErrorMiddleware from petstore sample

* Fixed some code styles

* regenerated ze-ph samples with corrected code styles

* added new line at the end of the file
2017-09-23 15:31:20 +08:00
CK
c74c31bcfc produce correct enum for jaxrs resteasy eap (#6489) 2017-09-23 15:05:05 +08:00
Jean-François Côté
bcfd14551a Fixing conversion when it's an item of a collection + add missing isUuid in objects (#6473) 2017-09-22 00:54:10 +08:00
lukoyanov
7f6bccb4ed [Java] Added Play! WS filters support for retrofit2 client (#6499)
* added play! ws filters support

* samples updated
2017-09-20 12:32:52 +08:00
Akihito Nakano
594b390e11 [PHP] Fix #6474: Bug with 'format: date' when using --model-name-prefix (#6510)
* Add test case which repeats the issue #6474

* Add "date" to type mapping

* Update samples

./bin/php-petstore.sh
./bin/security/php-petstore.sh
2017-09-19 18:07:37 +08:00
Larry Bordowitz
65d788396b [6313] Add imports to perl objects. (#6500) 2017-09-19 10:11:38 +08:00
ehyche
146b107774 Eliminate all Java compilation warnings for swift4 codegen module (#6467) 2017-09-19 09:46:27 +08:00
stkrwork
5443c0a94c [QT5][CPP] Fixing issue with maps in models (#6479)
* [QT5][CPP] Fixing issue with maps in models

- Adjusted init function to init map correctly
- Adjusted cleanup function to cleanup maps correctly

* Fixed formatting for samples
2017-09-19 09:31:53 +08:00
Mehdy Bohlool
f3c41e866c [Python] Add configuration.{connection_pool_maxsize, assert_hostname} (#6508)
* Backport kubernetes client features:

- assert_hostname
- connection_pool_maxsize
- cleanups

* Update petstore sample
2017-09-19 01:25:33 +08:00
Jon Schoning
d928617b69 [haskell-http-client] use katip logger, default strict (#6478)
* change strictFields cli option default to True;

* use katip logging; add cli-option for monad-logger

* fix date parsing

* remove package.yaml
2017-09-19 01:24:38 +08:00
Barry Andrews
5f566255ac Add support for reserved-words-mappings to cpprest (#6501)
* Also handles automatic escaping for reserved words, i.e.
  by default, no need to provide a mapping.
Fix #6498
2017-09-19 01:14:47 +08:00
ehyche
b807f6ff96 Support object schemas with only additionalProperties. (#6492)
Previously, we had implemented the Codable protocol by simply claiming conformance, and making sure that each of our internal classes also implemented the Codable protocol. So our model classes looked like:

class MyModel: Codable {
   var propInt: Int
   var propString: String
}

class MyOtherModel: Codable {
   var propModel: MyModel
}

Previously, our additionalProperties implementation would have meant an object schema with an additionalProperties of Int type would have looked like:

class MyModelWithAdditionalProperties: Codable {
   var additionalProperties: [String: Int]
}

But the default implementation of Codable would have serialized MyModelWithAdditionalProperties like this:

{
  "additionalProperties": {
    "myInt1": 1,
    "myInt2": 2,
    "myInt3": 3
  }
}

The default implementation would put the additionalProperties in its own dictionary (which would be incorrect), as opposed to the desired serialization of:

{
  "myInt1": 1,
  "myInt2": 2,
  "myInt3": 3
}

So therefore, the only way to support this was to do our own implementation of the Codable protocol. The Codable protocol is actually two protocols: Encodable and Decodable.

So therefore, this change generates implementations of Encodable and Decodable for each generated model class. So the new generated classes look like:

class MyModel: Codable {
   var propInt: Int
   var propString: String

   // Encodable protocol methods

   public func encode(to encoder: Encoder) throws {

        var container = encoder.container(keyedBy: String.self)

        try container.encode(propInt, forKey: "propInt")
        try container.encode(propString, forKey: "propString")
    }

    // Decodable protocol methods

    public required init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: String.self)

        propInt = try container.decode(Int.self, forKey: "propInt")
        propString = try container.decode(String.self, forKey: "propString")
    }

}

class MyOtherModel: Codable {
   var propModel: MyModel

   // Encodable protocol methods

   public func encode(to encoder: Encoder) throws {

        var container = encoder.container(keyedBy: String.self)

        try container.encode(propModel, forKey: "propModel")
    }

    // Decodable protocol methods

    public required init(from decoder: Decoder) throws {
        let container = try decoder.container(keyedBy: String.self)

        propModel = try container.decode(MyModel.self, forKey: "propModel")
    }

}
2017-09-19 01:04:50 +08:00
ehyche
8067612e06 Handle when response is a file URL. (#6469)
This is the equivalent change in the swift4 module which was made in the swift3 module in this PR:

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

This updates AlamofireImplementations.mustache to handle when the response is an URL. It also makes changes in the generated sample code for:

* default configuration (no promisekit or rxswift)
* promisekit
* rxswift

Also, in order to build, the generated code needed to be updated with the change in CodableHelper which changes dataDecodingStrategy to ".base64" from its previous definition in earlier Xcode 9 betas.
*
2017-09-12 14:37:39 +08:00
wing328
591149bcb7 Better logic to handle tags with special characters (#6466)
* better logic to handle tag with special characters

* update test cases

* comment out swift test cases

* restore the swift tests
2017-09-12 11:41:14 +08:00
wing328
9e0911b376 [ObjC] fix NPE when getting swagger type (#6465)
* fix npe in swagger type (objc)

* remove trailing spaces
2017-09-11 17:39:12 +08:00
Lance Hannestad
a6d6432e6d [Python][Flask] Upgraded connxion to 1.1.15 (now supports multi collection format arrays) (#6463)
* [Python][Flask] Upgraded connxion to 1.1.15 (now supports multi collection format arrays)

* Was modified by ./bin/python-petstore.sh
2017-09-11 10:23:38 +08:00
wing328
afb75d64d0 fix NPE in get swagger type (#6462) 2017-09-10 02:16:08 +08:00
wing328
a2cb35b1e9 Merge branch 'master' of https://github.com/swagger-api/swagger-codegen 2017-09-09 17:18:16 +08:00
wing328
35cf42996a add note to deprecate swift generator 2017-09-09 17:16:04 +08:00
Jon Schoning
4fb612c2e8 [haskell-http-client] update documentation; refactoring; add 'strictFields' cli option (#6458)
* update readme; remove unused DeriveAnyClass extension

* refactor request/param utility functions

* add strictFields cli option

* add CONTRIBUTING.md
2017-09-09 17:11:46 +08:00
Jon Schoning
4310ea326c [haskell-http-client] update readme; improve lens generation; fix dateFormat (#6448)
* point readme links to canonical locations

* use lenses for non-required model fields, instead of traversals

* fix .gitignore generation

* fix dateFormat cli option bug
2017-09-07 23:17:49 +08:00
ecolleu
3cd3b907f6 [ANDROID][volley] Handle UnsupportedEncodingException in invokeAPI (#6436)
* [ANDROID][volley] Handle UnsupportedEncodingException in invokeAPI (Issue #6432)
The constructor of StringEntity can throw UnsupportedEncodingException, which is not catch nor thrown by createRequest method.
Therefore the build of android client fails with:

ApiInvoker.java:448: error: unreported exception UnsupportedEncodingException; must be caught or declared to be thrown

This commit adds a try ... catch on UnsupportedEncodingException in invokeAPI methods and declare this exception to be thrown in createRequest

* [ANDROID][volley] Handle UnsupportedEncodingException in invokeAPI (Issue #6432)
The constructor of StringEntity can throw UnsupportedEncodingException, which is not catch nor thrown by createRequest method.
Therefore the build of android client fails with:

ApiInvoker.java:448: error: unreported exception UnsupportedEncodingException; must be caught or declared to be thrown

This commit adds a try ... catch on UnsupportedEncodingException in invokeAPI methods and declare this exception to be thrown in createRequest

* [ANDROID][Volley] Handle UnsupportedEncodingException (Issue #6432)
Throw more precise ApiException
2017-09-07 18:12:09 +08:00
Jean-François Côté
0cf82d7ae3 [All generators] Supports of hyphen-case to camelCase (#6399)
* Supports of hyphen-case to camelCase

* Add unit tests for the new section in the camelize function.
2017-09-07 13:14:22 +08:00
Dário Tavares Antunes
29a3a4b336 [Java] Handle Long in enum correctly (#6342)
Resolves #6338
2017-09-07 02:19:19 +08:00
jaz-ah
565844585e [Swift3/Swift4] update all cocoapods for swift3/swift4 (#6441)
* [Swift] update all cocoapods for swift3/swift4

* fix subspec specification
2017-09-07 00:56:48 +08:00
wing328
845f54da99 [Java] fix bug to only remove "CustomInstantDeserializer" for Play v2.5 (#6444)
* fix bug to only remove CustomInstantDeserializer for play25

* revise logic

* fix logic for CustomInstantDeserializer.java
2017-09-07 00:18:39 +08:00
manuc66
a41e8bed97 [csharp] Support inheritance instead of duplicating parent properties in derived classes (#5922)
* [csharp] Explicitly set supportsInheritance

* [csharp] set supportsInheritance for client

This includes supportsInheritance only for the client codegen at the
moment, because setting in AbstractCSharpCodegen would require the
change to be tested in all derived generators, possibly including
similar template changes to this commit's.

* include nice improvement of https://github.com/jimschubert/swagger-codegen/tree/csharp/3829 and leverage https://github.com/manuc66/JsonSubTypes for subtype deserialization

* remove duplicate base validations

* remove useless tests

* restore documentation for properties coming from parent

* launch bin/security/csharp-petstore.sh

* it's impossible to call an explicitly implemented interface-method on the base class
(https://stackoverflow.com/questions/5976216/how-to-call-an-explicitly-implemented-interface-method-on-the-base-class)

* restore portion of code that was lost

* regenerate more

* fix missing using

* take the multi .net compatible revision

* keep generated model simple when no hierarchy involved

* regenerate with:
- bin/csharp-petstore-all.sh && bin/security/csharp-petstore.sh
- bin/csharp-dotnet2-petstore.sh && bin/csharp-petstore.sh && bin/csharp-petstore-netcore-project.sh && bin/csharp-petstore-net-standard.sh && bin/csharp-property-changed-petstore.sh

* fix sln indentation and the missing windows runner for dotnet2

* fix inheritance GetHashCode and Equals

* override instead of hiding the base method
+ fix the csharp-property-changed-petstore.bat

* By default the value of the discriminator property must be the name of the current schema

* Add test for subtype deserialisation from parent type

* add missing '.bat' and use the 'call' template from javascript-petstore-all.bat

add missing file to trigger it on windows

* fix default value bug

* cleanup copyright information

* formatting after merge

* fix merge

* applying bin/csharp-petstore-all.sh

* applying bin/security/csharp-petstore.sh
2017-09-06 17:22:20 +08:00
wing328
b8183fbd09 remove spaces in templates 2017-09-06 16:54:36 +08:00
lukoyanov
f623aa1f5b [Java] Play! retrofit2 client content-type handling fixes (#6440)
* proper content-type handling (npe fixed when content-type is absent, improved content-length calculation)

* samples updated

* fixed missing imports, samples updated
2017-09-06 15:43:19 +08:00
Jon Schoning
c7d145a4ba add haskell-http-client-generator (#6429) 2017-09-06 00:33:48 +08:00
Alex
4eab5406c5 Added ModelInterface for PHP Models (#6331)
All Model classes include a set of methods - it makes sense to align them to a concrete interface to improve strict typing when referencing these models.
2017-09-05 22:22:18 +08:00
Takuro Wada
84bb749cc3 [typescript-angular] add customized encoder to use '+' char in query parameter #6306 (#6334) 2017-09-05 22:04:23 +08:00
wing328
a4c0975aa4 [R] Add new R client generator (#6351)
* add r client codegen

* update r api, model templates

* various fix

* rename Json to JSON

* more enhancements

* fix json handling

* add file upload support, var name to handle hyphen

* use httr::upload_file
2017-09-04 00:21:32 +08:00
wing328
c1f5de91bb add comment, update ruby, php samples 2017-09-03 23:20:55 +08:00
Daniel Ochoa Rodríguez
cfa2074802 Fix Uuid parse (#6382)
* Fix Uuid parse

* Add isString = true when property is Uuid

This will not break previous code

* Update conversionBegin.mustache

* Update conversionEnd.mustache
2017-09-03 23:10:25 +08:00
Giacomo
a1c1a82725 - Added javax.validation.Valid annotation to modules/swagger-codegen/… (#6398)
* - Added javax.validation.Valid annotation to modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/bodyParams.mustache
- Added bean validation and api description to modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/headerParams.mustache
- Added api description to modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/queryParams.mustache
- Added interfaceOnly parameter management to modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaJAXRSSpecServerCodegen.java to generate only interfaces and models.
- Added interfaceOnly parameter management to modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/api.mustache
- Added throws java.lang.Exception to modules/swagger-codegen/src/main/resources/JavaJaxRS/spec/api.mustache

* Run ./bin/jaxrs-spec-petstore-server.sh

* jaxrs-spec: javax.validation.Valid model attributes for array items

* Run ./bin/jaxrs-spec-petstore-server.sh
2017-09-03 22:45:35 +08:00
Florent Chamfroy
5007a1b1ba Problem with enumOuterClass (#6428)
rewrite enumOuterClass based on modelEnum in Java swagger-codegen
templates.

https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/Java/modelEnum.mustache
2017-09-03 22:36:10 +08:00
jaz-ah
19694ae4e3 [Swift3] Make sure decode doesn't fail on optional arguments (#6423)
* two fixes: 1) extra ?'s at end of some url's 2) enums not being called out w/ rawValue to get the proper string name

* update samples

* one step closer

* closer implementation

* break on optional decode failing since it's an optional we don't want to fail the whole decode

* update samples
2017-09-03 22:30:42 +08:00
jaz-ah
b19fa25521 [Swift3] Missing decoders for Array elements (#6422)
* two fixes: 1) extra ?'s at end of some url's 2) enums not being called out w/ rawValue to get the proper string name

* update samples

* one step closer

* closer implementation

* add back in array decoders

* regenerate samples
2017-09-03 22:30:21 +08:00
wing328
1f2730c587 Revert "Revert "[Java][Retrofit2] Return ResponseBody if response is "file"" (#6421)" (#6426)
This reverts commit a6561e7d21.
2017-09-02 21:33:55 +08:00
Rene Cacheaux
da8f1e58bd [Swift4] Updates syntax in Codable helper template. (#6417) 2017-09-02 18:33:38 +08:00
wing328
1097375d7f fix file upload in retrofit2 (without play) (#6425) 2017-09-02 17:35:46 +08:00
wing328
a6561e7d21 Revert "[Java][Retrofit2] Return ResponseBody if response is "file"" (#6421)
* Revert "Make the Rust codegen compile. (#6411)"

This reverts commit 60766c6210.

* Revert "[Kotlin] Fix model enum generation (#6383)"

This reverts commit adf5d643d5.

* Revert "Global namespaces for ruby basic types (#6418)"

This reverts commit 070894dc95.

* Revert "add ehyche to swift tech comm"

This reverts commit 5c62ba182e.

* Revert "[python-client] Thread pool fix (#6396)"

This reverts commit a28ce0b604.

* Revert "update retrofit2 petstore samples"

This reverts commit 0f1a61d9c2.

* Revert "Retrofit2: Return ResponseBody if response if file. (#6407)"

This reverts commit 481c040373.
2017-09-02 01:26:42 +08:00
Ahmed Charles
60766c6210 Make the Rust codegen compile. (#6411)
* Use the right package name for the Rust crate.

* Change getters on models to return Option for non-required fields.

* Cleanup Rust generation and get example compiling again.

* Use underscore names for functions.
2017-09-02 00:06:55 +08:00
Christian Röder
adf5d643d5 [Kotlin] Fix model enum generation (#6383)
Run postProcessModelsEnum on model enums, so that enumVars get populated,
and fix the model enum template.
2017-09-01 23:11:21 +08:00
Gleb Sinyavsky
070894dc95 Global namespaces for ruby basic types (#6418)
File here will be overriden by generated class File of swagger.yml containse the definition named File. Using global namespace can fix it
2017-09-01 22:56:47 +08:00
Darshana Sanjeewan Adikari
a28ce0b604 [python-client] Thread pool fix (#6396)
* [python-client] Added close() and join() for threadpool at ApiClient destructor.

* Updated stuff for CI
2017-09-01 18:18:03 +08:00
craffael
481c040373 Retrofit2: Return ResponseBody if response if file. (#6407)
Until now
--------------------
If a swagger endpoint returned a file (e.g. an image), then the Retrofit2
template has choosen the return type java.io.File. However, retrofit cannot
deal with this and throws a com.google.gson.stream.MalformedJsonException.

New:
-------------------
If a swagger endpoint returns a file, then the corresponding Retrofit2 endpoint
will return a okhttp3.ResponseBody which can be used to retrieve the file.
2017-09-01 17:01:15 +08:00
lukoyanov
a2c4f0baf4 [Java] Implemented support for Play! 2.5.x (java8) for retrofit2 client (#6007)
* Implemented support for Play! 2.5.x / java8

* Added petstore sample for play25

* implemented play25 support
implemented version switch via playVersion config option

* fixed compilation failure after merge

* Disabled generation of CustomInstantDeserializer if dateLibrary equals to java8
2017-08-31 23:02:09 +08:00
Shimin Guo
37f48239b0 Map ByteArray to Text for haskell codegen (#6402)
* Support ByteArray in haskell codegen

* update petstore example
2017-08-31 10:19:42 +08:00
Jean-François Côté
d80c0f5546 [Java Play Framework] Fix a small error of using paramName instead of baseName (#6395)
* Fix a small error of using paramName instead of baseName

* Add sample generation
2017-08-30 17:58:24 +08:00
David Fischer
506c58ec74 [JaxRS] Fix response annotation generation (fixes #2588) (#6373)
* [JaxRS] Fix response annotation generation (fixes #2588)

* [JaxRS] Fix jaxrs jersey1 usetags sample provider

* Revert "[JaxRS] Fix jaxrs jersey1 usetags sample provider"

This reverts commit 73fef2e451e376b23f6c1d43d8781f0b4a0bd1f5.

* [JaxRS] Fix jaxrs jersey1 sample generator

* [JaxRS] Fix samples for jersey1 and jersey2

* [Server: Java] Fix diamond operator defaultValue for Java < 1.7
2017-08-30 00:31:56 +08:00
jaz-ah
b0db394855 [Swift3] fix for unwrapRequired compilation when we have a "result" as one of the parameters (#6377)
* two fixes: 1) extra ?'s at end of some url's 2) enums not being called out w/ rawValue to get the proper string name

* update samples

* one step closer

* closer implementation

* fix unwrapRequired models when we have a parameter named result
2017-08-30 00:01:47 +08:00
Damien Pontifex
14f0375bdd Codegen class rename for Angular and AngularJS to reflect naming guidelines (#6109)
* Rrename for angular and angularjs to reflect naming guidelines

see http://angularjs.blogspot.com.au/2017/01/branding-guidelines-for-angular-and.html
- move makes typescript-angular -> typescript-angularjs
- move makes typescript-angular2 -> typescript-angular
Language string with generate was already this so generation shouldnt change
but class naming follows this convention now

* Fixing merge problems
2017-08-28 18:32:50 +08:00
Yusuke Tsutsumi
8bdaf493dd implemented tornado-based client. (#6367) 2017-08-28 15:10:06 +08:00
Ahmet Taha Sakar
17b71f1707 Swift3 arrayenums (#6354)
* added headers to makeRequest function for swift3 template

* added support for enum arrays
2017-08-28 15:08:28 +08:00
sandro97git
4457361c56 fix(codegen, nodejs-server): correct reponse.end (#6301)
Don't send code with response.end because it's already set in writeHead.

Fixes #6292
2017-08-25 23:54:41 +08:00
Isman Usoh
3ecc374682 [Typescript-Fetch] Support additionalproperties, Enum, Auth and more. (#6130)
* Support additionalproperties and more.
- Upgrade to TypeScript 2
- Use type definition from npm instead of typings, typings is deprecation
- Use Enum instead of String Literal Types
- Use typescript es6 lib for target es5
- Support additionalproperties
- Support JSDoc
- Add snapshot and npmRepository option
- Update typescript-fetch run script for linux
- Create typescript-fetch run script for windows

* Update and fix
- Fix circle run script
- Fix duplicate query parameter

* Rename typescript-fetch folder to lowercase

* Fix for review and update new line end of file

* Fix end of file

* rename script to {lang}-petstore-all.sh and fix test

* Fix override query string
https://stackoverflow.com/a/7517673/1077943
2017-08-25 23:26:32 +08:00
stmeyer
6c8bd6b83e [QT5CPP] General Improvements (#6315)
* - check C++ keywords
- setter for SSL configuration

* recreate example QT5CPP

* only emit error signal if error happens

* provide more error information

* regenerate example QT5CPP

* * use reserved words in abstract cpp generator
* update CppRest examples

* remove tabs
2017-08-25 18:35:56 +08:00
jaz-ah
1b05960a74 [Swift3] Fix unwrapRequired parameter which wouldn't compile (#6340)
* two fixes: 1) extra ?'s at end of some url's 2) enums not being called out w/ rawValue to get the proper string name

* update samples

* one step closer

* closer implementation

* fix build when using unwrapRequired option
2017-08-25 18:19:26 +08:00
Christian Röder
8a423d2aa5 Kotlin: Use packageName option for all classes (#6365)
Use the optional packageName parameter for model and api classes,
additionally to the infrastructure classes.

Fixes #6364
2017-08-24 10:44:02 +08:00
Krzysztof Karol
4ee557aa24 Fix swagger-api/swagger-codegen#6345. Wrap optional JSDoc parameter (apiClient) in square brackets (#6346) 2017-08-24 10:39:34 +08:00
Michael Werle
0fe8c7c96f [Java] Valid generated classes with fullJavaUtil (#6357)
Partial fix for #2936; will fix the ArrayList/HashMap import issue in generated Java client code.
2017-08-24 10:35:43 +08:00
Jean-François Côté
006b97525f Update the Java Play Framework generator to version 2.6.3 (#6356) 2017-08-24 10:23:10 +08:00
wing328
6ff612ffcb fix pom in jaxrs-cxf-cdi (#6343) 2017-08-21 15:51:30 +08:00
Ryan Nowakowski
2d2f88e3d1 [python] Fix body check in rest.py (#6333)
Checking for "trueness" here is not sufficient.  An empty list has a truth
value of false so it will not be encoded as json and sent as the request
body as it should.  Instead we need to check explicitly if body is None.
2017-08-20 23:50:55 +08:00
wing328
d6c95226c7 minor code formatting fix 2017-08-19 12:11:47 +08:00
ToreJohansson
dabe6b5961 Added examples for body parameter (#6228) 2017-08-19 12:07:40 +08:00
Christian Röder
88e99f1a42 Kotlin: Fix trailing comma for data classes (#6323)
If a data class has no optional parameters, a trailing comma (which was
supposed to delimit the list of required and optional parameters) will be
inserted after the last required paramter, leading to a syntax error in
Kotlin.
2017-08-19 11:56:29 +08:00
lukoyanov
936c586df3 fixed error handling (now retrofit2.HttpException is thrown instead of RuntimeException on API error) (#6302)
value adapter now supports both F.Promise<Model> and F.Promise<Response<Model>> in retrofit interface
switched dataLibrary to java8
2017-08-15 16:03:19 +08:00
Morten Christensen
e31cef8c71 Added modelPropertyNaming option to the csharp generator - Almost 100% based of the implementation of the option for Scala (#6305) 2017-08-15 15:30:35 +08:00
Ali
7f50b3c300 [Java] fix a bug whereby OAuth intercept method calls itself forever (#6290)
* fix a bug whereby OAuth intercept method calls itself forever

When the response is 401 or 403, the interceptor assumes that it is because of token so it keeps retrying the request with new token. However if the response status is due to the fact that authorization to the api endpoint failed, and not due to invalid token, then a recursive operation of updating token and re-requesting the failed request happens.

* change binary OR operator: | to normal OR operator: ||

although binary may work, it's unusual and likely was unintentional.
2017-08-15 14:57:26 +08:00
Daniel Woodel
024916c425 [swift3] Download file fix #6274 (#6274) 2017-08-15 12:11:23 +08:00
Ramzi Maalej
c714b1ab00 Strip package name from the class name (#6293) 2017-08-14 17:02:45 +08:00
Lars Wander
23d0fedc9c [Java] Fix okhttp-gson datetime converter compilation (#6230) 2017-08-14 16:50:02 +08:00
Yusuke Tsutsumi
d39b1ff76f [python] asyncio support (#6245)
* trying an approach with providing asyncio as a framework.

* adding example of asyncio.

* removing sample client to help PR look more manageable.

* possibly fixing a unit test

* getting unit test to pass again.

* addressing comments.
2017-08-14 16:16:55 +08:00
Ahmet Taha Sakar
da4fe86402 Swift3 xcodewarnings (#6298)
* added headers to makeRequest function for swift3 template

* Swift3 update to dismiss Xcode warnings
2017-08-13 13:09:23 +08:00
Manuel Kiessling
105fe4958e [php] Fixed typo in codedocs (Swaagger -> Swagger). (#6299) 2017-08-12 21:36:19 +08:00
Thomas Townsend
01477de711 Add useTags option to JavaJersey server codegen (#6278) 2017-08-12 18:02:31 +08:00
ephemera
11424a8cdd fix #6264 (#6276) 2017-08-12 17:57:13 +08:00
lopesmcc
2ebb1bcaf0 [JAVA-VERTX] make Vertx client support running on different contexts (#6283)
* [java-vertx] make vertx client support running on different contexts

* [java-vertx] make vertx client support running on different contexts (samples)
2017-08-12 17:56:20 +08:00
mferguson-gb
bc633766f8 Retrofit2 rxjava2 adapter imports (#6294)
* Update retrofit2 rxjava2 adapter dependencies

* Update sample code
2017-08-12 17:34:03 +08:00
Michael Kaye
c2ababbb5b [swift3] empty model with only additional properties (#6273) 2017-08-12 01:03:37 +08:00
Jean-François Côté
ab28c7c825 [Java Play Framework] Remove most warnings + bug fixes (#6275)
* Removals of most of the warnings found by lint

* Removals of most of the warnings found by lint (PART 2)

* Removals of most of the warnings found by lint (PART 3)

* Removals of most of the warnings found by lint (PART 4)

* Removals of most of the warnings found by lint (PART 5)

* Fix conversion error

* Removal of unnecessary import. Other will need more complex login in the generator itself (not in the mustache files)

* Add missing imports + fix to the regex. Generation of the samples
2017-08-11 15:38:18 +08:00
Gökberk Karaca
b0333af8bd Fix unexpected text error in javadoc by replacing url with html tag (#6279) 2017-08-11 08:50:36 +08:00
stevecookform3
adfe4b6e6c add @Valid/@Validated annotations to controller methods/nested models (#6254)
* add @Valid/@Validated annotations to controller methods and nested models

* update spring samples
2017-08-11 08:44:51 +08:00
wing328
06686d65fa [Lua] Add new Lua client generator (#6252)
* 1st commit of lua generator

* add petstore sample

* various fixes based on feedback

* better return handling

* check status code 1st letter

* add support for query parameters, auth, body param

* more fixes based on daurnimator feedback

* more fixes based on daurnimator feedback

* fix a few more issues found by luac -p

* use lower case for http header key name

* more fixes based on feedback

* update lua sample

* skip auto-generated readme, doc, test files

* use tab instead of 2-space

* fix container return type

* fix cast method call

* fix cast function call
2017-08-11 01:41:29 +08:00
Jean-François Côté
1e991be5f3 [JavaPlayFramework] Fix for issue #6100 (#6128)
* Fix issue #6100. Tested with all the samples.

* Fix multiple issue with the examples. Removing all of this.
Adding fake endpoint .sh but it is not compiling right now.
2017-08-09 22:00:46 +08:00
Davide Zipeto
5c384d0f15 string used instead of bolean (#6268)
Deprecated should be a boolean otherwise the parser does not validate
2017-08-09 17:16:48 +08:00
Jean-François Côté
00b46e8a94 [Typescript-Jquery] Fix file upload (#6262)
* Fix a bug with the file upload that was not working

* Prevent unnecessary append to the FormData
2017-08-09 17:05:00 +08:00
wing328
c05db535e1 Merge branch 'issue-3371' of https://github.com/gcernier-amadeus/swagger-codegen into gcernier-amadeus-issue-3371b 2017-08-08 15:31:52 +08:00
Gökberk Karaca
53f9ae277b Add externalDocs support (#6255) 2017-08-08 01:11:00 +08:00
wing328
fca8d81b2b [JS] fix template directory for ES5 (#6253)
* fix #5845 (template dir)

* fix js petstore test case
2017-08-07 22:10:56 +08:00
wing328
cc848a1c24 fix replaceAll with replace 2017-08-06 17:52:19 +08:00
wing328
4cb7f1d613 [Rust] add new Rust client generator (#6105)
* add rust generator (1st release)

* update based on feedback

* fix reserved keyword

* fix string parameter

* Convert String to &str in trait definition

* Only pass pathParams to uri builder

* Fixed the html escaping in return type

* Fixed the hashmap constructor

* Added models into API scope

* removed models subimport, reference from super

* update returntype in method signature

* Fixed the remaining templates inconsistencies

* Fixed issues that floated up in kubernetes swagger file

* add hash support, fix docstring

* fix map parameter, update api.mustache

* use baseName for parameter

* use fully-qualfiied model name

* add rust tests

* fix test cases

* Rust gen slightly more idiomatic (#6247)

* Go -> Rust in README

* Remove leftover go file in rust sample

* rust: Regenerate sample

* rust: Rename *Impl -> *Client

* rust: one-line use line

More in line with common style

* rust: Replace tabs (in java) with 4 spaces

* Added trivial getter implementation (#6249)

* update rust petstore samples
2017-08-06 16:59:08 +08:00
wing328
ffe7f0fb86 fix typo in java docstring 2017-08-06 15:39:14 +08:00
wing328
18c57a65ed Fix returnBaseType in Map response (#6246)
* fix returnBaseType for map response

* fix javadoc string
2017-08-05 22:24:46 +08:00
Lars Wander
86f2ea5e3e [Java] okhttp-gson content-type fix for */* (#6232) 2017-08-05 00:47:52 +08:00
Javier Velilla
e4276853d7 Fixed typo in the Abstract Eiffel class. (#6239)
Fixed typo in shell script
Added support for Outer Enums, inner enums not supported.
Added missing UUID library in ecf template.
Improved Model inheritance.
2017-08-05 00:38:50 +08:00
Hans-Christian Esperer
3cb36738b1 Fix issue #6212 POD Generated podfile doesn't include all generated swift files #6212 (#6220)
* Reference all generated swift files in the podfile

* Update test files
2017-08-04 00:46:01 +08:00
Mark Thebridge
9cadfd45d7 Scala import fix (#6227)
* Fix typo in Scala import generation

* Update test files
2017-08-03 18:40:58 +08:00
mobreza
b4e0854823 Improved support for XML wrapped items (#6150)
* Improved support for XML wrapped items

* XML @annotation whitespace fixed
2017-08-03 16:44:17 +08:00
mobreza
b433afebdd withXml replaces useJaxbAnnotations (#6152)
* Regenerated bin/jaxrs-*

* Replace `useJaxbAnnotations` with `withXml`
2017-08-03 15:35:33 +08:00
ehyche
32906ea7ce Add Objective-C compatibility for Optional scalars in swift4 just as we added in swift3. (#6158)
This change adds Objective-C compatibility for Swift Optional scalars in the swift4 language just like we added in swift3 here:

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

It also adds unit tests for the swift4 language. Currently those unit tests are the same as the swift3 unit tests, but will change soon as we iterate on the swift4 language generator.
2017-08-02 21:19:48 +08:00
ehyche
dd46ba9ef6 Add additional cli option and properties to swift3 for Objective-C compatibility. (#6129)
Currently, in the swift3 language, if you have an optional integer, number, or boolean property in a model, then the generated swift3 model class might look like:

class SomeModel {
    var someInt: Int?
    var someFloat: Float?
    var someDouble: Double?
    var someBool: Bool?
}

This works fine if you are accessing this model only from Swift code. However, it is very common for iOS codebases to contain both Swift AND Objective-C. If you need to access this model from Objective-C, then those 4 properties are not accessible, since Optional scalars do not translate to Objective-C.

Therefore, in the swift3 language, we want to add some code for Objective-C compatibility:

1. We add a "objCompatible" boolean command-line option. If objCompatible=true, then this enables some additional code generation to make these types of properties accessible from Objective-C. If objCompatible=false, then the generated code is exactly as it currently is. The default is objcCopmatible=false.

2. If objCompatible=true, then for these types of Objective-C-inaccessible properties (Optional scalars), then we add a "x-swift-optional-scalar=true" vendor extension in the CodegenProperty.

3. Then, in the model.mustache template, if we see x-swift-optional-scalar=true, then we add an additional computed property which returns an optional NSNumber.

So, for example, when objcCompatible=false (the default case), then the generated code for the "declawed" property of the Cat model looks like:

open class Cat: Animal {

    public var declawed: Bool?

    ...

But when objcCompatible=true, then it looks like:

open class Cat: Animal {

    public var declawed: Bool?
    public var declawedNum: NSNumber? {
        get {
            return declawed.map({ return NSNumber(value: $0) })
        }
    }

   ...
2017-08-02 18:20:01 +08:00
ToreJohansson
218273e9a8 Fixed x-example (#6195) 2017-08-02 18:14:35 +08:00
Chandan Singh
1c4e77585f Issue 6172 (#6173)
* Changes to allow field names as examples for string properties and multiple items in array during example generation

* Reverting the version to 2.3.0-SNAPSHOT and autogenerated petstore files
2017-08-02 17:59:54 +08:00
Jeff
6e72018a64 Add polymorphism support for python (#6208)
* Add polymorphism support for python

* Update api_client

* Remove leading spaces

* Bugfix

* Catch case where swagger_types is none but get_real_child_model is defined
2017-08-02 17:15:26 +08:00
ToreJohansson
34e5838924 Added all models to postProcessOperations (#6194)
* Added all models to postProcessOperations

* Added new postProcessOperationsWithModels
2017-08-02 16:14:34 +08:00
lopesmcc
66d48a0c71 [Java-VertX] Java Vertx client (#6204)
* #6165 - Java Vertx client

* #6165 - Java Vertx client (samples)

* #6165 - Java Vertx client (tests generation)

* #6165 - Java Vertx client (fixed test samples)
2017-07-31 20:04:11 +08:00
Mykola Yashchenko
be9a9a3837 [Java] Jersey, Jersey2 and Resteasy clients do not support HTTP-HEAD (#6210) 2017-07-31 19:03:25 +08:00
wing328
fab49e80a8 update Java jersey 1,2 to handle */* 2017-07-31 13:26:56 +08:00
Halil İbrahim Şener
182807ed9a [Java][Client] Add javax.validation.validation-api dependency for Bean Validation API support to jersey2 (#6203) 2017-07-31 13:15:44 +08:00
Halil İbrahim Şener
a6f981350e [Java][Client] Add PATCH method support for jersey2 (#6197) 2017-07-31 13:08:30 +08:00