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
* 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
* 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
* [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
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")
}
}
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.
*