Use ObjC reserved words only when objcCompatible is enabled (#2632)

* avoid whilelisting objc reseved words

* fix swift4 test

* add new files

* update swift4 tests
This commit is contained in:
William Cheng
2019-04-15 15:35:19 +08:00
committed by GitHub
parent 3ca7e6342f
commit da9ba4cd7d
116 changed files with 3001 additions and 811 deletions
+1 -1
View File
@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekit $@"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-promisekit.json -o samples/client/petstore/swift4/promisekit --generate-alias-as-model $@"
java $JAVA_OPTS -jar $executable $ags
+1 -1
View File
@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswift $@"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-rxswift.json -o samples/client/petstore/swift4/rxswift --generate-alias-as-model $@"
java $JAVA_OPTS -jar $executable $ags
+1 -1
View File
@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-unwrapRequired.json -o samples/client/petstore/swift4/unwrapRequired $@"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore-unwrapRequired.json -o samples/client/petstore/swift4/unwrapRequired --generate-alias-as-model $@"
java $JAVA_OPTS -jar $executable $ags
+1 -1
View File
@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore.json -o samples/client/petstore/swift4/default $@"
ags="generate -t modules/openapi-generator/src/main/resources/swift4 -i modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml -g swift4 -c ./bin/swift4-petstore.json -o samples/client/petstore/swift4/default --generate-alias-as-model $@"
java $JAVA_OPTS -jar $executable $ags
@@ -66,6 +66,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
protected boolean swiftUseApiNamespace;
protected String[] responseAs = new String[0];
protected String sourceFolder = "Classes" + File.separator + "OpenAPIs";
protected HashSet objcReservedWords;
/**
* Constructor for the swift4 language codegen module.
@@ -107,16 +108,20 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
"AnyObject",
"Any")
);
objcReservedWords = new HashSet<>(
Arrays.asList(
// Added for Objective-C compatibility
"id", "description", "NSArray", "NSURL", "CGFloat", "NSSet", "NSString", "NSInteger", "NSUInteger",
"NSError", "NSDictionary"
)
);
reservedWords = new HashSet<>(
Arrays.asList(
// name used by swift client
"ErrorResponse", "Response",
// Added for Objective-C compatibility
"id", "description", "NSArray", "NSURL", "CGFloat", "NSSet", "NSString", "NSInteger", "NSUInteger",
"NSError", "NSDictionary",
//
// Swift keywords. This list is taken from here:
// https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-ID410
//
@@ -326,6 +331,11 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
}
additionalProperties.put(OBJC_COMPATIBLE, objcCompatible);
// add objc reserved words
if (Boolean.TRUE.equals(objcCompatible)) {
reservedWords.addAll(objcReservedWords);
}
// Setup unwrapRequired option, which makes all the properties with "required" non-optional
if (additionalProperties.containsKey(RESPONSE_AS)) {
Object responseAsObject = additionalProperties.get(RESPONSE_AS);
@@ -59,7 +59,7 @@ public class Swift4ModelTest {
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "id");
Assert.assertEquals(property1.dataType, "Int64");
Assert.assertEquals(property1.name, "_id");
Assert.assertEquals(property1.name, "id");
Assert.assertNull(property1.defaultValue);
Assert.assertEquals(property1.baseType, "Int64");
Assert.assertTrue(property1.hasMore);
@@ -462,7 +462,7 @@ paths:
X-Expires-After:
type: string
format: date-time
description: date in UTC when toekn expires
description: date in UTC when token expires
'400':
description: Invalid username/password supplied
/user/logout:
@@ -492,7 +492,7 @@ paths:
parameters:
- name: username
in: path
description: 'The name that needs to be fetched. Use user1 for testing. '
description: 'The name that needs to be fetched. Use user1 for testing.'
required: true
type: string
responses:
@@ -606,9 +606,7 @@ paths:
description: To test enum parameters
operationId: testEnumParameters
consumes:
- application/x-www-form-urlencoded
produces:
- "*/*"
- "application/x-www-form-urlencoded"
parameters:
- name: enum_form_string_array
type: array
@@ -681,7 +679,7 @@ paths:
enum:
- 1.1
- -1.2
in: formData
in: query
description: Query parameter enum test (double)
responses:
'400':
@@ -704,9 +702,6 @@ paths:
operationId: testEndpointParameters
consumes:
- application/x-www-form-urlencoded
produces:
- application/xml; charset=utf-8
- application/json; charset=utf-8
parameters:
- name: integer
type: integer
@@ -797,6 +792,46 @@ paths:
description: User not found
security:
- http_basic_test: []
delete:
tags:
- fake
summary: Fake endpoint to test group parameters (optional)
description: Fake endpoint to test group parameters (optional)
operationId: testGroupParameters
x-group-parameters: true
parameters:
- name: required_string_group
type: integer
in: query
description: Required String in group parameters
required: true
- name: required_boolean_group
type: boolean
in: header
description: Required Boolean in group parameters
required: true
- name: required_int64_group
type: integer
format: int64
in: query
description: Required Integer in group parameters
required: true
- name: string_group
type: integer
in: query
description: String in group parameters
- name: boolean_group
type: boolean
in: header
description: Boolean in group parameters
- name: int64_group
type: integer
format: int64
in: query
description: Integer in group parameters
responses:
'400':
description: Someting wrong
/fake/outer/number:
post:
tags:
@@ -888,36 +923,54 @@ paths:
responses:
'200':
description: successful operation
#TODO comment out the following as swift can't handle inline additonal property at the moment
#
# /fake/inline-additionalProperties:
# post:
# tags:
# - fake
# summary: test inline additionalProperties
# description: ''
# operationId: testInlineAdditionalProperties
# consumes:
# - application/json
# parameters:
# - name: param
# in: body
# description: request body
# required: true
# schema:
# type: object
# additionalProperties:
# type: string
# responses:
# '200':
# description: successful operation
/fake/inline-additionalProperties:
post:
tags:
- fake
summary: test inline additionalProperties
description: ''
operationId: testInlineAdditionalProperties
consumes:
- application/json
parameters:
- name: param
in: body
description: request body
required: true
schema:
type: object
additionalProperties:
type: string
responses:
'200':
description: successful operation
/fake/body-with-query-params:
put:
tags:
- fake
operationId: testBodyWithQueryParams
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/User'
- name: query
in: query
required: true
type: string
consumes:
- application/json
responses:
'200':
description: Success
/another-fake/dummy:
patch:
tags:
- "$another-fake?"
summary: To test special tags
description: To test special tags
operationId: test_special_tags
description: To test special tags and operation ID starting with number
operationId: 123_test_@#$%_special_tags
consumes:
- application/json
produces:
@@ -934,6 +987,60 @@ paths:
description: successful operation
schema:
$ref: '#/definitions/Client'
/fake/body-with-file-schema:
put:
tags:
- fake
description: 'For this test, the body for this request much reference a schema named `File`.'
operationId: testBodyWithFileSchema
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/FileSchemaTestClass'
consumes:
- application/json
responses:
'200':
description: Success
'/fake/{petId}/uploadImageWithRequiredFile':
post:
tags:
- pet
summary: uploads an image (required)
description: ''
operationId: uploadFileWithRequiredFile
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: additionalMetadata
in: formData
description: Additional data to pass to server
required: false
type: string
- name: requiredFile
in: formData
description: file to upload
required: true
type: file
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/ApiResponse'
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
securityDefinitions:
petstore_auth:
type: oauth2
@@ -982,12 +1089,15 @@ definitions:
name: Order
Category:
type: object
required:
- name
properties:
id:
type: integer
format: int64
name:
type: string
default: default-name
xml:
name: Category
User:
@@ -1203,6 +1313,7 @@ definitions:
uuid:
type: string
format: uuid
example: 72f98069-206d-4f12-9f12-3d1e525a8e84
password:
type: string
format: password
@@ -1217,6 +1328,8 @@ definitions:
- (xyz)
Enum_Test:
type: object
required:
- enum_string_required
properties:
enum_string:
type: string
@@ -1224,6 +1337,12 @@ definitions:
- UPPER
- lower
- ''
enum_string_required:
type: string
enum:
- UPPER
- lower
- ''
enum_integer:
type: integer
format: int32
@@ -1241,11 +1360,11 @@ definitions:
AdditionalPropertiesClass:
type: object
properties:
map_property:
map_string:
type: object
additionalProperties:
type: string
map_of_map_property:
map_map_string:
type: object
additionalProperties:
type: object
@@ -1334,6 +1453,12 @@ definitions:
enum:
- UPPER
- lower
direct_map:
type: object
additionalProperties:
type: boolean
indirect_map:
$ref: "#/definitions/StringBooleanMap"
ArrayTest:
type: object
properties:
@@ -1410,7 +1535,7 @@ definitions:
# - Cat
# - Dog
OuterEnum:
type: "string"
type: string
enum:
- "placed"
- "approved"
@@ -1430,3 +1555,83 @@ definitions:
type: string
OuterBoolean:
type: boolean
x-codegen-body-parameter-name: boolean_post_body
StringBooleanMap:
additionalProperties:
type: boolean
FileSchemaTestClass:
type: object
properties:
file:
$ref: "#/definitions/File"
files:
type: array
items:
$ref: "#/definitions/File"
File:
type: object
description: 'Must be named `File` for test.'
properties:
sourceURI:
description: 'Test capitalization'
type: string
TypeHolderDefault:
type: object
required:
- string_item
- number_item
- integer_item
- bool_item
- array_item
properties:
string_item:
type: string
default: what
number_item:
type: number
default: 1.234
integer_item:
type: integer
default: -2
bool_item:
type: boolean
default: true
array_item:
type: array
items:
type: integer
default:
- 0
- 1
- 2
- 3
TypeHolderExample:
type: object
required:
- string_item
- number_item
- integer_item
- bool_item
- array_item
properties:
string_item:
type: string
example: what
number_item:
type: number
example: 1.234
integer_item:
type: integer
example: -2
bool_item:
type: boolean
example: true
array_item:
type: array
items:
type: integer
example:
- 0
- 1
- 2
- 3
@@ -14,11 +14,11 @@ open class AnotherFakeAPI {
/**
To test special tags
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func call123testSpecialTags(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
call123testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -27,13 +27,13 @@ open class AnotherFakeAPI {
To test special tags
- PATCH /another-fake/dummy
- To test special tags and operation ID starting with number
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func call123testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/another-fake/dummy"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -42,11 +42,11 @@ open class FakeAPI {
/**
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -54,13 +54,13 @@ open class FakeAPI {
/**
- POST /fake/outer/composite
- Test serialization of object with outer number type
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: RequestBuilder<OuterComposite>
*/
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let path = "/fake/outer/composite"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: outerComposite)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -129,11 +129,11 @@ open class FakeAPI {
/**
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (response, error) -> Void in
open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -145,13 +145,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-file-schema
- For this test, the body for this request much reference a schema named `File`.
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: FileSchemaTestClass) -> RequestBuilder<Void> {
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
let path = "/fake/body-with-file-schema"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: fileSchemaTestClass)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -163,11 +163,11 @@ open class FakeAPI {
/**
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testBodyWithQueryParams(query: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in
open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -179,13 +179,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-query-params
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder<Void> {
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
let path = "/fake/body-with-query-params"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
@@ -200,11 +200,11 @@ open class FakeAPI {
/**
To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -213,13 +213,13 @@ open class FakeAPI {
To test \"client\" model
- PATCH /fake
- To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -502,11 +502,11 @@ open class FakeAPI {
/**
test inline additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testInlineAdditionalProperties(requestBody: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in
open class func testInlineAdditionalProperties(param: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -518,13 +518,13 @@ open class FakeAPI {
/**
test inline additionalProperties
- POST /fake/inline-additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: RequestBuilder<Void>
*/
open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String:String]) -> RequestBuilder<Void> {
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class FakeClassnameTags123API {
/**
To test class name in snake case
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClassname(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func testClassname(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -30,13 +30,13 @@ open class FakeClassnameTags123API {
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake_classname_test"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class PetAPI {
/**
Add a new pet to the store
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter completion: completion handler to receive the data and the error objects
*/
open class func addPet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
open class func addPet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -33,13 +33,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -77,7 +77,7 @@ open class PetAPI {
*/
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -201,7 +201,7 @@ open class PetAPI {
*/
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -217,11 +217,11 @@ open class PetAPI {
/**
Update an existing pet
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updatePet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
open class func updatePet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -236,13 +236,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -282,7 +282,7 @@ open class PetAPI {
*/
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -328,7 +328,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
var path = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -374,7 +374,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> {
var path = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -36,7 +36,7 @@ open class StoreAPI {
*/
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -102,7 +102,7 @@ open class StoreAPI {
*/
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -118,11 +118,11 @@ open class StoreAPI {
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- parameter completion: completion handler to receive the data and the error objects
*/
open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -130,13 +130,13 @@ open class StoreAPI {
/**
Place an order for a pet
- POST /store/order
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: RequestBuilder<Order>
*/
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: order)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class UserAPI {
/**
Create user
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUser(user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUser(body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -31,13 +31,13 @@ open class UserAPI {
Create user
- POST /user
- This can only be done by the logged in user.
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: RequestBuilder<Void>
*/
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -49,11 +49,11 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -65,13 +65,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithArray
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -83,11 +83,11 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithListInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUsersWithListInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -99,13 +99,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithList
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -139,7 +139,7 @@ open class UserAPI {
*/
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -172,7 +172,7 @@ open class UserAPI {
*/
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -258,11 +258,11 @@ open class UserAPI {
Updated user
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updateUser(username: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
open class func updateUser(username: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -276,16 +276,16 @@ open class UserAPI {
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: RequestBuilder<Void>
*/
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -11,17 +11,17 @@ import Foundation
public struct AdditionalPropertiesClass: Codable {
public var mapProperty: [String:String]?
public var mapOfMapProperty: [String:[String:String]]?
public var mapString: [String:String]?
public var mapMapString: [String:[String:String]]?
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
self.mapProperty = mapProperty
self.mapOfMapProperty = mapOfMapProperty
public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) {
self.mapString = mapString
self.mapMapString = mapMapString
}
public enum CodingKeys: String, CodingKey {
case mapProperty = "map_property"
case mapOfMapProperty = "map_of_map_property"
case mapString = "map_string"
case mapMapString = "map_map_string"
}
@@ -11,19 +11,14 @@ import Foundation
public struct Category: Codable {
public var _id: Int64?
public var id: Int64?
public var name: String = "default-name"
public init(_id: Int64?, name: String) {
self._id = _id
public init(id: Int64?, name: String) {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case name
}
}
@@ -18,9 +18,9 @@ public struct MapTest: Codable {
public var mapMapOfString: [String:[String:String]]?
public var mapOfEnumString: [String:String]?
public var directMap: [String:Bool]?
public var indirectMap: [String:Bool]?
public var indirectMap: StringBooleanMap?
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: [String:Bool]?) {
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) {
self.mapMapOfString = mapMapOfString
self.mapOfEnumString = mapOfEnumString
self.directMap = directMap
@@ -16,7 +16,7 @@ public struct Order: Codable {
case approved = "approved"
case delivered = "delivered"
}
public var _id: Int64?
public var id: Int64?
public var petId: Int64?
public var quantity: Int?
public var shipDate: Date?
@@ -24,8 +24,8 @@ public struct Order: Codable {
public var status: Status?
public var complete: Bool? = false
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
self._id = _id
public init(id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
self.id = id
self.petId = petId
self.quantity = quantity
self.shipDate = shipDate
@@ -33,15 +33,6 @@ public struct Order: Codable {
self.complete = complete
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case petId
case quantity
case shipDate
case status
case complete
}
}
@@ -16,7 +16,7 @@ public struct Pet: Codable {
case pending = "pending"
case sold = "sold"
}
public var _id: Int64?
public var id: Int64?
public var category: Category?
public var name: String
public var photoUrls: [String]
@@ -24,8 +24,8 @@ public struct Pet: Codable {
/** pet status in the store */
public var status: Status?
public init(_id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
self._id = _id
public init(id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
self.id = id
self.category = category
self.name = name
self.photoUrls = photoUrls
@@ -33,15 +33,6 @@ public struct Pet: Codable {
self.status = status
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case category
case name
case photoUrls
case tags
case status
}
}
@@ -11,19 +11,14 @@ import Foundation
public struct Tag: Codable {
public var _id: Int64?
public var id: Int64?
public var name: String?
public init(_id: Int64?, name: String?) {
self._id = _id
public init(id: Int64?, name: String?) {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case name
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderDefault.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderDefault: Codable {
public var stringItem: String = "what"
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool = true
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderExample.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderExample: Codable {
public var stringItem: String
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -11,7 +11,7 @@ import Foundation
public struct User: Codable {
public var _id: Int64?
public var id: Int64?
public var username: String?
public var firstName: String?
public var lastName: String?
@@ -21,8 +21,8 @@ public struct User: Codable {
/** User Status */
public var userStatus: Int?
public init(_id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
self._id = _id
public init(id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
self.id = id
self.username = username
self.firstName = firstName
self.lastName = lastName
@@ -32,17 +32,6 @@ public struct User: Codable {
self.userStatus = userStatus
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case username
case firstName
case lastName
case email
case password
case phone
case userStatus
}
}
@@ -26,11 +26,11 @@ class PetAPITests: XCTestCase {
func test1CreatePet() {
let expectation = self.expectation(description: "testCreatePet")
let category = PetstoreClient.Category(_id: 1234, name: "eyeColor")
let tags = [Tag(_id: 1234, name: "New York"), Tag(_id: 124321, name: "Jose")]
let newPet = Pet(_id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
let category = PetstoreClient.Category(id: 1234, name: "eyeColor")
let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")]
let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
PetAPI.addPet(pet: newPet) { (response, error) in
PetAPI.addPet(body: newPet) { (response, error) in
guard error == nil else {
XCTFail("error creating pet")
return
@@ -52,7 +52,7 @@ class PetAPITests: XCTestCase {
}
if let pet = pet {
XCTAssert(pet._id == 1000, "invalid id")
XCTAssert(pet.id == 1000, "invalid id")
XCTAssert(pet.name == "Fluffy", "invalid name")
expectation.fulfill()
@@ -19,17 +19,17 @@ class StoreAPITests: XCTestCase {
func test1PlaceOrder() {
// use explicit naming to reference the enum so that we test we don't regress on enum naming
let shipDate = Date()
let order = Order(_id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let order = Order(id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let expectation = self.expectation(description: "testPlaceOrder")
StoreAPI.placeOrder(order: order) { (order, error) in
StoreAPI.placeOrder(body: order) { (order, error) in
guard error == nil else {
XCTFail("error placing order: \(error.debugDescription)")
return
}
if let order = order {
XCTAssert(order._id == 1000, "invalid id")
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
XCTAssert(order.shipDate!.isEqual(shipDate, format: self.isoDateFormat),
@@ -52,7 +52,7 @@ class StoreAPITests: XCTestCase {
}
if let order = order {
XCTAssert(order._id == 1000, "invalid id")
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
@@ -1,3 +1,3 @@
#!/bin/sh
xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=12.1" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=12.1" | xcpretty && exit ${PIPESTATUS[0]}
xcodebuild clean build build-for-testing -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=12.2" && xcodebuild test-without-building -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" -destination "platform=iOS Simulator,name=iPhone 8,OS=12.2" | xcpretty && exit ${PIPESTATUS[0]}
@@ -45,6 +45,12 @@ public struct APIHelper {
})
}
public static func mapValueToPathItem(_ source: Any) -> Any {
if let collection = source as? Array<Any?> {
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
}
return source
}
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
@@ -14,11 +14,11 @@ open class AnotherFakeAPI {
/**
To test special tags
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func call123testSpecialTags(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
call123testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -27,13 +27,13 @@ open class AnotherFakeAPI {
To test special tags
- PATCH /another-fake/dummy
- To test special tags and operation ID starting with number
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func call123testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/another-fake/dummy"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -11,6 +11,41 @@ import Alamofire
open class FakeAPI {
/**
creates an XmlItem
- parameter xmlItem: (body) XmlItem Body
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createXmlItem(xmlItem: XmlItem, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createXmlItemWithRequestBuilder(xmlItem: xmlItem).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
completion(nil, error)
}
}
}
/**
creates an XmlItem
- POST /fake/create_xml_item
- this route creates an XmlItem
- parameter xmlItem: (body) XmlItem Body
- returns: RequestBuilder<Void>
*/
open class func createXmlItemWithRequestBuilder(xmlItem: XmlItem) -> RequestBuilder<Void> {
let path = "/fake/create_xml_item"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: xmlItem)
let url = URLComponents(string: URLString)
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
}
/**
- parameter body: (body) Input boolean as post body (optional)
@@ -42,11 +77,11 @@ open class FakeAPI {
/**
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -54,13 +89,13 @@ open class FakeAPI {
/**
- POST /fake/outer/composite
- Test serialization of object with outer number type
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: RequestBuilder<OuterComposite>
*/
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let path = "/fake/outer/composite"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: outerComposite)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -129,11 +164,11 @@ open class FakeAPI {
/**
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (response, error) -> Void in
open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -145,13 +180,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-file-schema
- For this test, the body for this request much reference a schema named `File`.
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: FileSchemaTestClass) -> RequestBuilder<Void> {
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
let path = "/fake/body-with-file-schema"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: fileSchemaTestClass)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -163,11 +198,11 @@ open class FakeAPI {
/**
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testBodyWithQueryParams(query: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in
open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -179,13 +214,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-query-params
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder<Void> {
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
let path = "/fake/body-with-query-params"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
@@ -200,11 +235,11 @@ open class FakeAPI {
/**
To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -213,13 +248,13 @@ open class FakeAPI {
To test \"client\" model
- PATCH /fake
- To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -502,11 +537,11 @@ open class FakeAPI {
/**
test inline additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testInlineAdditionalProperties(requestBody: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in
open class func testInlineAdditionalProperties(param: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -518,13 +553,13 @@ open class FakeAPI {
/**
test inline additionalProperties
- POST /fake/inline-additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: RequestBuilder<Void>
*/
open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String:String]) -> RequestBuilder<Void> {
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class FakeClassnameTags123API {
/**
To test class name in snake case
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClassname(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func testClassname(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -30,13 +30,13 @@ open class FakeClassnameTags123API {
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake_classname_test"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class PetAPI {
/**
Add a new pet to the store
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter completion: completion handler to receive the data and the error objects
*/
open class func addPet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
open class func addPet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -33,13 +33,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -77,7 +77,7 @@ open class PetAPI {
*/
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -201,7 +201,7 @@ open class PetAPI {
*/
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -217,11 +217,11 @@ open class PetAPI {
/**
Update an existing pet
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updatePet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
open class func updatePet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -236,13 +236,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -282,7 +282,7 @@ open class PetAPI {
*/
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -328,7 +328,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
var path = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -374,7 +374,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> {
var path = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -36,7 +36,7 @@ open class StoreAPI {
*/
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -102,7 +102,7 @@ open class StoreAPI {
*/
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -118,11 +118,11 @@ open class StoreAPI {
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- parameter completion: completion handler to receive the data and the error objects
*/
open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -130,13 +130,13 @@ open class StoreAPI {
/**
Place an order for a pet
- POST /store/order
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: RequestBuilder<Order>
*/
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: order)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class UserAPI {
/**
Create user
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUser(user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUser(body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -31,13 +31,13 @@ open class UserAPI {
Create user
- POST /user
- This can only be done by the logged in user.
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: RequestBuilder<Void>
*/
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -49,11 +49,11 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -65,13 +65,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithArray
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -83,11 +83,11 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithListInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUsersWithListInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -99,13 +99,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithList
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -139,7 +139,7 @@ open class UserAPI {
*/
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -172,7 +172,7 @@ open class UserAPI {
*/
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -258,11 +258,11 @@ open class UserAPI {
Updated user
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updateUser(username: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
open class func updateUser(username: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -276,16 +276,16 @@ open class UserAPI {
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: RequestBuilder<Void>
*/
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesAnyType.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesAnyType: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Any] = [:]
public subscript(key: String) -> Any? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Any.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesArray.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesArray: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Array] = [:]
public subscript(key: String) -> Array? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Array.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesBoolean.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesBoolean: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Bool] = [:]
public subscript(key: String) -> Bool? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -11,17 +11,44 @@ import Foundation
public struct AdditionalPropertiesClass: Codable {
public var mapProperty: [String:String]?
public var mapOfMapProperty: [String:[String:String]]?
public var mapString: [String:String]?
public var mapNumber: [String:Double]?
public var mapInteger: [String:Int]?
public var mapBoolean: [String:Bool]?
public var mapArrayInteger: [String:[Int]]?
public var mapArrayAnytype: [String:[Any]]?
public var mapMapString: [String:[String:String]]?
public var mapMapAnytype: [String:[String:Any]]?
public var anytype1: Any?
public var anytype2: Any?
public var anytype3: Any?
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
self.mapProperty = mapProperty
self.mapOfMapProperty = mapOfMapProperty
public init(mapString: [String:String]?, mapNumber: [String:Double]?, mapInteger: [String:Int]?, mapBoolean: [String:Bool]?, mapArrayInteger: [String:[Int]]?, mapArrayAnytype: [String:[Any]]?, mapMapString: [String:[String:String]]?, mapMapAnytype: [String:[String:Any]]?, anytype1: Any?, anytype2: Any?, anytype3: Any?) {
self.mapString = mapString
self.mapNumber = mapNumber
self.mapInteger = mapInteger
self.mapBoolean = mapBoolean
self.mapArrayInteger = mapArrayInteger
self.mapArrayAnytype = mapArrayAnytype
self.mapMapString = mapMapString
self.mapMapAnytype = mapMapAnytype
self.anytype1 = anytype1
self.anytype2 = anytype2
self.anytype3 = anytype3
}
public enum CodingKeys: String, CodingKey {
case mapProperty = "map_property"
case mapOfMapProperty = "map_of_map_property"
case mapString = "map_string"
case mapNumber = "map_number"
case mapInteger = "map_integer"
case mapBoolean = "map_boolean"
case mapArrayInteger = "map_array_integer"
case mapArrayAnytype = "map_array_anytype"
case mapMapString = "map_map_string"
case mapMapAnytype = "map_map_anytype"
case anytype1 = "anytype_1"
case anytype2 = "anytype_2"
case anytype3 = "anytype_3"
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesInteger.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesInteger: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Int] = [:]
public subscript(key: String) -> Int? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Int.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesNumber.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesNumber: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Double] = [:]
public subscript(key: String) -> Double? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Double.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesObject.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesObject: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Dictionary] = [:]
public subscript(key: String) -> Dictionary? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Dictionary.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesString.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesString: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:String] = [:]
public subscript(key: String) -> String? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(String.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderDefault.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderDefault: Codable {
public var stringItem: String = "what"
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool = true
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderExample.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderExample: Codable {
public var stringItem: String
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -0,0 +1,110 @@
//
// XmlItem.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct XmlItem: Codable {
public var attributeString: String?
public var attributeNumber: Double?
public var attributeInteger: Int?
public var attributeBoolean: Bool?
public var wrappedArray: [Int]?
public var nameString: String?
public var nameNumber: Double?
public var nameInteger: Int?
public var nameBoolean: Bool?
public var nameArray: [Int]?
public var nameWrappedArray: [Int]?
public var prefixString: String?
public var prefixNumber: Double?
public var prefixInteger: Int?
public var prefixBoolean: Bool?
public var prefixArray: [Int]?
public var prefixWrappedArray: [Int]?
public var namespaceString: String?
public var namespaceNumber: Double?
public var namespaceInteger: Int?
public var namespaceBoolean: Bool?
public var namespaceArray: [Int]?
public var namespaceWrappedArray: [Int]?
public var prefixNsString: String?
public var prefixNsNumber: Double?
public var prefixNsInteger: Int?
public var prefixNsBoolean: Bool?
public var prefixNsArray: [Int]?
public var prefixNsWrappedArray: [Int]?
public init(attributeString: String?, attributeNumber: Double?, attributeInteger: Int?, attributeBoolean: Bool?, wrappedArray: [Int]?, nameString: String?, nameNumber: Double?, nameInteger: Int?, nameBoolean: Bool?, nameArray: [Int]?, nameWrappedArray: [Int]?, prefixString: String?, prefixNumber: Double?, prefixInteger: Int?, prefixBoolean: Bool?, prefixArray: [Int]?, prefixWrappedArray: [Int]?, namespaceString: String?, namespaceNumber: Double?, namespaceInteger: Int?, namespaceBoolean: Bool?, namespaceArray: [Int]?, namespaceWrappedArray: [Int]?, prefixNsString: String?, prefixNsNumber: Double?, prefixNsInteger: Int?, prefixNsBoolean: Bool?, prefixNsArray: [Int]?, prefixNsWrappedArray: [Int]?) {
self.attributeString = attributeString
self.attributeNumber = attributeNumber
self.attributeInteger = attributeInteger
self.attributeBoolean = attributeBoolean
self.wrappedArray = wrappedArray
self.nameString = nameString
self.nameNumber = nameNumber
self.nameInteger = nameInteger
self.nameBoolean = nameBoolean
self.nameArray = nameArray
self.nameWrappedArray = nameWrappedArray
self.prefixString = prefixString
self.prefixNumber = prefixNumber
self.prefixInteger = prefixInteger
self.prefixBoolean = prefixBoolean
self.prefixArray = prefixArray
self.prefixWrappedArray = prefixWrappedArray
self.namespaceString = namespaceString
self.namespaceNumber = namespaceNumber
self.namespaceInteger = namespaceInteger
self.namespaceBoolean = namespaceBoolean
self.namespaceArray = namespaceArray
self.namespaceWrappedArray = namespaceWrappedArray
self.prefixNsString = prefixNsString
self.prefixNsNumber = prefixNsNumber
self.prefixNsInteger = prefixNsInteger
self.prefixNsBoolean = prefixNsBoolean
self.prefixNsArray = prefixNsArray
self.prefixNsWrappedArray = prefixNsWrappedArray
}
public enum CodingKeys: String, CodingKey {
case attributeString = "attribute_string"
case attributeNumber = "attribute_number"
case attributeInteger = "attribute_integer"
case attributeBoolean = "attribute_boolean"
case wrappedArray = "wrapped_array"
case nameString = "name_string"
case nameNumber = "name_number"
case nameInteger = "name_integer"
case nameBoolean = "name_boolean"
case nameArray = "name_array"
case nameWrappedArray = "name_wrapped_array"
case prefixString = "prefix_string"
case prefixNumber = "prefix_number"
case prefixInteger = "prefix_integer"
case prefixBoolean = "prefix_boolean"
case prefixArray = "prefix_array"
case prefixWrappedArray = "prefix_wrapped_array"
case namespaceString = "namespace_string"
case namespaceNumber = "namespace_number"
case namespaceInteger = "namespace_integer"
case namespaceBoolean = "namespace_boolean"
case namespaceArray = "namespace_array"
case namespaceWrappedArray = "namespace_wrapped_array"
case prefixNsString = "prefix_ns_string"
case prefixNsNumber = "prefix_ns_number"
case prefixNsInteger = "prefix_ns_integer"
case prefixNsBoolean = "prefix_ns_boolean"
case prefixNsArray = "prefix_ns_array"
case prefixNsWrappedArray = "prefix_ns_wrapped_array"
}
}
@@ -45,6 +45,12 @@ public struct APIHelper {
})
}
public static func mapValueToPathItem(_ source: Any) -> Any {
if let collection = source as? Array<Any?> {
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
}
return source
}
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
@@ -15,12 +15,12 @@ open class AnotherFakeAPI {
/**
To test special tags
- parameter client: (body) client model
- parameter body: (body) client model
- returns: Promise<Client>
*/
open class func call123testSpecialTags( client: Client) -> Promise<Client> {
open class func call123testSpecialTags( body: Client) -> Promise<Client> {
let deferred = Promise<Client>.pending()
call123testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else if let response = response {
@@ -36,13 +36,13 @@ open class AnotherFakeAPI {
To test special tags
- PATCH /another-fake/dummy
- To test special tags and operation ID starting with number
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func call123testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/another-fake/dummy"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -51,12 +51,12 @@ open class FakeAPI {
/**
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: Promise<OuterComposite>
*/
open class func fakeOuterCompositeSerialize( outerComposite: OuterComposite? = nil) -> Promise<OuterComposite> {
open class func fakeOuterCompositeSerialize( body: OuterComposite? = nil) -> Promise<OuterComposite> {
let deferred = Promise<OuterComposite>.pending()
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else if let response = response {
@@ -71,13 +71,13 @@ open class FakeAPI {
/**
- POST /fake/outer/composite
- Test serialization of object with outer number type
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: RequestBuilder<OuterComposite>
*/
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let path = "/fake/outer/composite"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: outerComposite)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -162,12 +162,12 @@ open class FakeAPI {
/**
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: Promise<Void>
*/
open class func testBodyWithFileSchema( fileSchemaTestClass: FileSchemaTestClass) -> Promise<Void> {
open class func testBodyWithFileSchema( body: FileSchemaTestClass) -> Promise<Void> {
let deferred = Promise<Void>.pending()
testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (response, error) -> Void in
testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -180,13 +180,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-file-schema
- For this test, the body for this request much reference a schema named `File`.
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: FileSchemaTestClass) -> RequestBuilder<Void> {
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
let path = "/fake/body-with-file-schema"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: fileSchemaTestClass)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -198,12 +198,12 @@ open class FakeAPI {
/**
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: Promise<Void>
*/
open class func testBodyWithQueryParams( query: String, user: User) -> Promise<Void> {
open class func testBodyWithQueryParams( query: String, body: User) -> Promise<Void> {
let deferred = Promise<Void>.pending()
testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -216,13 +216,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-query-params
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder<Void> {
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
let path = "/fake/body-with-query-params"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
@@ -237,12 +237,12 @@ open class FakeAPI {
/**
To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: Promise<Client>
*/
open class func testClientModel( client: Client) -> Promise<Client> {
open class func testClientModel( body: Client) -> Promise<Client> {
let deferred = Promise<Client>.pending()
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else if let response = response {
@@ -258,13 +258,13 @@ open class FakeAPI {
To test \"client\" model
- PATCH /fake
- To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -553,12 +553,12 @@ open class FakeAPI {
/**
test inline additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: Promise<Void>
*/
open class func testInlineAdditionalProperties( requestBody: [String:String]) -> Promise<Void> {
open class func testInlineAdditionalProperties( param: [String:String]) -> Promise<Void> {
let deferred = Promise<Void>.pending()
testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -571,13 +571,13 @@ open class FakeAPI {
/**
test inline additionalProperties
- POST /fake/inline-additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: RequestBuilder<Void>
*/
open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String:String]) -> RequestBuilder<Void> {
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let url = URLComponents(string: URLString)
@@ -15,12 +15,12 @@ open class FakeClassnameTags123API {
/**
To test class name in snake case
- parameter client: (body) client model
- parameter body: (body) client model
- returns: Promise<Client>
*/
open class func testClassname( client: Client) -> Promise<Client> {
open class func testClassname( body: Client) -> Promise<Client> {
let deferred = Promise<Client>.pending()
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else if let response = response {
@@ -39,13 +39,13 @@ open class FakeClassnameTags123API {
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake_classname_test"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -15,12 +15,12 @@ open class PetAPI {
/**
Add a new pet to the store
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: Promise<Void>
*/
open class func addPet( pet: Pet) -> Promise<Void> {
open class func addPet( body: Pet) -> Promise<Void> {
let deferred = Promise<Void>.pending()
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -36,13 +36,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -82,7 +82,7 @@ open class PetAPI {
*/
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -230,7 +230,7 @@ open class PetAPI {
*/
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -246,12 +246,12 @@ open class PetAPI {
/**
Update an existing pet
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: Promise<Void>
*/
open class func updatePet( pet: Pet) -> Promise<Void> {
open class func updatePet( body: Pet) -> Promise<Void> {
let deferred = Promise<Void>.pending()
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -267,13 +267,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -315,7 +315,7 @@ open class PetAPI {
*/
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -369,7 +369,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
var path = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -423,7 +423,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> {
var path = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -39,7 +39,7 @@ open class StoreAPI {
*/
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -121,7 +121,7 @@ open class StoreAPI {
*/
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -137,12 +137,12 @@ open class StoreAPI {
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: Promise<Order>
*/
open class func placeOrder( order: Order) -> Promise<Order> {
open class func placeOrder( body: Order) -> Promise<Order> {
let deferred = Promise<Order>.pending()
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else if let response = response {
@@ -157,13 +157,13 @@ open class StoreAPI {
/**
Place an order for a pet
- POST /store/order
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: RequestBuilder<Order>
*/
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: order)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -15,12 +15,12 @@ open class UserAPI {
/**
Create user
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: Promise<Void>
*/
open class func createUser( user: User) -> Promise<Void> {
open class func createUser( body: User) -> Promise<Void> {
let deferred = Promise<Void>.pending()
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -34,13 +34,13 @@ open class UserAPI {
Create user
- POST /user
- This can only be done by the logged in user.
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: RequestBuilder<Void>
*/
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -52,12 +52,12 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: Promise<Void>
*/
open class func createUsersWithArrayInput( user: [User]) -> Promise<Void> {
open class func createUsersWithArrayInput( body: [User]) -> Promise<Void> {
let deferred = Promise<Void>.pending()
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -70,13 +70,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithArray
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -88,12 +88,12 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: Promise<Void>
*/
open class func createUsersWithListInput( user: [User]) -> Promise<Void> {
open class func createUsersWithListInput( body: [User]) -> Promise<Void> {
let deferred = Promise<Void>.pending()
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -106,13 +106,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithList
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -148,7 +148,7 @@ open class UserAPI {
*/
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -189,7 +189,7 @@ open class UserAPI {
*/
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -285,12 +285,12 @@ open class UserAPI {
Updated user
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: Promise<Void>
*/
open class func updateUser( username: String, user: User) -> Promise<Void> {
open class func updateUser( username: String, body: User) -> Promise<Void> {
let deferred = Promise<Void>.pending()
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
if let error = error {
deferred.reject(error)
} else {
@@ -305,16 +305,16 @@ open class UserAPI {
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: RequestBuilder<Void>
*/
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -11,17 +11,17 @@ import Foundation
public struct AdditionalPropertiesClass: Codable {
public var mapProperty: [String:String]?
public var mapOfMapProperty: [String:[String:String]]?
public var mapString: [String:String]?
public var mapMapString: [String:[String:String]]?
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
self.mapProperty = mapProperty
self.mapOfMapProperty = mapOfMapProperty
public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) {
self.mapString = mapString
self.mapMapString = mapMapString
}
public enum CodingKeys: String, CodingKey {
case mapProperty = "map_property"
case mapOfMapProperty = "map_of_map_property"
case mapString = "map_string"
case mapMapString = "map_map_string"
}
@@ -11,19 +11,14 @@ import Foundation
public struct Category: Codable {
public var _id: Int64?
public var id: Int64?
public var name: String = "default-name"
public init(_id: Int64?, name: String) {
self._id = _id
public init(id: Int64?, name: String) {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case name
}
}
@@ -18,9 +18,9 @@ public struct MapTest: Codable {
public var mapMapOfString: [String:[String:String]]?
public var mapOfEnumString: [String:String]?
public var directMap: [String:Bool]?
public var indirectMap: [String:Bool]?
public var indirectMap: StringBooleanMap?
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: [String:Bool]?) {
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) {
self.mapMapOfString = mapMapOfString
self.mapOfEnumString = mapOfEnumString
self.directMap = directMap
@@ -16,7 +16,7 @@ public struct Order: Codable {
case approved = "approved"
case delivered = "delivered"
}
public var _id: Int64?
public var id: Int64?
public var petId: Int64?
public var quantity: Int?
public var shipDate: Date?
@@ -24,8 +24,8 @@ public struct Order: Codable {
public var status: Status?
public var complete: Bool? = false
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
self._id = _id
public init(id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
self.id = id
self.petId = petId
self.quantity = quantity
self.shipDate = shipDate
@@ -33,15 +33,6 @@ public struct Order: Codable {
self.complete = complete
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case petId
case quantity
case shipDate
case status
case complete
}
}
@@ -16,7 +16,7 @@ public struct Pet: Codable {
case pending = "pending"
case sold = "sold"
}
public var _id: Int64?
public var id: Int64?
public var category: Category?
public var name: String
public var photoUrls: [String]
@@ -24,8 +24,8 @@ public struct Pet: Codable {
/** pet status in the store */
public var status: Status?
public init(_id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
self._id = _id
public init(id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
self.id = id
self.category = category
self.name = name
self.photoUrls = photoUrls
@@ -33,15 +33,6 @@ public struct Pet: Codable {
self.status = status
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case category
case name
case photoUrls
case tags
case status
}
}
@@ -11,19 +11,14 @@ import Foundation
public struct Tag: Codable {
public var _id: Int64?
public var id: Int64?
public var name: String?
public init(_id: Int64?, name: String?) {
self._id = _id
public init(id: Int64?, name: String?) {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case name
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderDefault.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderDefault: Codable {
public var stringItem: String = "what"
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool = true
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderExample.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderExample: Codable {
public var stringItem: String
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -11,7 +11,7 @@ import Foundation
public struct User: Codable {
public var _id: Int64?
public var id: Int64?
public var username: String?
public var firstName: String?
public var lastName: String?
@@ -21,8 +21,8 @@ public struct User: Codable {
/** User Status */
public var userStatus: Int?
public init(_id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
self._id = _id
public init(id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
self.id = id
self.username = username
self.firstName = firstName
self.lastName = lastName
@@ -32,17 +32,6 @@ public struct User: Codable {
self.userStatus = userStatus
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case username
case firstName
case lastName
case email
case password
case phone
case userStatus
}
}
@@ -0,0 +1,110 @@
//
// XmlItem.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct XmlItem: Codable {
public var attributeString: String?
public var attributeNumber: Double?
public var attributeInteger: Int?
public var attributeBoolean: Bool?
public var wrappedArray: [Int]?
public var nameString: String?
public var nameNumber: Double?
public var nameInteger: Int?
public var nameBoolean: Bool?
public var nameArray: [Int]?
public var nameWrappedArray: [Int]?
public var prefixString: String?
public var prefixNumber: Double?
public var prefixInteger: Int?
public var prefixBoolean: Bool?
public var prefixArray: [Int]?
public var prefixWrappedArray: [Int]?
public var namespaceString: String?
public var namespaceNumber: Double?
public var namespaceInteger: Int?
public var namespaceBoolean: Bool?
public var namespaceArray: [Int]?
public var namespaceWrappedArray: [Int]?
public var prefixNsString: String?
public var prefixNsNumber: Double?
public var prefixNsInteger: Int?
public var prefixNsBoolean: Bool?
public var prefixNsArray: [Int]?
public var prefixNsWrappedArray: [Int]?
public init(attributeString: String?, attributeNumber: Double?, attributeInteger: Int?, attributeBoolean: Bool?, wrappedArray: [Int]?, nameString: String?, nameNumber: Double?, nameInteger: Int?, nameBoolean: Bool?, nameArray: [Int]?, nameWrappedArray: [Int]?, prefixString: String?, prefixNumber: Double?, prefixInteger: Int?, prefixBoolean: Bool?, prefixArray: [Int]?, prefixWrappedArray: [Int]?, namespaceString: String?, namespaceNumber: Double?, namespaceInteger: Int?, namespaceBoolean: Bool?, namespaceArray: [Int]?, namespaceWrappedArray: [Int]?, prefixNsString: String?, prefixNsNumber: Double?, prefixNsInteger: Int?, prefixNsBoolean: Bool?, prefixNsArray: [Int]?, prefixNsWrappedArray: [Int]?) {
self.attributeString = attributeString
self.attributeNumber = attributeNumber
self.attributeInteger = attributeInteger
self.attributeBoolean = attributeBoolean
self.wrappedArray = wrappedArray
self.nameString = nameString
self.nameNumber = nameNumber
self.nameInteger = nameInteger
self.nameBoolean = nameBoolean
self.nameArray = nameArray
self.nameWrappedArray = nameWrappedArray
self.prefixString = prefixString
self.prefixNumber = prefixNumber
self.prefixInteger = prefixInteger
self.prefixBoolean = prefixBoolean
self.prefixArray = prefixArray
self.prefixWrappedArray = prefixWrappedArray
self.namespaceString = namespaceString
self.namespaceNumber = namespaceNumber
self.namespaceInteger = namespaceInteger
self.namespaceBoolean = namespaceBoolean
self.namespaceArray = namespaceArray
self.namespaceWrappedArray = namespaceWrappedArray
self.prefixNsString = prefixNsString
self.prefixNsNumber = prefixNsNumber
self.prefixNsInteger = prefixNsInteger
self.prefixNsBoolean = prefixNsBoolean
self.prefixNsArray = prefixNsArray
self.prefixNsWrappedArray = prefixNsWrappedArray
}
public enum CodingKeys: String, CodingKey {
case attributeString = "attribute_string"
case attributeNumber = "attribute_number"
case attributeInteger = "attribute_integer"
case attributeBoolean = "attribute_boolean"
case wrappedArray = "wrapped_array"
case nameString = "name_string"
case nameNumber = "name_number"
case nameInteger = "name_integer"
case nameBoolean = "name_boolean"
case nameArray = "name_array"
case nameWrappedArray = "name_wrapped_array"
case prefixString = "prefix_string"
case prefixNumber = "prefix_number"
case prefixInteger = "prefix_integer"
case prefixBoolean = "prefix_boolean"
case prefixArray = "prefix_array"
case prefixWrappedArray = "prefix_wrapped_array"
case namespaceString = "namespace_string"
case namespaceNumber = "namespace_number"
case namespaceInteger = "namespace_integer"
case namespaceBoolean = "namespace_boolean"
case namespaceArray = "namespace_array"
case namespaceWrappedArray = "namespace_wrapped_array"
case prefixNsString = "prefix_ns_string"
case prefixNsNumber = "prefix_ns_number"
case prefixNsInteger = "prefix_ns_integer"
case prefixNsBoolean = "prefix_ns_boolean"
case prefixNsArray = "prefix_ns_array"
case prefixNsWrappedArray = "prefix_ns_wrapped_array"
}
}
@@ -27,11 +27,11 @@ class PetAPITests: XCTestCase {
func test1CreatePet() {
let expectation = self.expectation(description: "testCreatePet")
let category = PetstoreClient.Category(_id: 1234, name: "eyeColor")
let tags = [Tag(_id: 1234, name: "New York"), Tag(_id: 124321, name: "Jose")]
let newPet = Pet(_id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
let category = PetstoreClient.Category(id: 1234, name: "eyeColor")
let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")]
let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
PetAPI.addPet(pet: newPet).then {
PetAPI.addPet(body: newPet).then {
expectation.fulfill()
}.always {
// Noop for now
@@ -44,7 +44,7 @@ class PetAPITests: XCTestCase {
func test2GetPet() {
let expectation = self.expectation(description: "testGetPet")
PetAPI.getPetById(petId: 1000).then { pet -> Void in
XCTAssert(pet._id == 1000, "invalid id")
XCTAssert(pet.id == 1000, "invalid id")
XCTAssert(pet.name == "Fluffy", "invalid name")
expectation.fulfill()
}.always {
@@ -20,10 +20,10 @@ class StoreAPITests: XCTestCase {
func test1PlaceOrder() {
// use explicit naming to reference the enum so that we test we don't regress on enum naming
let shipDate = Date()
let order = Order(_id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let order = Order(id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let expectation = self.expectation(description: "testPlaceOrder")
StoreAPI.placeOrder(order: order).then { order -> Void in
XCTAssert(order._id == 1000, "invalid id")
StoreAPI.placeOrder(body: order).then { order -> Void in
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
XCTAssert(order.shipDate!.isEqual(shipDate, format: self.isoDateFormat),
@@ -41,7 +41,7 @@ class StoreAPITests: XCTestCase {
func test2GetOrder() {
let expectation = self.expectation(description: "testGetOrder")
StoreAPI.getOrderById(orderId: 1000).then { order -> Void in
XCTAssert(order._id == 1000, "invalid id")
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
expectation.fulfill()
@@ -1,3 +1,3 @@
#!/bin/sh
xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=12.1" | xcpretty && exit ${PIPESTATUS[0]}
xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=12.2" | xcpretty && exit ${PIPESTATUS[0]}
@@ -45,6 +45,12 @@ public struct APIHelper {
})
}
public static func mapValueToPathItem(_ source: Any) -> Any {
if let collection = source as? Array<Any?> {
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
}
return source
}
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
@@ -15,12 +15,12 @@ open class AnotherFakeAPI {
/**
To test special tags
- parameter client: (body) client model
- parameter body: (body) client model
- returns: Observable<Client>
*/
open class func call123testSpecialTags(client: Client) -> Observable<Client> {
open class func call123testSpecialTags(body: Client) -> Observable<Client> {
return Observable.create { observer -> Disposable in
call123testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else if let response = response {
@@ -38,13 +38,13 @@ open class AnotherFakeAPI {
To test special tags
- PATCH /another-fake/dummy
- To test special tags and operation ID starting with number
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func call123testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/another-fake/dummy"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -53,12 +53,12 @@ open class FakeAPI {
/**
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: Observable<OuterComposite>
*/
open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil) -> Observable<OuterComposite> {
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil) -> Observable<OuterComposite> {
return Observable.create { observer -> Disposable in
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else if let response = response {
@@ -75,13 +75,13 @@ open class FakeAPI {
/**
- POST /fake/outer/composite
- Test serialization of object with outer number type
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: RequestBuilder<OuterComposite>
*/
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let path = "/fake/outer/composite"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: outerComposite)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -170,12 +170,12 @@ open class FakeAPI {
/**
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: Observable<Void>
*/
open class func testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass) -> Observable<Void> {
open class func testBodyWithFileSchema(body: FileSchemaTestClass) -> Observable<Void> {
return Observable.create { observer -> Disposable in
testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (response, error) -> Void in
testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -190,13 +190,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-file-schema
- For this test, the body for this request much reference a schema named `File`.
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: FileSchemaTestClass) -> RequestBuilder<Void> {
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
let path = "/fake/body-with-file-schema"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: fileSchemaTestClass)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -208,12 +208,12 @@ open class FakeAPI {
/**
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: Observable<Void>
*/
open class func testBodyWithQueryParams(query: String, user: User) -> Observable<Void> {
open class func testBodyWithQueryParams(query: String, body: User) -> Observable<Void> {
return Observable.create { observer -> Disposable in
testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -228,13 +228,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-query-params
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder<Void> {
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
let path = "/fake/body-with-query-params"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
@@ -249,12 +249,12 @@ open class FakeAPI {
/**
To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: Observable<Client>
*/
open class func testClientModel(client: Client) -> Observable<Client> {
open class func testClientModel(body: Client) -> Observable<Client> {
return Observable.create { observer -> Disposable in
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else if let response = response {
@@ -272,13 +272,13 @@ open class FakeAPI {
To test \"client\" model
- PATCH /fake
- To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -573,12 +573,12 @@ open class FakeAPI {
/**
test inline additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: Observable<Void>
*/
open class func testInlineAdditionalProperties(requestBody: [String:String]) -> Observable<Void> {
open class func testInlineAdditionalProperties(param: [String:String]) -> Observable<Void> {
return Observable.create { observer -> Disposable in
testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -593,13 +593,13 @@ open class FakeAPI {
/**
test inline additionalProperties
- POST /fake/inline-additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: RequestBuilder<Void>
*/
open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String:String]) -> RequestBuilder<Void> {
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let url = URLComponents(string: URLString)
@@ -15,12 +15,12 @@ open class FakeClassnameTags123API {
/**
To test class name in snake case
- parameter client: (body) client model
- parameter body: (body) client model
- returns: Observable<Client>
*/
open class func testClassname(client: Client) -> Observable<Client> {
open class func testClassname(body: Client) -> Observable<Client> {
return Observable.create { observer -> Disposable in
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else if let response = response {
@@ -41,13 +41,13 @@ open class FakeClassnameTags123API {
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake_classname_test"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -15,12 +15,12 @@ open class PetAPI {
/**
Add a new pet to the store
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: Observable<Void>
*/
open class func addPet(pet: Pet) -> Observable<Void> {
open class func addPet(body: Pet) -> Observable<Void> {
return Observable.create { observer -> Disposable in
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -38,13 +38,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -86,7 +86,7 @@ open class PetAPI {
*/
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -240,7 +240,7 @@ open class PetAPI {
*/
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -256,12 +256,12 @@ open class PetAPI {
/**
Update an existing pet
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: Observable<Void>
*/
open class func updatePet(pet: Pet) -> Observable<Void> {
open class func updatePet(body: Pet) -> Observable<Void> {
return Observable.create { observer -> Disposable in
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -279,13 +279,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -329,7 +329,7 @@ open class PetAPI {
*/
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -385,7 +385,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
var path = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -441,7 +441,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> {
var path = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -41,7 +41,7 @@ open class StoreAPI {
*/
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -127,7 +127,7 @@ open class StoreAPI {
*/
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -143,12 +143,12 @@ open class StoreAPI {
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: Observable<Order>
*/
open class func placeOrder(order: Order) -> Observable<Order> {
open class func placeOrder(body: Order) -> Observable<Order> {
return Observable.create { observer -> Disposable in
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else if let response = response {
@@ -165,13 +165,13 @@ open class StoreAPI {
/**
Place an order for a pet
- POST /store/order
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: RequestBuilder<Order>
*/
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: order)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -15,12 +15,12 @@ open class UserAPI {
/**
Create user
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: Observable<Void>
*/
open class func createUser(user: User) -> Observable<Void> {
open class func createUser(body: User) -> Observable<Void> {
return Observable.create { observer -> Disposable in
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -36,13 +36,13 @@ open class UserAPI {
Create user
- POST /user
- This can only be done by the logged in user.
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: RequestBuilder<Void>
*/
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -54,12 +54,12 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: Observable<Void>
*/
open class func createUsersWithArrayInput(user: [User]) -> Observable<Void> {
open class func createUsersWithArrayInput(body: [User]) -> Observable<Void> {
return Observable.create { observer -> Disposable in
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -74,13 +74,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithArray
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -92,12 +92,12 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: Observable<Void>
*/
open class func createUsersWithListInput(user: [User]) -> Observable<Void> {
open class func createUsersWithListInput(body: [User]) -> Observable<Void> {
return Observable.create { observer -> Disposable in
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -112,13 +112,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithList
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -156,7 +156,7 @@ open class UserAPI {
*/
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -199,7 +199,7 @@ open class UserAPI {
*/
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -299,12 +299,12 @@ open class UserAPI {
Updated user
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: Observable<Void>
*/
open class func updateUser(username: String, user: User) -> Observable<Void> {
open class func updateUser(username: String, body: User) -> Observable<Void> {
return Observable.create { observer -> Disposable in
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
if let error = error {
observer.onError(error)
} else {
@@ -321,16 +321,16 @@ open class UserAPI {
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: RequestBuilder<Void>
*/
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesAnyType.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesAnyType: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Any] = [:]
public subscript(key: String) -> Any? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Any.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesArray.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesArray: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Array] = [:]
public subscript(key: String) -> Array? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Array.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesBoolean.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesBoolean: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Bool] = [:]
public subscript(key: String) -> Bool? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -11,17 +11,17 @@ import Foundation
public struct AdditionalPropertiesClass: Codable {
public var mapProperty: [String:String]?
public var mapOfMapProperty: [String:[String:String]]?
public var mapString: [String:String]?
public var mapMapString: [String:[String:String]]?
public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) {
self.mapProperty = mapProperty
self.mapOfMapProperty = mapOfMapProperty
public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) {
self.mapString = mapString
self.mapMapString = mapMapString
}
public enum CodingKeys: String, CodingKey {
case mapProperty = "map_property"
case mapOfMapProperty = "map_of_map_property"
case mapString = "map_string"
case mapMapString = "map_map_string"
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesInteger.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesInteger: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Int] = [:]
public subscript(key: String) -> Int? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Int.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesNumber.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesNumber: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Double] = [:]
public subscript(key: String) -> Double? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Double.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesObject.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesObject: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Dictionary] = [:]
public subscript(key: String) -> Dictionary? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Dictionary.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesString.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesString: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:String] = [:]
public subscript(key: String) -> String? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(String.self, excludedKeys: nonAdditionalPropertyKeys)
}
}
@@ -11,19 +11,14 @@ import Foundation
public struct Category: Codable {
public var _id: Int64?
public var id: Int64?
public var name: String = "default-name"
public init(_id: Int64?, name: String) {
self._id = _id
public init(id: Int64?, name: String) {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case name
}
}
@@ -18,9 +18,9 @@ public struct MapTest: Codable {
public var mapMapOfString: [String:[String:String]]?
public var mapOfEnumString: [String:String]?
public var directMap: [String:Bool]?
public var indirectMap: [String:Bool]?
public var indirectMap: StringBooleanMap?
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: [String:Bool]?) {
public init(mapMapOfString: [String:[String:String]]?, mapOfEnumString: [String:String]?, directMap: [String:Bool]?, indirectMap: StringBooleanMap?) {
self.mapMapOfString = mapMapOfString
self.mapOfEnumString = mapOfEnumString
self.directMap = directMap
@@ -16,7 +16,7 @@ public struct Order: Codable {
case approved = "approved"
case delivered = "delivered"
}
public var _id: Int64?
public var id: Int64?
public var petId: Int64?
public var quantity: Int?
public var shipDate: Date?
@@ -24,8 +24,8 @@ public struct Order: Codable {
public var status: Status?
public var complete: Bool? = false
public init(_id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
self._id = _id
public init(id: Int64?, petId: Int64?, quantity: Int?, shipDate: Date?, status: Status?, complete: Bool?) {
self.id = id
self.petId = petId
self.quantity = quantity
self.shipDate = shipDate
@@ -33,15 +33,6 @@ public struct Order: Codable {
self.complete = complete
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case petId
case quantity
case shipDate
case status
case complete
}
}
@@ -16,7 +16,7 @@ public struct Pet: Codable {
case pending = "pending"
case sold = "sold"
}
public var _id: Int64?
public var id: Int64?
public var category: Category?
public var name: String
public var photoUrls: [String]
@@ -24,8 +24,8 @@ public struct Pet: Codable {
/** pet status in the store */
public var status: Status?
public init(_id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
self._id = _id
public init(id: Int64?, category: Category?, name: String, photoUrls: [String], tags: [Tag]?, status: Status?) {
self.id = id
self.category = category
self.name = name
self.photoUrls = photoUrls
@@ -33,15 +33,6 @@ public struct Pet: Codable {
self.status = status
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case category
case name
case photoUrls
case tags
case status
}
}
@@ -11,19 +11,14 @@ import Foundation
public struct Tag: Codable {
public var _id: Int64?
public var id: Int64?
public var name: String?
public init(_id: Int64?, name: String?) {
self._id = _id
public init(id: Int64?, name: String?) {
self.id = id
self.name = name
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case name
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderDefault.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderDefault: Codable {
public var stringItem: String = "what"
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool = true
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -0,0 +1,38 @@
//
// TypeHolderExample.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct TypeHolderExample: Codable {
public var stringItem: String
public var numberItem: Double
public var integerItem: Int
public var boolItem: Bool
public var arrayItem: [Int]
public init(stringItem: String, numberItem: Double, integerItem: Int, boolItem: Bool, arrayItem: [Int]) {
self.stringItem = stringItem
self.numberItem = numberItem
self.integerItem = integerItem
self.boolItem = boolItem
self.arrayItem = arrayItem
}
public enum CodingKeys: String, CodingKey {
case stringItem = "string_item"
case numberItem = "number_item"
case integerItem = "integer_item"
case boolItem = "bool_item"
case arrayItem = "array_item"
}
}
@@ -11,7 +11,7 @@ import Foundation
public struct User: Codable {
public var _id: Int64?
public var id: Int64?
public var username: String?
public var firstName: String?
public var lastName: String?
@@ -21,8 +21,8 @@ public struct User: Codable {
/** User Status */
public var userStatus: Int?
public init(_id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
self._id = _id
public init(id: Int64?, username: String?, firstName: String?, lastName: String?, email: String?, password: String?, phone: String?, userStatus: Int?) {
self.id = id
self.username = username
self.firstName = firstName
self.lastName = lastName
@@ -32,17 +32,6 @@ public struct User: Codable {
self.userStatus = userStatus
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case username
case firstName
case lastName
case email
case password
case phone
case userStatus
}
}
@@ -0,0 +1,110 @@
//
// XmlItem.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct XmlItem: Codable {
public var attributeString: String?
public var attributeNumber: Double?
public var attributeInteger: Int?
public var attributeBoolean: Bool?
public var wrappedArray: [Int]?
public var nameString: String?
public var nameNumber: Double?
public var nameInteger: Int?
public var nameBoolean: Bool?
public var nameArray: [Int]?
public var nameWrappedArray: [Int]?
public var prefixString: String?
public var prefixNumber: Double?
public var prefixInteger: Int?
public var prefixBoolean: Bool?
public var prefixArray: [Int]?
public var prefixWrappedArray: [Int]?
public var namespaceString: String?
public var namespaceNumber: Double?
public var namespaceInteger: Int?
public var namespaceBoolean: Bool?
public var namespaceArray: [Int]?
public var namespaceWrappedArray: [Int]?
public var prefixNsString: String?
public var prefixNsNumber: Double?
public var prefixNsInteger: Int?
public var prefixNsBoolean: Bool?
public var prefixNsArray: [Int]?
public var prefixNsWrappedArray: [Int]?
public init(attributeString: String?, attributeNumber: Double?, attributeInteger: Int?, attributeBoolean: Bool?, wrappedArray: [Int]?, nameString: String?, nameNumber: Double?, nameInteger: Int?, nameBoolean: Bool?, nameArray: [Int]?, nameWrappedArray: [Int]?, prefixString: String?, prefixNumber: Double?, prefixInteger: Int?, prefixBoolean: Bool?, prefixArray: [Int]?, prefixWrappedArray: [Int]?, namespaceString: String?, namespaceNumber: Double?, namespaceInteger: Int?, namespaceBoolean: Bool?, namespaceArray: [Int]?, namespaceWrappedArray: [Int]?, prefixNsString: String?, prefixNsNumber: Double?, prefixNsInteger: Int?, prefixNsBoolean: Bool?, prefixNsArray: [Int]?, prefixNsWrappedArray: [Int]?) {
self.attributeString = attributeString
self.attributeNumber = attributeNumber
self.attributeInteger = attributeInteger
self.attributeBoolean = attributeBoolean
self.wrappedArray = wrappedArray
self.nameString = nameString
self.nameNumber = nameNumber
self.nameInteger = nameInteger
self.nameBoolean = nameBoolean
self.nameArray = nameArray
self.nameWrappedArray = nameWrappedArray
self.prefixString = prefixString
self.prefixNumber = prefixNumber
self.prefixInteger = prefixInteger
self.prefixBoolean = prefixBoolean
self.prefixArray = prefixArray
self.prefixWrappedArray = prefixWrappedArray
self.namespaceString = namespaceString
self.namespaceNumber = namespaceNumber
self.namespaceInteger = namespaceInteger
self.namespaceBoolean = namespaceBoolean
self.namespaceArray = namespaceArray
self.namespaceWrappedArray = namespaceWrappedArray
self.prefixNsString = prefixNsString
self.prefixNsNumber = prefixNsNumber
self.prefixNsInteger = prefixNsInteger
self.prefixNsBoolean = prefixNsBoolean
self.prefixNsArray = prefixNsArray
self.prefixNsWrappedArray = prefixNsWrappedArray
}
public enum CodingKeys: String, CodingKey {
case attributeString = "attribute_string"
case attributeNumber = "attribute_number"
case attributeInteger = "attribute_integer"
case attributeBoolean = "attribute_boolean"
case wrappedArray = "wrapped_array"
case nameString = "name_string"
case nameNumber = "name_number"
case nameInteger = "name_integer"
case nameBoolean = "name_boolean"
case nameArray = "name_array"
case nameWrappedArray = "name_wrapped_array"
case prefixString = "prefix_string"
case prefixNumber = "prefix_number"
case prefixInteger = "prefix_integer"
case prefixBoolean = "prefix_boolean"
case prefixArray = "prefix_array"
case prefixWrappedArray = "prefix_wrapped_array"
case namespaceString = "namespace_string"
case namespaceNumber = "namespace_number"
case namespaceInteger = "namespace_integer"
case namespaceBoolean = "namespace_boolean"
case namespaceArray = "namespace_array"
case namespaceWrappedArray = "namespace_wrapped_array"
case prefixNsString = "prefix_ns_string"
case prefixNsNumber = "prefix_ns_number"
case prefixNsInteger = "prefix_ns_integer"
case prefixNsBoolean = "prefix_ns_boolean"
case prefixNsArray = "prefix_ns_array"
case prefixNsWrappedArray = "prefix_ns_wrapped_array"
}
}
@@ -28,11 +28,11 @@ class PetAPITests: XCTestCase {
func test1CreatePet() {
let expectation = self.expectation(description: "testCreatePet")
let category = PetstoreClient.Category(_id: 1234, name: "eyeColor")
let tags = [Tag(_id: 1234, name: "New York"), Tag(_id: 124321, name: "Jose")]
let newPet = Pet(_id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
let category = PetstoreClient.Category(id: 1234, name: "eyeColor")
let tags = [Tag(id: 1234, name: "New York"), Tag(id: 124321, name: "Jose")]
let newPet = Pet(id: 1000, category: category, name: "Fluffy", photoUrls: ["https://petstore.com/sample/photo1.jpg", "https://petstore.com/sample/photo2.jpg"], tags: tags, status: .available)
PetAPI.addPet(pet: newPet).subscribe(onNext: {
PetAPI.addPet(body: newPet).subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType in
XCTFail("error creating pet")
@@ -43,17 +43,17 @@ class PetAPITests: XCTestCase {
func test2GetPet() {
let expectation = self.expectation(description: "testGetPet")
PetAPI.getPetById(petId: 1000).subscribe(onNext: { pet in
XCTAssert(pet._id == 1000, "invalid id")
XCTAssert(pet.id == 1000, "invalid id")
XCTAssert(pet.name == "Fluffy", "invalid name")
XCTAssert(pet.category!._id == 1234, "invalid category id")
XCTAssert(pet.category!.id == 1234, "invalid category id")
XCTAssert(pet.category!.name == "eyeColor", "invalid category name")
let tag1 = pet.tags![0]
XCTAssert(tag1._id == 1234, "invalid tag id")
XCTAssert(tag1.id == 1234, "invalid tag id")
XCTAssert(tag1.name == "New York", "invalid tag name")
let tag2 = pet.tags![1]
XCTAssert(tag2._id == 124321, "invalid tag id")
XCTAssert(tag2.id == 124321, "invalid tag id")
XCTAssert(tag2.name == "Jose", "invalid tag name")
XCTAssert(pet.photoUrls[0] == "https://petstore.com/sample/photo1.jpg")
@@ -21,10 +21,10 @@ class StoreAPITests: XCTestCase {
func test1PlaceOrder() {
// use explicit naming to reference the enum so that we test we don't regress on enum naming
let shipDate = Date()
let order = Order(_id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let order = Order(id: 1000, petId: 1000, quantity: 10, shipDate: shipDate, status: .placed, complete: true)
let expectation = self.expectation(description: "testPlaceOrder")
StoreAPI.placeOrder(order: order).subscribe(onNext: { order in
XCTAssert(order._id == 1000, "invalid id")
StoreAPI.placeOrder(body: order).subscribe(onNext: { order in
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
XCTAssert(order.shipDate!.isEqual(shipDate, format: self.isoDateFormat),
@@ -41,7 +41,7 @@ class StoreAPITests: XCTestCase {
func test2GetOrder() {
let expectation = self.expectation(description: "testGetOrder")
StoreAPI.getOrderById(orderId: 1000).subscribe(onNext: { order -> Void in
XCTAssert(order._id == 1000, "invalid id")
XCTAssert(order.id == 1000, "invalid id")
XCTAssert(order.quantity == 10, "invalid quantity")
XCTAssert(order.status == .placed, "invalid status")
XCTAssert(order.complete == true, "invalid complete")
@@ -67,8 +67,8 @@ class UserAPITests: XCTestCase {
func test1CreateUser() {
let expectation = self.expectation(description: "testCreateUser")
let newUser = User(_id: 1000, username: "test@test.com", firstName: "Test", lastName: "Tester", email: "test@test.com", password: "test!", phone: "867-5309", userStatus: 0)
UserAPI.createUser(user: newUser).subscribe(onNext: {
let newUser = User(id: 1000, username: "test@test.com", firstName: "Test", lastName: "Tester", email: "test@test.com", password: "test!", phone: "867-5309", userStatus: 0)
UserAPI.createUser(body: newUser).subscribe(onNext: {
expectation.fulfill()
}, onError: { errorType in
// The server gives us no data back so alamofire parsing fails - at least
@@ -1,3 +1,3 @@
#!/bin/sh
xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=12.1" | xcpretty && exit ${PIPESTATUS[0]}
xcodebuild -workspace "SwaggerClient.xcworkspace" -scheme "SwaggerClient" test -destination "platform=iOS Simulator,name=iPhone 8,OS=12.2" | xcpretty && exit ${PIPESTATUS[0]}
@@ -0,0 +1,7 @@
#/bin/bash
set -e
mvn -f default/SwaggerClientTests/pom.xml integration-test
mvn -f promisekit/SwaggerClientTests/pom.xml integration-test
mvn -f rxswift/SwaggerClientTests/pom.xml integration-test
@@ -45,6 +45,12 @@ public struct APIHelper {
})
}
public static func mapValueToPathItem(_ source: Any) -> Any {
if let collection = source as? Array<Any?> {
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
}
return source
}
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
@@ -14,11 +14,11 @@ open class AnotherFakeAPI {
/**
To test special tags
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func call123testSpecialTags(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
call123testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func call123testSpecialTags(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
call123testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -27,13 +27,13 @@ open class AnotherFakeAPI {
To test special tags
- PATCH /another-fake/dummy
- To test special tags and operation ID starting with number
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func call123testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func call123testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/another-fake/dummy"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -42,11 +42,11 @@ open class FakeAPI {
/**
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -54,13 +54,13 @@ open class FakeAPI {
/**
- POST /fake/outer/composite
- Test serialization of object with outer number type
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter body: (body) Input composite as post body (optional)
- returns: RequestBuilder<OuterComposite>
*/
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let path = "/fake/outer/composite"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: outerComposite)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -129,11 +129,11 @@ open class FakeAPI {
/**
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (response, error) -> Void in
open class func testBodyWithFileSchema(body: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithFileSchemaWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -145,13 +145,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-file-schema
- For this test, the body for this request much reference a schema named `File`.
- parameter fileSchemaTestClass: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: FileSchemaTestClass) -> RequestBuilder<Void> {
open class func testBodyWithFileSchemaWithRequestBuilder(body: FileSchemaTestClass) -> RequestBuilder<Void> {
let path = "/fake/body-with-file-schema"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: fileSchemaTestClass)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -163,11 +163,11 @@ open class FakeAPI {
/**
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testBodyWithQueryParams(query: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in
open class func testBodyWithQueryParams(query: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -179,13 +179,13 @@ open class FakeAPI {
/**
- PUT /fake/body-with-query-params
- parameter query: (query)
- parameter user: (body)
- parameter body: (body)
- returns: RequestBuilder<Void>
*/
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder<Void> {
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, body: User) -> RequestBuilder<Void> {
let path = "/fake/body-with-query-params"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems([
@@ -200,11 +200,11 @@ open class FakeAPI {
/**
To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -213,13 +213,13 @@ open class FakeAPI {
To test \"client\" model
- PATCH /fake
- To test \"client\" model
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -502,11 +502,11 @@ open class FakeAPI {
/**
test inline additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testInlineAdditionalProperties(requestBody: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in
open class func testInlineAdditionalProperties(param: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -518,13 +518,13 @@ open class FakeAPI {
/**
test inline additionalProperties
- POST /fake/inline-additionalProperties
- parameter requestBody: (body) request body
- parameter param: (body) request body
- returns: RequestBuilder<Void>
*/
open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String:String]) -> RequestBuilder<Void> {
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: [String:String]) -> RequestBuilder<Void> {
let path = "/fake/inline-additionalProperties"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class FakeClassnameTags123API {
/**
To test class name in snake case
- parameter client: (body) client model
- parameter body: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClassname(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
open class func testClassname(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -30,13 +30,13 @@ open class FakeClassnameTags123API {
- API Key:
- type: apiKey api_key_query (QUERY)
- name: api_key_query
- parameter client: (body) client model
- parameter body: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
let path = "/fake_classname_test"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class PetAPI {
/**
Add a new pet to the store
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter completion: completion handler to receive the data and the error objects
*/
open class func addPet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
open class func addPet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -33,13 +33,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -77,7 +77,7 @@ open class PetAPI {
*/
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -201,7 +201,7 @@ open class PetAPI {
*/
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -217,11 +217,11 @@ open class PetAPI {
/**
Update an existing pet
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updatePet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
open class func updatePet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -236,13 +236,13 @@ open class PetAPI {
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter pet: (body) Pet object that needs to be added to the store
- parameter body: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -282,7 +282,7 @@ open class PetAPI {
*/
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
var path = "/pet/{petId}"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -328,7 +328,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
var path = "/pet/{petId}/uploadImage"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -374,7 +374,7 @@ open class PetAPI {
*/
open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder<ApiResponse> {
var path = "/fake/{petId}/uploadImageWithRequiredFile"
let petIdPreEscape = "\(petId)"
let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))"
let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -36,7 +36,7 @@ open class StoreAPI {
*/
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -102,7 +102,7 @@ open class StoreAPI {
*/
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
var path = "/store/order/{order_id}"
let orderIdPreEscape = "\(orderId)"
let orderIdPreEscape = "\(APIHelper.mapValueToPathItem(orderId))"
let orderIdPostEscape = orderIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{order_id}", with: orderIdPostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -118,11 +118,11 @@ open class StoreAPI {
/**
Place an order for a pet
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- parameter completion: completion handler to receive the data and the error objects
*/
open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@@ -130,13 +130,13 @@ open class StoreAPI {
/**
Place an order for a pet
- POST /store/order
- parameter order: (body) order placed for purchasing the pet
- parameter body: (body) order placed for purchasing the pet
- returns: RequestBuilder<Order>
*/
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: order)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -14,11 +14,11 @@ open class UserAPI {
/**
Create user
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUser(user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUser(body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -31,13 +31,13 @@ open class UserAPI {
Create user
- POST /user
- This can only be done by the logged in user.
- parameter user: (body) Created user object
- parameter body: (body) Created user object
- returns: RequestBuilder<Void>
*/
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -49,11 +49,11 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -65,13 +65,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithArray
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -83,11 +83,11 @@ open class UserAPI {
/**
Creates list of users with given input array
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithListInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
open class func createUsersWithListInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -99,13 +99,13 @@ open class UserAPI {
/**
Creates list of users with given input array
- POST /user/createWithList
- parameter user: (body) List of user object
- parameter body: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -139,7 +139,7 @@ open class UserAPI {
*/
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -172,7 +172,7 @@ open class UserAPI {
*/
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
@@ -258,11 +258,11 @@ open class UserAPI {
Updated user
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updateUser(username: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
open class func updateUser(username: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
if error == nil {
completion((), error)
} else {
@@ -276,16 +276,16 @@ open class UserAPI {
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter user: (body) Updated user object
- parameter body: (body) Updated user object
- returns: RequestBuilder<Void>
*/
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(username)"
let usernamePreEscape = "\(APIHelper.mapValueToPathItem(username))"
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
let url = URLComponents(string: URLString)
@@ -0,0 +1,58 @@
//
// AdditionalPropertiesAnyType.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
public struct AdditionalPropertiesAnyType: Codable {
public var name: String?
public init(name: String?) {
self.name = name
}
public var additionalProperties: [String:Any] = [:]
public subscript(key: String) -> Any? {
get {
if let value = additionalProperties[key] {
return value
}
return nil
}
set {
additionalProperties[key] = newValue
}
}
// Encodable protocol methods
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: String.self)
try container.encodeIfPresent(name, forKey: "name")
try container.encodeMap(additionalProperties)
}
// Decodable protocol methods
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: String.self)
name = try container.decodeIfPresent(String.self, forKey: "name")
var nonAdditionalPropertyKeys = Set<String>()
nonAdditionalPropertyKeys.insert("name")
additionalProperties = try container.decodeMap(Any.self, excludedKeys: nonAdditionalPropertyKeys)
}
}

Some files were not shown because too many files have changed in this diff Show More