From 6992aa613abee139426f7ad60694354d0912454d Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 10 Apr 2019 00:37:32 +0800 Subject: [PATCH 1/4] avoid whilelisting objc reseved words --- .../codegen/languages/Swift4Codegen.java | 20 +++- .../OpenAPIs/APIs/AnotherFakeAPI.swift | 12 +-- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 95 ++++++++++++------ .../APIs/FakeClassnameTags123API.swift | 12 +-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 34 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 16 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 54 +++++----- .../Models/AdditionalPropertiesClass.swift | 43 ++++++-- .../Classes/OpenAPIs/Models/Category.swift | 11 +-- .../Classes/OpenAPIs/Models/Order.swift | 15 +-- .../Classes/OpenAPIs/Models/Pet.swift | 15 +-- .../Classes/OpenAPIs/Models/Tag.swift | 11 +-- .../Classes/OpenAPIs/Models/User.swift | 17 +--- .../Classes/OpenAPIs/APIHelper.swift | 6 ++ .../OpenAPIs/APIs/AnotherFakeAPI.swift | 12 +-- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 95 ++++++++++++------ .../APIs/FakeClassnameTags123API.swift | 12 +-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 34 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 16 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 54 +++++----- .../Models/AdditionalPropertiesClass.swift | 43 ++++++-- .../Classes/OpenAPIs/APIHelper.swift | 6 ++ .../OpenAPIs/APIs/AnotherFakeAPI.swift | 12 +-- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 97 ++++++++++++------ .../APIs/FakeClassnameTags123API.swift | 12 +-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 34 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 16 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 54 +++++----- .../Models/AdditionalPropertiesClass.swift | 43 ++++++-- .../Classes/OpenAPIs/Models/Category.swift | 11 +-- .../Classes/OpenAPIs/Models/Order.swift | 15 +-- .../Classes/OpenAPIs/Models/Pet.swift | 15 +-- .../Classes/OpenAPIs/Models/Tag.swift | 11 +-- .../Classes/OpenAPIs/Models/User.swift | 17 +--- .../Classes/OpenAPIs/APIHelper.swift | 6 ++ .../OpenAPIs/APIs/AnotherFakeAPI.swift | 12 +-- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 99 +++++++++++++------ .../APIs/FakeClassnameTags123API.swift | 12 +-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 34 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 16 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 54 +++++----- .../Models/AdditionalPropertiesClass.swift | 43 ++++++-- .../Classes/OpenAPIs/Models/Category.swift | 11 +-- .../Classes/OpenAPIs/Models/Order.swift | 15 +-- .../Classes/OpenAPIs/Models/Pet.swift | 15 +-- .../Classes/OpenAPIs/Models/Tag.swift | 11 +-- .../Classes/OpenAPIs/Models/User.swift | 17 +--- .../Classes/OpenAPIs/APIHelper.swift | 6 ++ .../OpenAPIs/APIs/AnotherFakeAPI.swift | 12 +-- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 95 ++++++++++++------ .../APIs/FakeClassnameTags123API.swift | 12 +-- .../Classes/OpenAPIs/APIs/PetAPI.swift | 34 +++---- .../Classes/OpenAPIs/APIs/StoreAPI.swift | 16 +-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 54 +++++----- .../Models/AdditionalPropertiesClass.swift | 43 ++++++-- .../Classes/OpenAPIs/Models/Category.swift | 11 +-- .../Classes/OpenAPIs/Models/Order.swift | 15 +-- .../Classes/OpenAPIs/Models/Pet.swift | 15 +-- .../Classes/OpenAPIs/Models/Tag.swift | 11 +-- .../Classes/OpenAPIs/Models/User.swift | 17 +--- 60 files changed, 925 insertions(+), 731 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java index 28108ed917e..84bc225f3f1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java @@ -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); diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index a044abe9b92..ffecb66c48c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index c6b61d04576..2bfd5a21d7a 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 1b4e3e1bfe3..ddfeae23edd 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -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) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 93795982089..0a5dfeb39b6 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -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 diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3b214f6881c..a2bced598f0 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index f3f9136ec58..d8cafaf2c96 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 4e018486ad7..0e2263b14e6 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -11,17 +11,44 @@ import Foundation public struct AdditionalPropertiesClass: Codable { - public var mapProperty: [String:String]? - public var mapOfMapProperty: [String:[String:String]]? - - public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) { - self.mapProperty = mapProperty - self.mapOfMapProperty = mapOfMapProperty + 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(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" } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index afdc89b6dd0..e8c489be460 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 5cad29458b7..83c3b85e662 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 3773bf53317..5e39abae6c8 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 20f50efd3ac..32ee33a1a1e 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift index d9c564d2a1f..a61b5844201 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 3c7b53f8149..d94614b34fc 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -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 diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index a044abe9b92..ffecb66c48c 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index c6b61d04576..2bfd5a21d7a 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 1b4e3e1bfe3..ddfeae23edd 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -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) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 93795982089..0a5dfeb39b6 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -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 diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3b214f6881c..a2bced598f0 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index f3f9136ec58..d8cafaf2c96 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 4e018486ad7..0e2263b14e6 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -11,17 +11,44 @@ import Foundation public struct AdditionalPropertiesClass: Codable { - public var mapProperty: [String:String]? - public var mapOfMapProperty: [String:[String:String]]? - - public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) { - self.mapProperty = mapProperty - self.mapOfMapProperty = mapOfMapProperty + 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(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" } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 3c7b53f8149..d94614b34fc 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -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 diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 4c024fd0236..18204a2a754 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index fea370e7e3a..58e3bd6da7a 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -12,6 +12,43 @@ import PromiseKit open class FakeAPI { + /** + creates an XmlItem + + - parameter xmlItem: (body) XmlItem Body + - returns: Promise<Void> + */ + open class func createXmlItem( xmlItem: XmlItem) -> Promise<Void> { + let deferred = Promise<Void>.pending() + createXmlItemWithRequestBuilder(xmlItem: xmlItem).execute { (response, error) -> Void in + if let error = error { + deferred.reject(error) + } else { + deferred.fulfill(()) + } + } + return deferred.promise + } + + /** + 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) @@ -51,12 +88,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 +108,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 +199,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 +217,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 +235,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 +253,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 +274,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 +295,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 +590,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 +608,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) diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 7bf07547ca7..51e1cd244bb 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -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) diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 4cc5cb4d123..29fc9ba64f9 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -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 diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 560beaaf6b4..2461befb0a2 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index b37914de918..a306c14e590 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 4e018486ad7..0e2263b14e6 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -11,17 +11,44 @@ import Foundation public struct AdditionalPropertiesClass: Codable { - public var mapProperty: [String:String]? - public var mapOfMapProperty: [String:[String:String]]? - - public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) { - self.mapProperty = mapProperty - self.mapOfMapProperty = mapOfMapProperty + 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(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" } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index afdc89b6dd0..e8c489be460 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 5cad29458b7..83c3b85e662 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 3773bf53317..5e39abae6c8 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 20f50efd3ac..32ee33a1a1e 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/User.swift index d9c564d2a1f..a61b5844201 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 3c7b53f8149..d94614b34fc 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -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 diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index 1a03bf07aea..1a95322a6ba 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index f3f0ccef77c..f72acc35cb6 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -12,6 +12,45 @@ import RxSwift open class FakeAPI { + /** + creates an XmlItem + + - parameter xmlItem: (body) XmlItem Body + - returns: Observable<Void> + */ + open class func createXmlItem(xmlItem: XmlItem) -> Observable<Void> { + return Observable.create { observer -> Disposable in + createXmlItemWithRequestBuilder(xmlItem: xmlItem).execute { (response, error) -> Void in + if let error = error { + observer.onError(error) + } else { + observer.onNext(()) + } + observer.onCompleted() + } + return Disposables.create() + } + } + + /** + 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) @@ -53,12 +92,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 +114,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 +209,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 +229,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 +247,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 +267,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 +288,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 +311,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 +612,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 +632,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) diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index d7e57628e49..2784d5cfb65 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -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) diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 02b65d294ca..b9ca8262f43 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -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 diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index a7b128f2c55..4af70c92530 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 338ef41f9b3..999b7791db8 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 4e018486ad7..0e2263b14e6 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -11,17 +11,44 @@ import Foundation public struct AdditionalPropertiesClass: Codable { - public var mapProperty: [String:String]? - public var mapOfMapProperty: [String:[String:String]]? - - public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) { - self.mapProperty = mapProperty - self.mapOfMapProperty = mapOfMapProperty + 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(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" } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index afdc89b6dd0..e8c489be460 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 5cad29458b7..83c3b85e662 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 3773bf53317..5e39abae6c8 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 20f50efd3ac..32ee33a1a1e 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/User.swift index d9c564d2a1f..a61b5844201 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 3c7b53f8149..d94614b34fc 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -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 diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift index a044abe9b92..ffecb66c48c 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index c6b61d04576..2bfd5a21d7a 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 1b4e3e1bfe3..ddfeae23edd 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift @@ -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) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 93795982089..0a5dfeb39b6 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -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 diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 3b214f6881c..a2bced598f0 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index f3f9136ec58..d8cafaf2c96 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -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) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 4e018486ad7..0e2263b14e6 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -11,17 +11,44 @@ import Foundation public struct AdditionalPropertiesClass: Codable { - public var mapProperty: [String:String]? - public var mapOfMapProperty: [String:[String:String]]? - - public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) { - self.mapProperty = mapProperty - self.mapOfMapProperty = mapOfMapProperty + 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(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" } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index f369f382d3f..3c11cfb3bc5 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 5cad29458b7..83c3b85e662 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 533e1b86190..9880907ec90 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 20f50efd3ac..32ee33a1a1e 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -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 - } - } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/User.swift index d9c564d2a1f..a61b5844201 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -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 - } - } -- GitLab From 5665a52f7de1a71ad6435617d98cbcbf9ffe9104 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 10 Apr 2019 00:55:03 +0800 Subject: [PATCH 2/4] fix swift4 test --- .../java/org/openapitools/codegen/swift4/Swift4ModelTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelTest.java index 4277a1adcf5..00de4c5d8a7 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelTest.java @@ -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); -- GitLab From 6485bcbec24b97213c356f41ada58d8768042dbe Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Wed, 10 Apr 2019 15:04:20 +0800 Subject: [PATCH 3/4] add new files --- .../Models/AdditionalPropertiesAnyType.swift | 58 +++++++++ .../Models/AdditionalPropertiesArray.swift | 58 +++++++++ .../Models/AdditionalPropertiesBoolean.swift | 58 +++++++++ .../Models/AdditionalPropertiesInteger.swift | 58 +++++++++ .../Models/AdditionalPropertiesNumber.swift | 58 +++++++++ .../Models/AdditionalPropertiesObject.swift | 58 +++++++++ .../Models/AdditionalPropertiesString.swift | 58 +++++++++ .../OpenAPIs/Models/TypeHolderDefault.swift | 38 ++++++ .../OpenAPIs/Models/TypeHolderExample.swift | 38 ++++++ .../Classes/OpenAPIs/Models/XmlItem.swift | 110 ++++++++++++++++++ .../Models/AdditionalPropertiesAnyType.swift | 58 +++++++++ .../Models/AdditionalPropertiesArray.swift | 58 +++++++++ .../Models/AdditionalPropertiesBoolean.swift | 58 +++++++++ .../Models/AdditionalPropertiesInteger.swift | 58 +++++++++ .../Models/AdditionalPropertiesNumber.swift | 58 +++++++++ .../Models/AdditionalPropertiesObject.swift | 58 +++++++++ .../Models/AdditionalPropertiesString.swift | 58 +++++++++ .../OpenAPIs/Models/TypeHolderDefault.swift | 38 ++++++ .../OpenAPIs/Models/TypeHolderExample.swift | 38 ++++++ .../Classes/OpenAPIs/Models/XmlItem.swift | 110 ++++++++++++++++++ .../Models/AdditionalPropertiesAnyType.swift | 58 +++++++++ .../Models/AdditionalPropertiesArray.swift | 58 +++++++++ .../Models/AdditionalPropertiesBoolean.swift | 58 +++++++++ .../Models/AdditionalPropertiesInteger.swift | 58 +++++++++ .../Models/AdditionalPropertiesNumber.swift | 58 +++++++++ .../Models/AdditionalPropertiesObject.swift | 58 +++++++++ .../Models/AdditionalPropertiesString.swift | 58 +++++++++ .../OpenAPIs/Models/TypeHolderDefault.swift | 38 ++++++ .../OpenAPIs/Models/TypeHolderExample.swift | 38 ++++++ .../Classes/OpenAPIs/Models/XmlItem.swift | 110 ++++++++++++++++++ .../Models/AdditionalPropertiesAnyType.swift | 58 +++++++++ .../Models/AdditionalPropertiesArray.swift | 58 +++++++++ .../Models/AdditionalPropertiesBoolean.swift | 58 +++++++++ .../Models/AdditionalPropertiesInteger.swift | 58 +++++++++ .../Models/AdditionalPropertiesNumber.swift | 58 +++++++++ .../Models/AdditionalPropertiesObject.swift | 58 +++++++++ .../Models/AdditionalPropertiesString.swift | 58 +++++++++ .../OpenAPIs/Models/TypeHolderDefault.swift | 38 ++++++ .../OpenAPIs/Models/TypeHolderExample.swift | 38 ++++++ .../Classes/OpenAPIs/Models/XmlItem.swift | 110 ++++++++++++++++++ .../Models/AdditionalPropertiesAnyType.swift | 58 +++++++++ .../Models/AdditionalPropertiesArray.swift | 58 +++++++++ .../Models/AdditionalPropertiesBoolean.swift | 58 +++++++++ .../Models/AdditionalPropertiesInteger.swift | 58 +++++++++ .../Models/AdditionalPropertiesNumber.swift | 58 +++++++++ .../Models/AdditionalPropertiesObject.swift | 58 +++++++++ .../Models/AdditionalPropertiesString.swift | 58 +++++++++ .../OpenAPIs/Models/TypeHolderDefault.swift | 38 ++++++ .../OpenAPIs/Models/TypeHolderExample.swift | 38 ++++++ .../Classes/OpenAPIs/Models/XmlItem.swift | 110 ++++++++++++++++++ 50 files changed, 2960 insertions(+) create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift create mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift create mode 100644 samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift create mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift create mode 100644 samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift create mode 100644 samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift new file mode 100644 index 00000000000..796e46eca24 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift new file mode 100644 index 00000000000..5e58839b5a5 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift new file mode 100644 index 00000000000..d4c90829b4c --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift new file mode 100644 index 00000000000..b03bbe44565 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift new file mode 100644 index 00000000000..9701d54c9b2 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift new file mode 100644 index 00000000000..c6e1e670b8c --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift new file mode 100644 index 00000000000..6128dce7d42 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..be1afdf0266 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..f46c8952e13 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift new file mode 100644 index 00000000000..e1b1ace8b15 --- /dev/null +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift new file mode 100644 index 00000000000..796e46eca24 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift new file mode 100644 index 00000000000..5e58839b5a5 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift new file mode 100644 index 00000000000..d4c90829b4c --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift new file mode 100644 index 00000000000..b03bbe44565 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift new file mode 100644 index 00000000000..9701d54c9b2 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift new file mode 100644 index 00000000000..c6e1e670b8c --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift new file mode 100644 index 00000000000..6128dce7d42 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..be1afdf0266 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..f46c8952e13 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift new file mode 100644 index 00000000000..e1b1ace8b15 --- /dev/null +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift new file mode 100644 index 00000000000..796e46eca24 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift new file mode 100644 index 00000000000..5e58839b5a5 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift new file mode 100644 index 00000000000..d4c90829b4c --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift new file mode 100644 index 00000000000..b03bbe44565 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift new file mode 100644 index 00000000000..9701d54c9b2 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift new file mode 100644 index 00000000000..c6e1e670b8c --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift new file mode 100644 index 00000000000..6128dce7d42 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..be1afdf0266 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..f46c8952e13 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift new file mode 100644 index 00000000000..e1b1ace8b15 --- /dev/null +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift new file mode 100644 index 00000000000..796e46eca24 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift new file mode 100644 index 00000000000..5e58839b5a5 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift new file mode 100644 index 00000000000..d4c90829b4c --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift new file mode 100644 index 00000000000..b03bbe44565 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift new file mode 100644 index 00000000000..9701d54c9b2 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift new file mode 100644 index 00000000000..c6e1e670b8c --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift new file mode 100644 index 00000000000..6128dce7d42 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..be1afdf0266 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..f46c8952e13 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift new file mode 100644 index 00000000000..e1b1ace8b15 --- /dev/null +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift new file mode 100644 index 00000000000..796e46eca24 --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift new file mode 100644 index 00000000000..5e58839b5a5 --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift new file mode 100644 index 00000000000..d4c90829b4c --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift new file mode 100644 index 00000000000..b03bbe44565 --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift new file mode 100644 index 00000000000..9701d54c9b2 --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift new file mode 100644 index 00000000000..c6e1e670b8c --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift new file mode 100644 index 00000000000..6128dce7d42 --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift @@ -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) + } + + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift new file mode 100644 index 00000000000..a088a2ad87f --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift new file mode 100644 index 00000000000..3e91d9485cf --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -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" + } + + +} + diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift new file mode 100644 index 00000000000..e1b1ace8b15 --- /dev/null +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift @@ -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" + } + + +} + -- GitLab From f4e9982bb94869a4d182848cb514709c994e7fda Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Mon, 15 Apr 2019 13:57:23 +0800 Subject: [PATCH 4/4] update swift4 tests --- bin/swift4-petstore-promisekit.sh | 2 +- bin/swift4-petstore-rxswift.sh | 2 +- bin/swift4-petstore-unwrapRequired.sh | 2 +- bin/swift4-petstore.sh | 2 +- ...ith-fake-endpoints-models-for-testing.yaml | 279 +++++++++++++++--- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 35 --- .../Models/AdditionalPropertiesAnyType.swift | 58 ---- .../Models/AdditionalPropertiesArray.swift | 58 ---- .../Models/AdditionalPropertiesBoolean.swift | 58 ---- .../Models/AdditionalPropertiesClass.swift | 29 +- .../Models/AdditionalPropertiesInteger.swift | 58 ---- .../Models/AdditionalPropertiesNumber.swift | 58 ---- .../Models/AdditionalPropertiesObject.swift | 58 ---- .../Models/AdditionalPropertiesString.swift | 58 ---- .../Classes/OpenAPIs/Models/MapTest.swift | 4 +- .../Classes/OpenAPIs/Models/XmlItem.swift | 110 ------- .../SwaggerClientTests/PetAPITests.swift | 10 +- .../SwaggerClientTests/StoreAPITests.swift | 8 +- .../SwaggerClientTests/run_xcodebuild.sh | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 37 --- .../Models/AdditionalPropertiesAnyType.swift | 58 ---- .../Models/AdditionalPropertiesArray.swift | 58 ---- .../Models/AdditionalPropertiesBoolean.swift | 58 ---- .../Models/AdditionalPropertiesClass.swift | 29 +- .../Models/AdditionalPropertiesInteger.swift | 58 ---- .../Models/AdditionalPropertiesNumber.swift | 58 ---- .../Models/AdditionalPropertiesObject.swift | 58 ---- .../Models/AdditionalPropertiesString.swift | 58 ---- .../Classes/OpenAPIs/Models/MapTest.swift | 4 +- .../SwaggerClientTests/PetAPITests.swift | 10 +- .../SwaggerClientTests/StoreAPITests.swift | 8 +- .../SwaggerClientTests/run_xcodebuild.sh | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 39 --- .../Models/AdditionalPropertiesClass.swift | 29 +- .../Classes/OpenAPIs/Models/MapTest.swift | 4 +- .../SwaggerClientTests/PetAPITests.swift | 16 +- .../SwaggerClientTests/StoreAPITests.swift | 8 +- .../SwaggerClientTests/UserAPITests.swift | 4 +- .../SwaggerClientTests/run_xcodebuild.sh | 2 +- .../client/petstore/swift4/swift4_test_all.sh | 7 + .../Classes/OpenAPIs/APIs/FakeAPI.swift | 35 --- .../Models/AdditionalPropertiesClass.swift | 29 +- .../Classes/OpenAPIs/Models/MapTest.swift | 4 +- 43 files changed, 300 insertions(+), 1264 deletions(-) delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift delete mode 100644 samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift delete mode 100644 samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift create mode 100644 samples/client/petstore/swift4/swift4_test_all.sh diff --git a/bin/swift4-petstore-promisekit.sh b/bin/swift4-petstore-promisekit.sh index d3a8d7741fc..83eb8188579 100755 --- a/bin/swift4-petstore-promisekit.sh +++ b/bin/swift4-petstore-promisekit.sh @@ -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 diff --git a/bin/swift4-petstore-rxswift.sh b/bin/swift4-petstore-rxswift.sh index b99d8d0c5e2..fa452392f32 100755 --- a/bin/swift4-petstore-rxswift.sh +++ b/bin/swift4-petstore-rxswift.sh @@ -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 diff --git a/bin/swift4-petstore-unwrapRequired.sh b/bin/swift4-petstore-unwrapRequired.sh index 9e30fdf76b8..9fae7054842 100755 --- a/bin/swift4-petstore-unwrapRequired.sh +++ b/bin/swift4-petstore-unwrapRequired.sh @@ -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 diff --git a/bin/swift4-petstore.sh b/bin/swift4-petstore.sh index d17a2fda377..4936d98c5b9 100755 --- a/bin/swift4-petstore.sh +++ b/bin/swift4-petstore.sh @@ -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 diff --git a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml index 2bc345dab4e..fbab84749ff 100644 --- a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml @@ -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 diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 2bfd5a21d7a..302767c2b0c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -11,41 +11,6 @@ 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) diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift deleted file mode 100644 index 796e46eca24..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift deleted file mode 100644 index 5e58839b5a5..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift deleted file mode 100644 index d4c90829b4c..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 0e2263b14e6..4db39adae84 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -12,43 +12,16 @@ import Foundation public struct AdditionalPropertiesClass: Codable { 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(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?) { + public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { 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 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" } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift deleted file mode 100644 index b03bbe44565..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift deleted file mode 100644 index 9701d54c9b2..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift deleted file mode 100644 index c6e1e670b8c..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift deleted file mode 100644 index 6128dce7d42..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 392c1e44383..2d3a45d35a0 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -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 diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift deleted file mode 100644 index e1b1ace8b15..00000000000 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/XmlItem.swift +++ /dev/null @@ -1,110 +0,0 @@ -// -// 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" - } - - -} - diff --git a/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index 83948695fac..b2f9fecb407 100644 --- a/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -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() diff --git a/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift b/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift index 943c5a8f018..5bd01081e4d 100644 --- a/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift +++ b/samples/client/petstore/swift4/default/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift @@ -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") diff --git a/samples/client/petstore/swift4/default/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift4/default/SwaggerClientTests/run_xcodebuild.sh index 4dfe4ab73c4..08ecb7c23dc 100755 --- a/samples/client/petstore/swift4/default/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift4/default/SwaggerClientTests/run_xcodebuild.sh @@ -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]} diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 58e3bd6da7a..ed3c187e727 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -12,43 +12,6 @@ import PromiseKit open class FakeAPI { - /** - creates an XmlItem - - - parameter xmlItem: (body) XmlItem Body - - returns: Promise<Void> - */ - open class func createXmlItem( xmlItem: XmlItem) -> Promise<Void> { - let deferred = Promise<Void>.pending() - createXmlItemWithRequestBuilder(xmlItem: xmlItem).execute { (response, error) -> Void in - if let error = error { - deferred.reject(error) - } else { - deferred.fulfill(()) - } - } - return deferred.promise - } - - /** - 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) diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift deleted file mode 100644 index 796e46eca24..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesAnyType.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift deleted file mode 100644 index 5e58839b5a5..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesArray.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift deleted file mode 100644 index d4c90829b4c..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesBoolean.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 0e2263b14e6..4db39adae84 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -12,43 +12,16 @@ import Foundation public struct AdditionalPropertiesClass: Codable { 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(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?) { + public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { 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 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" } diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift deleted file mode 100644 index b03bbe44565..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesInteger.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift deleted file mode 100644 index 9701d54c9b2..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesNumber.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift deleted file mode 100644 index c6e1e670b8c..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesObject.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift deleted file mode 100644 index 6128dce7d42..00000000000 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesString.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// 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) - } - - - -} - diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 392c1e44383..2d3a45d35a0 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -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 diff --git a/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index f32e457fa54..8f58cc4d4fc 100644 --- a/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -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 { diff --git a/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift b/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift index b9fcfe2015a..7d7ae16b836 100644 --- a/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift +++ b/samples/client/petstore/swift4/promisekit/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift @@ -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() diff --git a/samples/client/petstore/swift4/promisekit/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift4/promisekit/SwaggerClientTests/run_xcodebuild.sh index 33f6816d620..79751877913 100755 --- a/samples/client/petstore/swift4/promisekit/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift4/promisekit/SwaggerClientTests/run_xcodebuild.sh @@ -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]} diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index f72acc35cb6..05053aed92e 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -12,45 +12,6 @@ import RxSwift open class FakeAPI { - /** - creates an XmlItem - - - parameter xmlItem: (body) XmlItem Body - - returns: Observable<Void> - */ - open class func createXmlItem(xmlItem: XmlItem) -> Observable<Void> { - return Observable.create { observer -> Disposable in - createXmlItemWithRequestBuilder(xmlItem: xmlItem).execute { (response, error) -> Void in - if let error = error { - observer.onError(error) - } else { - observer.onNext(()) - } - observer.onCompleted() - } - return Disposables.create() - } - } - - /** - 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) diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 0e2263b14e6..4db39adae84 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -12,43 +12,16 @@ import Foundation public struct AdditionalPropertiesClass: Codable { 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(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?) { + public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { 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 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" } diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 392c1e44383..2d3a45d35a0 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -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 diff --git a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift index af0c653d2b7..99f4e85eac7 100644 --- a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift +++ b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/PetAPITests.swift @@ -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") diff --git a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift index 7558e6f069a..97db90b2263 100644 --- a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift +++ b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/StoreAPITests.swift @@ -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") diff --git a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift index bb5e0b26e95..fbe9c68db3a 100644 --- a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift +++ b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/SwaggerClientTests/UserAPITests.swift @@ -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 diff --git a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/run_xcodebuild.sh b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/run_xcodebuild.sh index 33f6816d620..79751877913 100755 --- a/samples/client/petstore/swift4/rxswift/SwaggerClientTests/run_xcodebuild.sh +++ b/samples/client/petstore/swift4/rxswift/SwaggerClientTests/run_xcodebuild.sh @@ -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]} diff --git a/samples/client/petstore/swift4/swift4_test_all.sh b/samples/client/petstore/swift4/swift4_test_all.sh new file mode 100644 index 00000000000..e6b05fdbf33 --- /dev/null +++ b/samples/client/petstore/swift4/swift4_test_all.sh @@ -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 diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 2bfd5a21d7a..302767c2b0c 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -11,41 +11,6 @@ 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) diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 0e2263b14e6..4db39adae84 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -12,43 +12,16 @@ import Foundation public struct AdditionalPropertiesClass: Codable { 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(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?) { + public init(mapString: [String:String]?, mapMapString: [String:[String:String]]?) { 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 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" } diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 392c1e44383..2d3a45d35a0 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -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 -- GitLab