Commit Graph

3573 Commits

Author SHA1 Message Date
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
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
wing328
28a5b74dbf add partial header to haskell http client (#6606) 2017-10-02 23:52:01 +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
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
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
wing328
3ac2b803f9 [Elixir] Add Elixir Petstore sample to Shippable CI (#6575)
* add elixir petstore to shippable ci

* use oracle sdk
2017-09-27 20:53:27 +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
wing328
451218bfb0 Merge branch 'master' of https://github.com/swagger-api/swagger-codegen 2017-09-26 17:16:31 +08:00
wing328
c53ebf6c45 add "npm run build" to ts angular 2017-09-26 17:10:08 +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
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
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
wing328
209158aa9d update ts jquery petstore samples 2017-09-23 17:07:21 +08:00
wing328
16678b8106 update ts angular v2, v4 petstore samples 2017-09-23 15:55:14 +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
wing328
b1e7a4f724 update cpprest petstore samples 2017-09-23 15:45:17 +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
wing328
e27d4577c1 update perl petstore sample 2017-09-19 10:20:47 +08:00
Larry Bordowitz
65d788396b [6313] Add imports to perl objects. (#6500) 2017-09-19 10:11:38 +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
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