Update Swift default value (#407)

* update swift4 default

* update swift3 default value

* update swift default value
This commit is contained in:
William Cheng 2018-05-12 00:15:24 +08:00 committed by GitHub
parent c905f6b5bb
commit 4b7a583b33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
398 changed files with 3466 additions and 5252 deletions

View File

@ -1,7 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "PromiseKit"
}
}

View File

@ -1,6 +1,6 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "RxSwift"

View File

@ -1,7 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"objcCompatible": true
}
}

View File

@ -1,7 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "PromiseKit"
}
}

View File

@ -1,6 +1,6 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "RxSwift"

View File

@ -1,7 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"unwrapRequired": true
}
}

View File

@ -1,6 +1,6 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient"
}
}

View File

@ -1,7 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"objcCompatible": true
}
}

View File

@ -1,7 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "PromiseKit"
}
}

View File

@ -1,6 +1,6 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "RxSwift"

View File

@ -1,6 +1,6 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "PetstoreClient"
}
}

View File

@ -1,6 +1,6 @@
{
"podSummary": "TestClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podHomepage": "https://github.com/openapitools/openapi-generator",
"podAuthors": "",
"projectName": "TestClient"
}
}

View File

@ -17,26 +17,14 @@
package org.openapitools.codegen.languages;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.*;
import org.openapitools.codegen.mustache.*;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.parameters.*;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils;
import javax.annotation.Nullable;
import java.io.File;
import java.util.*;
import java.util.regex.Matcher;
@ -58,7 +46,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
public static final String POD_SCREENSHOTS = "podScreenshots";
public static final String POD_DOCUMENTATION_URL = "podDocumentationURL";
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
public static final String DEFAULT_POD_AUTHORS = "Swagger Codegen";
public static final String DEFAULT_POD_AUTHORS = "OpenAPI Generator";
public static final String LENIENT_TYPE_CAST = "lenientTypeCast";
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
protected static final String LIBRARY_RX_SWIFT = "RxSwift";
@ -69,7 +57,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
protected boolean lenientTypeCast = false;
protected boolean swiftUseApiNamespace;
protected String[] responseAs = new String[0];
protected String sourceFolder = "Classes" + File.separator + "Swaggers";
protected String sourceFolder = "Classes" + File.separator + "OpenAPIs";
public Swift3Codegen() {
super();
@ -176,6 +164,50 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
.defaultValue(Boolean.FALSE.toString()));
}
private static CodegenModel reconcileProperties(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
// To support inheritance in this generator, we will analyze
// the parent and child models, look for properties that match, and remove
// them from the child models and leave them in the parent.
// Because the child models extend the parents, the properties will be available via the parent.
// Get the properties for the parent and child models
final List<CodegenProperty> parentModelCodegenProperties = parentCodegenModel.vars;
List<CodegenProperty> codegenProperties = codegenModel.vars;
codegenModel.allVars = new ArrayList<CodegenProperty>(codegenProperties);
codegenModel.parentVars = parentCodegenModel.allVars;
// Iterate over all of the parent model properties
boolean removedChildProperty = false;
for (CodegenProperty parentModelCodegenProperty : parentModelCodegenProperties) {
// Now that we have found a prop in the parent class,
// and search the child class for the same prop.
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
while (iterator.hasNext()) {
CodegenProperty codegenProperty = iterator.next();
if (codegenProperty.baseName.equals(parentModelCodegenProperty.baseName)) {
// We found a property in the child class that is
// a duplicate of the one in the parent, so remove it.
iterator.remove();
removedChildProperty = true;
}
}
}
if (removedChildProperty) {
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
int count = 0, numVars = codegenProperties.size();
for (CodegenProperty codegenProperty : codegenProperties) {
count += 1;
codegenProperty.hasMore = count < numVars;
}
codegenModel.vars = codegenProperties;
}
return codegenModel;
}
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
@ -386,8 +418,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toInstantiationType(Schema p) {
if (ModelUtils.isMapSchema(p)) {
String inner = getSchemaType((Schema) p.getAdditionalProperties());
return inner;
return getSchemaType((Schema) p.getAdditionalProperties());
} else if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
String inner = getSchemaType(ap.getItems());
@ -639,48 +670,4 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig {
public String escapeUnsafeCharacters(String input) {
return input.replace("*/", "*_/").replace("/*", "/_*");
}
private static CodegenModel reconcileProperties(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
// To support inheritance in this generator, we will analyze
// the parent and child models, look for properties that match, and remove
// them from the child models and leave them in the parent.
// Because the child models extend the parents, the properties will be available via the parent.
// Get the properties for the parent and child models
final List<CodegenProperty> parentModelCodegenProperties = parentCodegenModel.vars;
List<CodegenProperty> codegenProperties = codegenModel.vars;
codegenModel.allVars = new ArrayList<CodegenProperty>(codegenProperties);
codegenModel.parentVars = parentCodegenModel.allVars;
// Iterate over all of the parent model properties
boolean removedChildProperty = false;
for (CodegenProperty parentModelCodegenProperty : parentModelCodegenProperties) {
// Now that we have found a prop in the parent class,
// and search the child class for the same prop.
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
while (iterator.hasNext()) {
CodegenProperty codegenProperty = iterator.next();
if (codegenProperty.baseName == parentModelCodegenProperty.baseName) {
// We found a property in the child class that is
// a duplicate of the one in the parent, so remove it.
iterator.remove();
removedChildProperty = true;
}
}
}
if (removedChildProperty) {
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
int count = 0, numVars = codegenProperties.size();
for (CodegenProperty codegenProperty : codegenProperties) {
count += 1;
codegenProperty.hasMore = (count < numVars) ? true : false;
}
codegenModel.vars = codegenProperties;
}
return codegenModel;
}
}

View File

@ -17,37 +17,18 @@
package org.openapitools.codegen.languages;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import io.swagger.models.Model;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.*;
import org.openapitools.codegen.mustache.*;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.parameters.*;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
public static final String PROJECT_NAME = "projectName";
@ -65,7 +46,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
public static final String POD_SCREENSHOTS = "podScreenshots";
public static final String POD_DOCUMENTATION_URL = "podDocumentationURL";
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
public static final String DEFAULT_POD_AUTHORS = "Swagger Codegen";
public static final String DEFAULT_POD_AUTHORS = "OpenAPI Generator";
public static final String LENIENT_TYPE_CAST = "lenientTypeCast";
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
protected static final String LIBRARY_RX_SWIFT = "RxSwift";
@ -76,33 +57,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
protected boolean lenientTypeCast = false;
protected boolean swiftUseApiNamespace;
protected String[] responseAs = new String[0];
protected String sourceFolder = "Classes" + File.separator + "Swaggers";
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
}
@Override
public String getName() {
return "swift4";
}
@Override
public String getHelp() {
return "Generates a Swift 4.x client library.";
}
@Override
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel,
Schema schema) {
final Schema additionalProperties = (Schema) schema.getAdditionalProperties();
if (additionalProperties != null) {
codegenModel.additionalPropertiesType = getSchemaType(additionalProperties);
}
}
protected String sourceFolder = "Classes" + File.separator + "OpenAPIs";
/**
* Constructor for the swift4 language codegen module.
@ -259,6 +214,79 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
.defaultValue(Boolean.FALSE.toString()));
}
private static CodegenModel reconcileProperties(CodegenModel codegenModel,
CodegenModel parentCodegenModel) {
// To support inheritance in this generator, we will analyze
// the parent and child models, look for properties that match, and remove
// them from the child models and leave them in the parent.
// Because the child models extend the parents, the properties
// will be available via the parent.
// Get the properties for the parent and child models
final List<CodegenProperty> parentModelCodegenProperties = parentCodegenModel.vars;
List<CodegenProperty> codegenProperties = codegenModel.vars;
codegenModel.allVars = new ArrayList<CodegenProperty>(codegenProperties);
codegenModel.parentVars = parentCodegenModel.allVars;
// Iterate over all of the parent model properties
boolean removedChildProperty = false;
for (CodegenProperty parentModelCodegenProperty : parentModelCodegenProperties) {
// Now that we have found a prop in the parent class,
// and search the child class for the same prop.
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
while (iterator.hasNext()) {
CodegenProperty codegenProperty = iterator.next();
if (codegenProperty.baseName.equals(parentModelCodegenProperty.baseName)) {
// We found a property in the child class that is
// a duplicate of the one in the parent, so remove it.
iterator.remove();
removedChildProperty = true;
}
}
}
if (removedChildProperty) {
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
int count = 0;
int numVars = codegenProperties.size();
for (CodegenProperty codegenProperty : codegenProperties) {
count += 1;
codegenProperty.hasMore = count < numVars;
}
codegenModel.vars = codegenProperties;
}
return codegenModel;
}
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
}
@Override
public String getName() {
return "swift4";
}
@Override
public String getHelp() {
return "Generates a Swift 4.x client library.";
}
@Override
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel,
Schema schema) {
final Schema additionalProperties = (Schema) schema.getAdditionalProperties();
if (additionalProperties != null) {
codegenModel.additionalPropertiesType = getSchemaType(additionalProperties);
}
}
@Override
public void processOpts() {
super.processOpts();
@ -492,8 +520,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toInstantiationType(Schema p) {
if (ModelUtils.isMapSchema(p)) {
String inner = getSchemaType((Schema) p.getAdditionalProperties());
return inner;
return getSchemaType((Schema) p.getAdditionalProperties());
} else if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
String inner = getSchemaType(ap.getItems());
@ -792,51 +819,4 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
public String escapeUnsafeCharacters(String input) {
return input.replace("*/", "*_/").replace("/*", "/_*");
}
private static CodegenModel reconcileProperties(CodegenModel codegenModel,
CodegenModel parentCodegenModel) {
// To support inheritance in this generator, we will analyze
// the parent and child models, look for properties that match, and remove
// them from the child models and leave them in the parent.
// Because the child models extend the parents, the properties
// will be available via the parent.
// Get the properties for the parent and child models
final List<CodegenProperty> parentModelCodegenProperties = parentCodegenModel.vars;
List<CodegenProperty> codegenProperties = codegenModel.vars;
codegenModel.allVars = new ArrayList<CodegenProperty>(codegenProperties);
codegenModel.parentVars = parentCodegenModel.allVars;
// Iterate over all of the parent model properties
boolean removedChildProperty = false;
for (CodegenProperty parentModelCodegenProperty : parentModelCodegenProperties) {
// Now that we have found a prop in the parent class,
// and search the child class for the same prop.
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
while (iterator.hasNext()) {
CodegenProperty codegenProperty = iterator.next();
if (codegenProperty.baseName.equals(parentModelCodegenProperty.baseName)) {
// We found a property in the child class that is
// a duplicate of the one in the parent, so remove it.
iterator.remove();
removedChildProperty = true;
}
}
}
if (removedChildProperty) {
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
int count = 0;
int numVars = codegenProperties.size();
for (CodegenProperty codegenProperty : codegenProperties) {
count += 1;
codegenProperty.hasMore = (count < numVars) ? true : false;
}
codegenModel.vars = codegenProperties;
}
return codegenModel;
}
}

View File

@ -17,33 +17,23 @@
package org.openapitools.codegen.languages;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.*;
import org.openapitools.codegen.mustache.*;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.parameters.*;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils;
import javax.annotation.Nullable;
import java.util.*;
import java.io.File;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Swift (2.x) generator is no longer actively maintained. Please use
* Swift (2.x) generator is no longer actively maintained. Please use
* 'swift3' or 'swift4' generator instead.
*/
@ -62,15 +52,15 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String POD_SCREENSHOTS = "podScreenshots";
public static final String POD_DOCUMENTATION_URL = "podDocumentationURL";
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
public static final String DEFAULT_POD_AUTHORS = "Swagger Codegen";
public static final String DEFAULT_POD_AUTHORS = "OpenAPI Generator";
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
protected static final String LIBRARY_RX_SWIFT = "RxSwift";
protected static final String[] RESPONSE_LIBRARIES = { LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT };
protected static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT};
protected String projectName = "OpenAPIClient";
protected boolean unwrapRequired;
protected boolean swiftUseApiNamespace;
protected String[] responseAs = new String[0];
protected String sourceFolder = "Classes" + File.separator + "Swaggers";
protected String sourceFolder = "Classes" + File.separator + "OpenAPIs";
private static final Pattern PATH_PARAM_PATTERN = Pattern.compile("\\{[a-zA-Z_]+\\}");
@Override
@ -102,45 +92,45 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"Int",
"Int32",
"Int64",
"Float",
"Double",
"Bool",
"Void",
"String",
"Character",
"AnyObject")
);
"Int",
"Int32",
"Int64",
"Float",
"Double",
"Bool",
"Void",
"String",
"Character",
"AnyObject")
);
defaultIncludes = new HashSet<String>(
Arrays.asList(
"NSData",
"NSDate",
"NSURL", // for file
"NSUUID",
"Array",
"Dictionary",
"Set",
"Any",
"Empty",
"AnyObject")
);
"NSData",
"NSDate",
"NSURL", // for file
"NSUUID",
"Array",
"Dictionary",
"Set",
"Any",
"Empty",
"AnyObject")
);
reservedWords = new HashSet<String>(
Arrays.asList(
// name used by swift client
"ErrorResponse",
// name used by swift client
"ErrorResponse",
// swift keywords
"Int", "Int32", "Int64", "Int64", "Float", "Double", "Bool", "Void", "String", "Character", "AnyObject",
"class", "Class", "break", "as", "associativity", "deinit", "case", "dynamicType", "convenience", "enum", "continue",
"false", "dynamic", "extension", "default", "is", "didSet", "func", "do", "nil", "final", "import", "else",
"self", "get", "init", "fallthrough", "Self", "infix", "internal", "for", "super", "inout", "let", "if",
"true", "lazy", "operator", "in", "COLUMN", "left", "private", "return", "FILE", "mutating", "protocol",
"switch", "FUNCTION", "none", "public", "where", "LINE", "nonmutating", "static", "while", "optional",
"struct", "override", "subscript", "postfix", "typealias", "precedence", "var", "prefix", "Protocol",
"required", "right", "set", "Type", "unowned", "weak", "Data")
);
// swift keywords
"Int", "Int32", "Int64", "Int64", "Float", "Double", "Bool", "Void", "String", "Character", "AnyObject",
"class", "Class", "break", "as", "associativity", "deinit", "case", "dynamicType", "convenience", "enum", "continue",
"false", "dynamic", "extension", "default", "is", "didSet", "func", "do", "nil", "final", "import", "else",
"self", "get", "init", "fallthrough", "Self", "infix", "internal", "for", "super", "inout", "let", "if",
"true", "lazy", "operator", "in", "COLUMN", "left", "private", "return", "FILE", "mutating", "protocol",
"switch", "FUNCTION", "none", "public", "where", "LINE", "nonmutating", "static", "while", "optional",
"struct", "override", "subscript", "postfix", "typealias", "precedence", "var", "prefix", "Protocol",
"required", "right", "set", "Type", "unowned", "weak", "Data")
);
typeMapping = new HashMap<String, String>();
typeMapping.put("array", "Array");
@ -162,7 +152,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
typeMapping.put("double", "Double");
typeMapping.put("object", "AnyObject");
typeMapping.put("file", "NSURL");
typeMapping.put("binary", "NSData");
typeMapping.put("binary", "NSURL");
typeMapping.put("ByteArray", "NSData");
typeMapping.put("UUID", "NSUUID");
@ -170,9 +160,9 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
cliOptions.add(new CliOption(PROJECT_NAME, "Project name in Xcode"));
cliOptions.add(new CliOption(RESPONSE_AS, "Optionally use libraries to manage response. Currently " +
StringUtils.join(RESPONSE_LIBRARIES, ", ") + " are available."));
StringUtils.join(RESPONSE_LIBRARIES, ", ") + " are available."));
cliOptions.add(new CliOption(UNWRAP_REQUIRED, "Treat 'required' properties in response as non-optional " +
"(which would crash the app if api returns null as opposed to required option specified in json schema"));
"(which would crash the app if api returns null as opposed to required option specified in json schema"));
cliOptions.add(new CliOption(POD_SOURCE, "Source information used for Podspec"));
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "Version used for Podspec"));
cliOptions.add(new CliOption(POD_AUTHORS, "Authors used for Podspec"));
@ -211,7 +201,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
if (additionalProperties.containsKey(RESPONSE_AS)) {
Object responseAsObject = additionalProperties.get(RESPONSE_AS);
if (responseAsObject instanceof String) {
setResponseAs(((String)responseAsObject).split(","));
setResponseAs(((String) responseAsObject).split(","));
} else {
setResponseAs((String[]) responseAsObject);
}
@ -237,7 +227,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
supportingFiles.add(new SupportingFile("Cartfile.mustache", "", "Cartfile"));
supportingFiles.add(new SupportingFile("APIHelper.mustache", sourceFolder, "APIHelper.swift"));
supportingFiles.add(new SupportingFile("AlamofireImplementations.mustache", sourceFolder,
"AlamofireImplementations.swift"));
"AlamofireImplementations.swift"));
supportingFiles.add(new SupportingFile("Extensions.mustache", sourceFolder, "Extensions.swift"));
supportingFiles.add(new SupportingFile("Models.mustache", sourceFolder, "Models.swift"));
supportingFiles.add(new SupportingFile("APIs.mustache", sourceFolder, "APIs.swift"));
@ -250,14 +240,14 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
protected boolean isReservedWord(String word) {
return word != null && reservedWords.contains(word); //don't lowercase as super does
}
@Override
public String escapeReservedWord(String name) {
if(this.reservedWordsMappings().containsKey(name)) {
public String escapeReservedWord(String name) {
if (this.reservedWordsMappings().containsKey(name)) {
return this.reservedWordsMappings().get(name);
}
return "_" + name; // add an underscore to the name
}
}
@Override
public String modelFileFolder() {
@ -388,7 +378,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
if (codegenProperty.isEnum) {
List<Map<String, String>> swiftEnums = new ArrayList<Map<String, String>>();
List<String> values = (List<String>) codegenProperty.allowableValues.get("values");
for (Object value : values) {
Map<String, String> map = new HashMap<String, String>();
map.put("enum", toSwiftyEnumName(String.valueOf(value)));
@ -399,7 +389,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
codegenProperty.datatypeWithEnum = toEnumName(codegenProperty);
//codegenProperty.datatypeWithEnum =
// StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length());
// Ensure that the enum type doesn't match a reserved word or
// the variable name doesn't match the generated enum type or the
// Swift compiler will generate an error
@ -422,7 +412,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
value = value.replaceAll("\\+", "Plus");
value = value.replaceAll("\\.", "Dot");
}
// Prevent from breaking properly cased identifier
if (value.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) {
return value;
@ -435,14 +425,14 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
@Override
public String toApiName(String name) {
if(name.length() == 0)
if (name.length() == 0)
return "DefaultAPI";
return initialCaps(name) + "API";
}
@Override
public String toOperationId(String operationId) {
operationId = camelize(sanitizeName(operationId), true);
operationId = camelize(sanitizeName(operationId), true);
// throw exception if method name is empty. This should not happen but keep the check just in case
if (StringUtils.isEmpty(operationId)) {
@ -526,9 +516,9 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig
String group = matcher.group().substring(1, matcher.group().length() - 1);
group = camelize(group, true);
builder
.append("{")
.append(group)
.append("}");
.append("{")
.append(group)
.append("}");
cursor = matcher.end();
found = matcher.find();

View File

@ -188,8 +188,6 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
completion(response: Response(response: response.response!, body: body), error: nil)
return
} else if "" is T {
// swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release
// https://github.com/swagger-api/swagger-parser/pull/34
completion(response: Response(response: response.response!, body: "" as! T), error: nil)
return
}

View File

@ -80,7 +80,7 @@ class Decoders {
if let decoder = decoders[key] {
return decoder(source) as! T
} else {
fatalError("Source \(source) is not convertible to type \(clazz): Maybe swagger file is insufficient")
fatalError("Source \(source) is not convertible to type \(clazz): Maybe OpenAPI spec file is insufficient")
}
}

View File

@ -4,7 +4,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
s.version = '{{#podVersion}}{{podVersion}}{{/podVersion}}{{^podVersion}}0.0.1{{/podVersion}}'
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }{{/podSource}}
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}}
{{#podAuthors}}
s.authors = '{{podAuthors}}'
{{/podAuthors}}

View File

@ -296,8 +296,6 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
}
return
} else if "" is T {
// swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release
// https://github.com/swagger-api/swagger-parser/pull/34
completion(Response(response: response.response!, body: ("" as! T)), nil)
return
}

View File

@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.version = '{{#podVersion}}{{podVersion}}{{/podVersion}}{{^podVersion}}0.0.1{{/podVersion}}'
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}}
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}}
s.authors = '{{podAuthors}}'{{/podAuthors}}{{#podSocialMediaURL}}
s.social_media_url = '{{podSocialMediaURL}}'{{/podSocialMediaURL}}{{#podDocsetURL}}
s.docset_url = '{{podDocsetURL}}'{{/podDocsetURL}}

View File

@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.version = '{{#podVersion}}{{podVersion}}{{/podVersion}}{{^podVersion}}0.0.1{{/podVersion}}'
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}}
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}}
s.authors = '{{podAuthors}}'{{/podAuthors}}{{#podSocialMediaURL}}
s.social_media_url = '{{podSocialMediaURL}}'{{/podSocialMediaURL}}{{#podDocsetURL}}
s.docset_url = '{{podDocsetURL}}'{{/podDocsetURL}}

View File

@ -606,7 +606,7 @@ paths:
description: To test enum parameters
operationId: testEnumParameters
consumes:
- "*/*"
- application/x-www-form-urlencoded
produces:
- "*/*"
parameters:
@ -703,8 +703,7 @@ paths:
가짜 엔드 포인트
operationId: testEndpointParameters
consumes:
- application/xml; charset=utf-8
- application/json; charset=utf-8
- application/x-www-form-urlencoded
produces:
- application/xml; charset=utf-8
- application/json; charset=utf-8
@ -874,7 +873,7 @@ paths:
description: ''
operationId: testJsonFormData
consumes:
- application/json
- application/x-www-form-urlencoded
parameters:
- name: param
in: formData

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -4,7 +4,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
s.version = '0.0.1'
s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }
s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }
s.authors = ''
s.license = 'Proprietary'
s.homepage = 'https://github.com/swagger-api/swagger-codegen'

View File

@ -1,7 +1,7 @@
// APIHelper.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
class APIHelper {

View File

@ -1,7 +1,7 @@
// APIs.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// PetAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -13,11 +13,11 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func addPet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func addPet(pet pet: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -25,20 +25,17 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- POST /pet
-
- OAuth:
- POST /pet - OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: RequestBuilder<Void>
*/
public class func addPetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
public class func addPetWithRequestBuilder(pet pet: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = pet?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -63,12 +60,9 @@ public class PetAPI: APIBase {
/**
Deletes a pet
- DELETE /pet/{petId}
-
- OAuth:
- DELETE /pet/{petId} - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) Pet id to delete
- parameter apiKey: (header) (optional)
@ -97,7 +91,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findPetsByStatus(status status: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
@ -110,19 +104,62 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- GET /pet/findByStatus
- Multiple status values can be provided with comma separated strings
- OAuth:
- Multiple status values can be provided with comma separated strings - OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example={
"name" : "Puma",
"type" : "Dog",
"color" : "Black",
"gender" : "Female",
"breed" : "Mixed"
}}]
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- parameter status: (query) Status values that need to be considered for filter (optional)
- returns: RequestBuilder<[Pet]>
*/
@ -159,11 +196,10 @@ public class PetAPI: APIBase {
/**
Finds Pets by tags
- GET /pet/findByTags
- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- OAuth:
- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example=[ {
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -179,23 +215,7 @@ public class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}, {contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -205,7 +225,7 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- examples: [{contentType=application/json, example=[ {
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -221,23 +241,7 @@ public class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}, {contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -247,7 +251,6 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- parameter tags: (query) Tags to filter by (optional)
- returns: RequestBuilder<[Pet]>
@ -285,8 +288,7 @@ public class PetAPI: APIBase {
/**
Find pet by ID
- GET /pet/{petId}
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- API Key:
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - API Key:
- type: apiKey api_key
- name: api_key
- OAuth:
@ -344,7 +346,6 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Pet>
@ -368,11 +369,11 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updatePet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func updatePet(pet pet: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -380,20 +381,17 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- PUT /pet
-
- OAuth:
- PUT /pet - OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: RequestBuilder<Void>
*/
public class func updatePetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
public class func updatePetWithRequestBuilder(pet pet: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = pet?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -419,12 +417,9 @@ public class PetAPI: APIBase {
/**
Updates a pet in the store with form data
- POST /pet/{petId}
-
- OAuth:
- POST /pet/{petId} - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) ID of pet that needs to be updated
- parameter name: (form) Updated name of the pet (optional)
- parameter status: (form) Updated status of the pet (optional)
@ -467,12 +462,9 @@ public class PetAPI: APIBase {
/**
uploads an image
- POST /pet/{petId}/uploadImage
-
- OAuth:
- POST /pet/{petId}/uploadImage - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) ID of pet to update
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- parameter file: (form) file to upload (optional)

View File

@ -1,8 +1,8 @@
//
// StoreAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -26,9 +26,7 @@ public class StoreAPI: APIBase {
/**
Delete purchase order by ID
- DELETE /store/order/{orderId}
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- parameter orderId: (path) ID of the order that needs to be deleted
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -63,16 +61,9 @@ public class StoreAPI: APIBase {
/**
Returns pet inventories by status
- GET /store/inventory
- Returns a map of status codes to quantities
- API Key:
- Returns a map of status codes to quantities - API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
"key" : 0
}}, {contentType=application/xml, example=}]
- examples: [{contentType=application/json, example={
"key" : 0
}}, {contentType=application/xml, example=}]
- returns: RequestBuilder<[String:Int32]>
*/
@ -107,8 +98,7 @@ public class StoreAPI: APIBase {
/**
Find purchase order by ID
- GET /store/order/{orderId}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- examples: [{contentType=application/json, example={
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
@ -138,7 +128,6 @@ public class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter orderId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Order>
@ -162,11 +151,11 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func placeOrder(body body: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func placeOrder(order order: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
@ -174,9 +163,7 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- POST /store/order
-
- examples: [{contentType=application/json, example={
- POST /store/order - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
@ -206,15 +193,14 @@ public class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: RequestBuilder<Order>
*/
public class func placeOrderWithRequestBuilder(body body: Order? = nil) -> RequestBuilder<Order> {
public class func placeOrderWithRequestBuilder(order order: Order? = nil) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = order?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)

View File

@ -1,8 +1,8 @@
//
// UserAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -13,11 +13,11 @@ public class UserAPI: APIBase {
/**
Create user
- parameter body: (body) Created user object (optional)
- parameter user: (body) Created user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUser(body body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUser(user user: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -26,16 +26,14 @@ public class UserAPI: APIBase {
/**
Create user
- POST /user
- This can only be done by the logged in user.
- parameter body: (body) Created user object (optional)
- This can only be done by the logged in user. - parameter user: (body) Created user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUserWithRequestBuilder(body body: User? = nil) -> RequestBuilder<Void> {
public class func createUserWithRequestBuilder(user user: User? = nil) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -47,11 +45,11 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithArrayInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUsersWithArrayInput(user user: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -59,17 +57,14 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithArray
-
- parameter body: (body) List of user object (optional)
- POST /user/createWithArray - parameter user: (body) List of user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
public class func createUsersWithArrayInputWithRequestBuilder(user user: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -81,11 +76,11 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithListInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUsersWithListInput(user user: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -93,17 +88,14 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithList
-
- parameter body: (body) List of user object (optional)
- POST /user/createWithList - parameter user: (body) List of user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUsersWithListInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
public class func createUsersWithListInputWithRequestBuilder(user user: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -128,9 +120,7 @@ public class UserAPI: APIBase {
/**
Delete user
- DELETE /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) The name that needs to be deleted
- This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -165,9 +155,7 @@ public class UserAPI: APIBase {
/**
Get user by user name
- GET /user/{username}
-
- examples: [{contentType=application/json, example={
- GET /user/{username} - examples: [{contentType=application/json, example={
"firstName" : "firstName",
"lastName" : "lastName",
"password" : "password",
@ -205,7 +193,6 @@ public class UserAPI: APIBase {
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User>}]
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
- returns: RequestBuilder<User>
@ -242,12 +229,7 @@ public class UserAPI: APIBase {
/**
Logs user into the system
- GET /user/login
-
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=aeiou}]
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=aeiou}]
- parameter username: (query) The user name for login (optional)
- GET /user/login - parameter username: (query) The user name for login (optional)
- parameter password: (query) The password for login in clear text (optional)
- returns: RequestBuilder<String>
@ -285,8 +267,6 @@ public class UserAPI: APIBase {
/**
Logs out current logged in user session
- GET /user/logout
-
- returns: RequestBuilder<Void>
*/
public class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
@ -308,11 +288,11 @@ public class UserAPI: APIBase {
Updated user
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- parameter user: (body) Updated user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updateUser(username username: String, body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
public class func updateUser(username username: String, user: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -321,18 +301,16 @@ public class UserAPI: APIBase {
/**
Updated user
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- 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 (optional)
- returns: RequestBuilder<Void>
*/
public class func updateUserWithRequestBuilder(username username: String, body: User? = nil) -> RequestBuilder<Void> {
public class func updateUserWithRequestBuilder(username username: String, user: User? = nil) -> RequestBuilder<Void> {
var path = "/user/{username}"
path = path.stringByReplacingOccurrencesOfString("{username}", withString: "\(username)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)

View File

@ -1,7 +1,7 @@
// AlamofireImplementations.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -66,16 +66,12 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
switch v {
case let fileURL as NSURL:
mpForm.appendBodyPart(fileURL: fileURL, name: k)
break
case let string as NSString:
mpForm.appendBodyPart(data: string.dataUsingEncoding(NSUTF8StringEncoding)!, name: k)
break
case let number as NSNumber:
mpForm.appendBodyPart(data: number.stringValue.dataUsingEncoding(NSUTF8StringEncoding)!, name: k)
break
default:
fatalError("Unprocessable value \(v) with key \(k)")
break
}
}
},
@ -192,8 +188,6 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
completion(response: Response(response: response.response!, body: body), error: nil)
return
} else if "" is T {
// swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release
// https://github.com/swagger-api/swagger-parser/pull/34
completion(response: Response(response: response.response!, body: "" as! T), error: nil)
return
}

View File

@ -1,7 +1,7 @@
// Extensions.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire

View File

@ -1,7 +1,7 @@
// Models.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -80,7 +80,7 @@ class Decoders {
if let decoder = decoders[key] {
return decoder(source) as! T
} else {
fatalError("Source \(source) is not convertible to type \(clazz): Maybe swagger file is insufficient")
fatalError("Source \(source) is not convertible to type \(clazz): Maybe OpenAPI spec file is insufficient")
}
}

View File

@ -1,8 +1,8 @@
//
// Category.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Order.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Pet.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Tag.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// User.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -4,10 +4,10 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
s.version = '0.0.1'
s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }
s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }
s.authors = ''
s.license = 'Proprietary'
s.homepage = 'https://github.com/swagger-api/swagger-codegen'
s.homepage = 'https://github.com/openapitools/openapi-generator'
s.summary = 'PetstoreClient'
s.source_files = 'PetstoreClient/Classes/**/*.swift'
s.dependency 'PromiseKit', '~> 3.5.3'

View File

@ -1,7 +1,7 @@
// APIHelper.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
class APIHelper {

View File

@ -1,7 +1,7 @@
// APIs.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// PetAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -14,11 +14,11 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func addPet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func addPet(pet pet: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -26,12 +26,12 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: Promise<Void>
*/
public class func addPet(body body: Pet? = nil) -> Promise<Void> {
public class func addPet(pet pet: Pet? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
addPet(body: body) { error in
addPet(pet: pet) { error in
if let error = error {
deferred.reject(error)
} else {
@ -43,20 +43,17 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- POST /pet
-
- OAuth:
- POST /pet - OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: RequestBuilder<Void>
*/
public class func addPetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
public class func addPetWithRequestBuilder(pet pet: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = pet?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -99,12 +96,9 @@ public class PetAPI: APIBase {
/**
Deletes a pet
- DELETE /pet/{petId}
-
- OAuth:
- DELETE /pet/{petId} - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) Pet id to delete
- parameter apiKey: (header) (optional)
@ -133,7 +127,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findPetsByStatus(status status: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
@ -145,7 +139,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional)
- returns: Promise<[Pet]>
*/
public class func findPetsByStatus(status status: [String]? = nil) -> Promise<[Pet]> {
@ -163,19 +157,62 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- GET /pet/findByStatus
- Multiple status values can be provided with comma separated strings
- OAuth:
- Multiple status values can be provided with comma separated strings - OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example={
"name" : "Puma",
"type" : "Dog",
"color" : "Black",
"gender" : "Female",
"breed" : "Mixed"
}}]
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- parameter status: (query) Status values that need to be considered for filter (optional)
- returns: RequestBuilder<[Pet]>
*/
@ -229,11 +266,10 @@ public class PetAPI: APIBase {
/**
Finds Pets by tags
- GET /pet/findByTags
- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- OAuth:
- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example=[ {
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -249,23 +285,7 @@ public class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}, {contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -275,7 +295,7 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- examples: [{contentType=application/json, example=[ {
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -291,23 +311,7 @@ public class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}, {contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -317,7 +321,6 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- parameter tags: (query) Tags to filter by (optional)
- returns: RequestBuilder<[Pet]>
@ -372,8 +375,7 @@ public class PetAPI: APIBase {
/**
Find pet by ID
- GET /pet/{petId}
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- API Key:
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - API Key:
- type: apiKey api_key
- name: api_key
- OAuth:
@ -431,7 +433,6 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Pet>
@ -455,11 +456,11 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updatePet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func updatePet(pet pet: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -467,12 +468,12 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: Promise<Void>
*/
public class func updatePet(body body: Pet? = nil) -> Promise<Void> {
public class func updatePet(pet pet: Pet? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
updatePet(body: body) { error in
updatePet(pet: pet) { error in
if let error = error {
deferred.reject(error)
} else {
@ -484,20 +485,17 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- PUT /pet
-
- OAuth:
- PUT /pet - OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: RequestBuilder<Void>
*/
public class func updatePetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
public class func updatePetWithRequestBuilder(pet pet: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = pet?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -542,12 +540,9 @@ public class PetAPI: APIBase {
/**
Updates a pet in the store with form data
- POST /pet/{petId}
-
- OAuth:
- POST /pet/{petId} - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) ID of pet that needs to be updated
- parameter name: (form) Updated name of the pet (optional)
- parameter status: (form) Updated status of the pet (optional)
@ -609,12 +604,9 @@ public class PetAPI: APIBase {
/**
uploads an image
- POST /pet/{petId}/uploadImage
-
- OAuth:
- POST /pet/{petId}/uploadImage - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) ID of pet to update
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- parameter file: (form) file to upload (optional)

View File

@ -1,8 +1,8 @@
//
// StoreAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -44,9 +44,7 @@ public class StoreAPI: APIBase {
/**
Delete purchase order by ID
- DELETE /store/order/{orderId}
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- parameter orderId: (path) ID of the order that needs to be deleted
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -97,16 +95,9 @@ public class StoreAPI: APIBase {
/**
Returns pet inventories by status
- GET /store/inventory
- Returns a map of status codes to quantities
- API Key:
- Returns a map of status codes to quantities - API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
"key" : 0
}}, {contentType=application/xml, example=}]
- examples: [{contentType=application/json, example={
"key" : 0
}}, {contentType=application/xml, example=}]
- returns: RequestBuilder<[String:Int32]>
*/
@ -158,8 +149,7 @@ public class StoreAPI: APIBase {
/**
Find purchase order by ID
- GET /store/order/{orderId}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- examples: [{contentType=application/json, example={
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
@ -189,7 +179,6 @@ public class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter orderId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Order>
@ -213,11 +202,11 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func placeOrder(body body: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func placeOrder(order order: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
@ -225,12 +214,12 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: Promise<Order>
*/
public class func placeOrder(body body: Order? = nil) -> Promise<Order> {
public class func placeOrder(order order: Order? = nil) -> Promise<Order> {
let deferred = Promise<Order>.pendingPromise()
placeOrder(body: body) { data, error in
placeOrder(order: order) { data, error in
if let error = error {
deferred.reject(error)
} else {
@ -242,9 +231,7 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- POST /store/order
-
- examples: [{contentType=application/json, example={
- POST /store/order - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
@ -274,15 +261,14 @@ public class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: RequestBuilder<Order>
*/
public class func placeOrderWithRequestBuilder(body body: Order? = nil) -> RequestBuilder<Order> {
public class func placeOrderWithRequestBuilder(order order: Order? = nil) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = order?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)

View File

@ -1,8 +1,8 @@
//
// UserAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -14,11 +14,11 @@ public class UserAPI: APIBase {
/**
Create user
- parameter body: (body) Created user object (optional)
- parameter user: (body) Created user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUser(body body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUser(user user: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -26,12 +26,12 @@ public class UserAPI: APIBase {
/**
Create user
- parameter body: (body) Created user object (optional)
- parameter user: (body) Created user object (optional)
- returns: Promise<Void>
*/
public class func createUser(body body: User? = nil) -> Promise<Void> {
public class func createUser(user user: User? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
createUser(body: body) { error in
createUser(user: user) { error in
if let error = error {
deferred.reject(error)
} else {
@ -44,16 +44,14 @@ public class UserAPI: APIBase {
/**
Create user
- POST /user
- This can only be done by the logged in user.
- parameter body: (body) Created user object (optional)
- This can only be done by the logged in user. - parameter user: (body) Created user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUserWithRequestBuilder(body body: User? = nil) -> RequestBuilder<Void> {
public class func createUserWithRequestBuilder(user user: User? = nil) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -65,11 +63,11 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithArrayInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUsersWithArrayInput(user user: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -77,12 +75,12 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- returns: Promise<Void>
*/
public class func createUsersWithArrayInput(body body: [User]? = nil) -> Promise<Void> {
public class func createUsersWithArrayInput(user user: [User]? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
createUsersWithArrayInput(body: body) { error in
createUsersWithArrayInput(user: user) { error in
if let error = error {
deferred.reject(error)
} else {
@ -94,17 +92,14 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithArray
-
- parameter body: (body) List of user object (optional)
- POST /user/createWithArray - parameter user: (body) List of user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
public class func createUsersWithArrayInputWithRequestBuilder(user user: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -116,11 +111,11 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithListInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUsersWithListInput(user user: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -128,12 +123,12 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- returns: Promise<Void>
*/
public class func createUsersWithListInput(body body: [User]? = nil) -> Promise<Void> {
public class func createUsersWithListInput(user user: [User]? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
createUsersWithListInput(body: body) { error in
createUsersWithListInput(user: user) { error in
if let error = error {
deferred.reject(error)
} else {
@ -145,17 +140,14 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithList
-
- parameter body: (body) List of user object (optional)
- POST /user/createWithList - parameter user: (body) List of user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUsersWithListInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
public class func createUsersWithListInputWithRequestBuilder(user user: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -197,9 +189,7 @@ public class UserAPI: APIBase {
/**
Delete user
- DELETE /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) The name that needs to be deleted
- This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -251,9 +241,7 @@ public class UserAPI: APIBase {
/**
Get user by user name
- GET /user/{username}
-
- examples: [{contentType=application/json, example={
- GET /user/{username} - examples: [{contentType=application/json, example={
"firstName" : "firstName",
"lastName" : "lastName",
"password" : "password",
@ -291,7 +279,6 @@ public class UserAPI: APIBase {
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User>}]
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
- returns: RequestBuilder<User>
@ -346,12 +333,7 @@ public class UserAPI: APIBase {
/**
Logs user into the system
- GET /user/login
-
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=aeiou}]
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=aeiou}]
- parameter username: (query) The user name for login (optional)
- GET /user/login - parameter username: (query) The user name for login (optional)
- parameter password: (query) The password for login in clear text (optional)
- returns: RequestBuilder<String>
@ -405,8 +387,6 @@ public class UserAPI: APIBase {
/**
Logs out current logged in user session
- GET /user/logout
-
- returns: RequestBuilder<Void>
*/
public class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
@ -428,11 +408,11 @@ public class UserAPI: APIBase {
Updated user
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- parameter user: (body) Updated user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updateUser(username username: String, body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
public class func updateUser(username username: String, user: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -441,12 +421,12 @@ public class UserAPI: APIBase {
Updated user
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- parameter user: (body) Updated user object (optional)
- returns: Promise<Void>
*/
public class func updateUser(username username: String, body: User? = nil) -> Promise<Void> {
public class func updateUser(username username: String, user: User? = nil) -> Promise<Void> {
let deferred = Promise<Void>.pendingPromise()
updateUser(username: username, body: body) { error in
updateUser(username: username, user: user) { error in
if let error = error {
deferred.reject(error)
} else {
@ -459,18 +439,16 @@ public class UserAPI: APIBase {
/**
Updated user
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- 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 (optional)
- returns: RequestBuilder<Void>
*/
public class func updateUserWithRequestBuilder(username username: String, body: User? = nil) -> RequestBuilder<Void> {
public class func updateUserWithRequestBuilder(username username: String, user: User? = nil) -> RequestBuilder<Void> {
var path = "/user/{username}"
path = path.stringByReplacingOccurrencesOfString("{username}", withString: "\(username)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)

View File

@ -1,7 +1,7 @@
// AlamofireImplementations.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -66,16 +66,12 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
switch v {
case let fileURL as NSURL:
mpForm.appendBodyPart(fileURL: fileURL, name: k)
break
case let string as NSString:
mpForm.appendBodyPart(data: string.dataUsingEncoding(NSUTF8StringEncoding)!, name: k)
break
case let number as NSNumber:
mpForm.appendBodyPart(data: number.stringValue.dataUsingEncoding(NSUTF8StringEncoding)!, name: k)
break
default:
fatalError("Unprocessable value \(v) with key \(k)")
break
}
}
},
@ -192,8 +188,6 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
completion(response: Response(response: response.response!, body: body), error: nil)
return
} else if "" is T {
// swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release
// https://github.com/swagger-api/swagger-parser/pull/34
completion(response: Response(response: response.response!, body: "" as! T), error: nil)
return
}

View File

@ -1,7 +1,7 @@
// Extensions.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire

View File

@ -1,7 +1,7 @@
// Models.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -80,7 +80,7 @@ class Decoders {
if let decoder = decoders[key] {
return decoder(source) as! T
} else {
fatalError("Source \(source) is not convertible to type \(clazz): Maybe swagger file is insufficient")
fatalError("Source \(source) is not convertible to type \(clazz): Maybe OpenAPI spec file is insufficient")
}
}

View File

@ -1,8 +1,8 @@
//
// Category.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Order.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Pet.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Tag.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// User.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -4,10 +4,10 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
s.version = '0.0.1'
s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }
s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }
s.authors = ''
s.license = 'Proprietary'
s.homepage = 'https://github.com/swagger-api/swagger-codegen'
s.homepage = 'https://github.com/openapitools/openapi-generator'
s.summary = 'PetstoreClient'
s.source_files = 'PetstoreClient/Classes/**/*.swift'
s.dependency 'RxSwift', '~> 2.6.1'

View File

@ -1,7 +1,7 @@
// APIHelper.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
class APIHelper {

View File

@ -1,7 +1,7 @@
// APIs.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// PetAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -14,11 +14,11 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func addPet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func addPet(pet pet: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -26,12 +26,12 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: Observable<Void>
*/
public class func addPet(body body: Pet? = nil) -> Observable<Void> {
public class func addPet(pet pet: Pet? = nil) -> Observable<Void> {
return Observable.create { observer -> Disposable in
addPet(body: body) { error in
addPet(pet: pet) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -45,20 +45,17 @@ public class PetAPI: APIBase {
/**
Add a new pet to the store
- POST /pet
-
- OAuth:
- POST /pet - OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: RequestBuilder<Void>
*/
public class func addPetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
public class func addPetWithRequestBuilder(pet pet: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = pet?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -103,12 +100,9 @@ public class PetAPI: APIBase {
/**
Deletes a pet
- DELETE /pet/{petId}
-
- OAuth:
- DELETE /pet/{petId} - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) Pet id to delete
- parameter apiKey: (header) (optional)
@ -137,7 +131,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func findPetsByStatus(status status: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) {
@ -149,7 +143,7 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
- parameter status: (query) Status values that need to be considered for filter (optional)
- returns: Observable<[Pet]>
*/
public class func findPetsByStatus(status status: [String]? = nil) -> Observable<[Pet]> {
@ -169,19 +163,62 @@ public class PetAPI: APIBase {
/**
Finds Pets by status
- GET /pet/findByStatus
- Multiple status values can be provided with comma separated strings
- OAuth:
- Multiple status values can be provided with comma separated strings - OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example={
"name" : "Puma",
"type" : "Dog",
"color" : "Black",
"gender" : "Female",
"breed" : "Mixed"
}}]
- parameter status: (query) Status values that need to be considered for filter (optional, default to available)
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- parameter status: (query) Status values that need to be considered for filter (optional)
- returns: RequestBuilder<[Pet]>
*/
@ -237,11 +274,10 @@ public class PetAPI: APIBase {
/**
Finds Pets by tags
- GET /pet/findByTags
- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
- OAuth:
- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/json, example=[ {
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -257,23 +293,7 @@ public class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}, {contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -283,7 +303,7 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- examples: [{contentType=application/json, example=[ {
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -299,23 +319,7 @@ public class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}, {contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -325,7 +329,6 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- parameter tags: (query) Tags to filter by (optional)
- returns: RequestBuilder<[Pet]>
@ -382,8 +385,7 @@ public class PetAPI: APIBase {
/**
Find pet by ID
- GET /pet/{petId}
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- API Key:
- Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - API Key:
- type: apiKey api_key
- name: api_key
- OAuth:
@ -441,7 +443,6 @@ public class PetAPI: APIBase {
</tags>
<status>aeiou</status>
</Pet>}]
- parameter petId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Pet>
@ -465,11 +466,11 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updatePet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func updatePet(pet pet: Pet? = nil, completion: ((error: ErrorType?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -477,12 +478,12 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: Observable<Void>
*/
public class func updatePet(body body: Pet? = nil) -> Observable<Void> {
public class func updatePet(pet pet: Pet? = nil) -> Observable<Void> {
return Observable.create { observer -> Disposable in
updatePet(body: body) { error in
updatePet(pet: pet) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -496,20 +497,17 @@ public class PetAPI: APIBase {
/**
Update an existing pet
- PUT /pet
-
- OAuth:
- PUT /pet - OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store (optional)
- parameter pet: (body) Pet object that needs to be added to the store (optional)
- returns: RequestBuilder<Void>
*/
public class func updatePetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder<Void> {
public class func updatePetWithRequestBuilder(pet pet: Pet? = nil) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = pet?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -556,12 +554,9 @@ public class PetAPI: APIBase {
/**
Updates a pet in the store with form data
- POST /pet/{petId}
-
- OAuth:
- POST /pet/{petId} - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) ID of pet that needs to be updated
- parameter name: (form) Updated name of the pet (optional)
- parameter status: (form) Updated status of the pet (optional)
@ -625,12 +620,9 @@ public class PetAPI: APIBase {
/**
uploads an image
- POST /pet/{petId}/uploadImage
-
- OAuth:
- POST /pet/{petId}/uploadImage - OAuth:
- type: oauth2
- name: petstore_auth
- parameter petId: (path) ID of pet to update
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
- parameter file: (form) file to upload (optional)

View File

@ -1,8 +1,8 @@
//
// StoreAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -46,9 +46,7 @@ public class StoreAPI: APIBase {
/**
Delete purchase order by ID
- DELETE /store/order/{orderId}
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- parameter orderId: (path) ID of the order that needs to be deleted
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - parameter orderId: (path) ID of the order that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -101,16 +99,9 @@ public class StoreAPI: APIBase {
/**
Returns pet inventories by status
- GET /store/inventory
- Returns a map of status codes to quantities
- API Key:
- Returns a map of status codes to quantities - API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
"key" : 0
}}, {contentType=application/xml, example=}]
- examples: [{contentType=application/json, example={
"key" : 0
}}, {contentType=application/xml, example=}]
- returns: RequestBuilder<[String:Int32]>
*/
@ -164,8 +155,7 @@ public class StoreAPI: APIBase {
/**
Find purchase order by ID
- GET /store/order/{orderId}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- examples: [{contentType=application/json, example={
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
@ -195,7 +185,6 @@ public class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter orderId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Order>
@ -219,11 +208,11 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func placeOrder(body body: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func placeOrder(order order: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
completion(data: response?.body, error: error);
}
}
@ -231,12 +220,12 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: Observable<Order>
*/
public class func placeOrder(body body: Order? = nil) -> Observable<Order> {
public class func placeOrder(order order: Order? = nil) -> Observable<Order> {
return Observable.create { observer -> Disposable in
placeOrder(body: body) { data, error in
placeOrder(order: order) { data, error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -250,9 +239,7 @@ public class StoreAPI: APIBase {
/**
Place an order for a pet
- POST /store/order
-
- examples: [{contentType=application/json, example={
- POST /store/order - examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
@ -282,15 +269,14 @@ public class StoreAPI: APIBase {
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter body: (body) order placed for purchasing the pet (optional)
- parameter order: (body) order placed for purchasing the pet (optional)
- returns: RequestBuilder<Order>
*/
public class func placeOrderWithRequestBuilder(body body: Order? = nil) -> RequestBuilder<Order> {
public class func placeOrderWithRequestBuilder(order order: Order? = nil) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = order?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)

View File

@ -1,8 +1,8 @@
//
// UserAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -14,11 +14,11 @@ public class UserAPI: APIBase {
/**
Create user
- parameter body: (body) Created user object (optional)
- parameter user: (body) Created user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUser(body body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUser(user user: User? = nil, completion: ((error: ErrorType?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -26,12 +26,12 @@ public class UserAPI: APIBase {
/**
Create user
- parameter body: (body) Created user object (optional)
- parameter user: (body) Created user object (optional)
- returns: Observable<Void>
*/
public class func createUser(body body: User? = nil) -> Observable<Void> {
public class func createUser(user user: User? = nil) -> Observable<Void> {
return Observable.create { observer -> Disposable in
createUser(body: body) { error in
createUser(user: user) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -46,16 +46,14 @@ public class UserAPI: APIBase {
/**
Create user
- POST /user
- This can only be done by the logged in user.
- parameter body: (body) Created user object (optional)
- This can only be done by the logged in user. - parameter user: (body) Created user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUserWithRequestBuilder(body body: User? = nil) -> RequestBuilder<Void> {
public class func createUserWithRequestBuilder(user user: User? = nil) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -67,11 +65,11 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithArrayInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUsersWithArrayInput(user user: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -79,12 +77,12 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- returns: Observable<Void>
*/
public class func createUsersWithArrayInput(body body: [User]? = nil) -> Observable<Void> {
public class func createUsersWithArrayInput(user user: [User]? = nil) -> Observable<Void> {
return Observable.create { observer -> Disposable in
createUsersWithArrayInput(body: body) { error in
createUsersWithArrayInput(user: user) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -98,17 +96,14 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithArray
-
- parameter body: (body) List of user object (optional)
- POST /user/createWithArray - parameter user: (body) List of user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
public class func createUsersWithArrayInputWithRequestBuilder(user user: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -120,11 +115,11 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func createUsersWithListInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
public class func createUsersWithListInput(user user: [User]? = nil, completion: ((error: ErrorType?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -132,12 +127,12 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object (optional)
- parameter user: (body) List of user object (optional)
- returns: Observable<Void>
*/
public class func createUsersWithListInput(body body: [User]? = nil) -> Observable<Void> {
public class func createUsersWithListInput(user user: [User]? = nil) -> Observable<Void> {
return Observable.create { observer -> Disposable in
createUsersWithListInput(body: body) { error in
createUsersWithListInput(user: user) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -151,17 +146,14 @@ public class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithList
-
- parameter body: (body) List of user object (optional)
- POST /user/createWithList - parameter user: (body) List of user object (optional)
- returns: RequestBuilder<Void>
*/
public class func createUsersWithListInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder<Void> {
public class func createUsersWithListInputWithRequestBuilder(user user: [User]? = nil) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)
@ -205,9 +197,7 @@ public class UserAPI: APIBase {
/**
Delete user
- DELETE /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) The name that needs to be deleted
- This can only be done by the logged in user. - parameter username: (path) The name that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -261,9 +251,7 @@ public class UserAPI: APIBase {
/**
Get user by user name
- GET /user/{username}
-
- examples: [{contentType=application/json, example={
- GET /user/{username} - examples: [{contentType=application/json, example={
"firstName" : "firstName",
"lastName" : "lastName",
"password" : "password",
@ -301,7 +289,6 @@ public class UserAPI: APIBase {
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User>}]
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
- returns: RequestBuilder<User>
@ -358,12 +345,7 @@ public class UserAPI: APIBase {
/**
Logs user into the system
- GET /user/login
-
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=aeiou}]
- examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=aeiou}]
- parameter username: (query) The user name for login (optional)
- GET /user/login - parameter username: (query) The user name for login (optional)
- parameter password: (query) The password for login in clear text (optional)
- returns: RequestBuilder<String>
@ -419,8 +401,6 @@ public class UserAPI: APIBase {
/**
Logs out current logged in user session
- GET /user/logout
-
- returns: RequestBuilder<Void>
*/
public class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
@ -442,11 +422,11 @@ public class UserAPI: APIBase {
Updated user
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- parameter user: (body) Updated user object (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
public class func updateUser(username username: String, body: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
public class func updateUser(username username: String, user: User? = nil, completion: ((error: ErrorType?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
completion(error: error);
}
}
@ -455,12 +435,12 @@ public class UserAPI: APIBase {
Updated user
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- parameter user: (body) Updated user object (optional)
- returns: Observable<Void>
*/
public class func updateUser(username username: String, body: User? = nil) -> Observable<Void> {
public class func updateUser(username username: String, user: User? = nil) -> Observable<Void> {
return Observable.create { observer -> Disposable in
updateUser(username: username, body: body) { error in
updateUser(username: username, user: user) { error in
if let error = error {
observer.on(.Error(error as ErrorType))
} else {
@ -475,18 +455,16 @@ public class UserAPI: APIBase {
/**
Updated user
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object (optional)
- 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 (optional)
- returns: RequestBuilder<Void>
*/
public class func updateUserWithRequestBuilder(username username: String, body: User? = nil) -> RequestBuilder<Void> {
public class func updateUserWithRequestBuilder(username username: String, user: User? = nil) -> RequestBuilder<Void> {
var path = "/user/{username}"
path = path.stringByReplacingOccurrencesOfString("{username}", withString: "\(username)", options: .LiteralSearch, range: nil)
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON() as? [String:AnyObject]
let parameters = user?.encodeToJSON() as? [String:AnyObject]
let convertedParameters = APIHelper.convertBoolToString(parameters)

View File

@ -1,7 +1,7 @@
// AlamofireImplementations.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire
@ -66,16 +66,12 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
switch v {
case let fileURL as NSURL:
mpForm.appendBodyPart(fileURL: fileURL, name: k)
break
case let string as NSString:
mpForm.appendBodyPart(data: string.dataUsingEncoding(NSUTF8StringEncoding)!, name: k)
break
case let number as NSNumber:
mpForm.appendBodyPart(data: number.stringValue.dataUsingEncoding(NSUTF8StringEncoding)!, name: k)
break
default:
fatalError("Unprocessable value \(v) with key \(k)")
break
}
}
},
@ -192,8 +188,6 @@ class AlamofireRequestBuilder<T>: RequestBuilder<T> {
completion(response: Response(response: response.response!, body: body), error: nil)
return
} else if "" is T {
// swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release
// https://github.com/swagger-api/swagger-parser/pull/34
completion(response: Response(response: response.response!, body: "" as! T), error: nil)
return
}

View File

@ -1,7 +1,7 @@
// Extensions.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Alamofire

View File

@ -1,7 +1,7 @@
// Models.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -80,7 +80,7 @@ class Decoders {
if let decoder = decoders[key] {
return decoder(source) as! T
} else {
fatalError("Source \(source) is not convertible to type \(clazz): Maybe swagger file is insufficient")
fatalError("Source \(source) is not convertible to type \(clazz): Maybe OpenAPI spec file is insufficient")
}
}

View File

@ -1,8 +1,8 @@
//
// Category.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Order.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Pet.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Tag.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// User.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -4,10 +4,10 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.version = '0.0.1'
s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }
s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }
s.authors = ''
s.license = 'Proprietary'
s.homepage = 'https://github.com/swagger-api/swagger-codegen'
s.homepage = 'https://github.com/openapitools/openapi-generator'
s.summary = 'PetstoreClient'
s.source_files = 'PetstoreClient/Classes/**/*.swift'
s.dependency 'Alamofire', '~> 4.5.0'

View File

@ -1,7 +1,7 @@
// APIHelper.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,7 +1,7 @@
// APIs.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// AnotherFakeAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -12,11 +12,11 @@ import Alamofire
open class AnotherFakeAPI: APIBase {
/**
To test special tags
- parameter body: (body) client model
- parameter client: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testSpecialTags(body: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) {
testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func testSpecialTags(client: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) {
testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@ -26,17 +26,16 @@ open class AnotherFakeAPI: APIBase {
To test special tags
- PATCH /another-fake/dummy
- To test special tags
- examples: [{contentType=application/json, example={
"client" : "client"
}}]
- parameter body: (body) client model
- parameter client: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
open class func testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
let path = "/another-fake/dummy"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = client.encodeToJSON()
let url = URLComponents(string: URLString)

View File

@ -1,8 +1,8 @@
//
// FakeAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -14,7 +14,7 @@ open class FakeAPI: APIBase {
- parameter body: (body) Input boolean as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil, completion: @escaping ((_ data: OuterBoolean?, _ error: ErrorResponse?) -> Void)) {
open class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping ((_ data: Bool?, _ error: ErrorResponse?) -> Void)) {
fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
@ -24,29 +24,28 @@ open class FakeAPI: APIBase {
/**
- POST /fake/outer/boolean
- Test serialization of outer boolean types
- examples: [{contentType=application/json, example={ }}]
- examples: [{contentType=*/*, example=null}]
- parameter body: (body) Input boolean as post body (optional)
- returns: RequestBuilder<OuterBoolean>
- returns: RequestBuilder<Bool>
*/
open class func fakeOuterBooleanSerializeWithRequestBuilder(body: OuterBoolean? = nil) -> RequestBuilder<OuterBoolean> {
open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder<Bool> {
let path = "/fake/outer/boolean"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON()
let url = URLComponents(string: URLString)
let requestBuilder: RequestBuilder<OuterBoolean>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
let requestBuilder: RequestBuilder<Bool>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
}
/**
- parameter body: (body) Input composite as post body (optional)
- parameter outerComposite: (body) Input composite as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?, _ error: ErrorResponse?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?, _ error: ErrorResponse?) -> Void)) {
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@ -55,19 +54,14 @@ open class FakeAPI: APIBase {
/**
- POST /fake/outer/composite
- Test serialization of object with outer number type
- examples: [{contentType=application/json, example={
"my_string" : { },
"my_number" : { },
"my_boolean" : { }
}}]
- parameter body: (body) Input composite as post body (optional)
- examples: [{contentType=*/*, example={ }}]
- parameter outerComposite: (body) Input composite as post body (optional)
- returns: RequestBuilder<OuterComposite>
*/
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
let path = "/fake/outer/composite"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON()
let parameters = outerComposite?.encodeToJSON()
let url = URLComponents(string: URLString)
@ -80,7 +74,7 @@ open class FakeAPI: APIBase {
- parameter body: (body) Input number as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterNumberSerialize(body: OuterNumber? = nil, completion: @escaping ((_ data: OuterNumber?, _ error: ErrorResponse?) -> Void)) {
open class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping ((_ data: Double?, _ error: ErrorResponse?) -> Void)) {
fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
@ -90,19 +84,18 @@ open class FakeAPI: APIBase {
/**
- POST /fake/outer/number
- Test serialization of outer number types
- examples: [{contentType=application/json, example={ }}]
- examples: [{contentType=*/*, example=null}]
- parameter body: (body) Input number as post body (optional)
- returns: RequestBuilder<OuterNumber>
- returns: RequestBuilder<Double>
*/
open class func fakeOuterNumberSerializeWithRequestBuilder(body: OuterNumber? = nil) -> RequestBuilder<OuterNumber> {
open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder<Double> {
let path = "/fake/outer/number"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON()
let url = URLComponents(string: URLString)
let requestBuilder: RequestBuilder<OuterNumber>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
let requestBuilder: RequestBuilder<Double>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
}
@ -111,7 +104,7 @@ open class FakeAPI: APIBase {
- parameter body: (body) Input string as post body (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func fakeOuterStringSerialize(body: OuterString? = nil, completion: @escaping ((_ data: OuterString?, _ error: ErrorResponse?) -> Void)) {
open class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping ((_ data: String?, _ error: ErrorResponse?) -> Void)) {
fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
completion(response?.body, error)
}
@ -121,30 +114,29 @@ open class FakeAPI: APIBase {
/**
- POST /fake/outer/string
- Test serialization of outer string types
- examples: [{contentType=application/json, example={ }}]
- examples: [{contentType=*/*, example=null}]
- parameter body: (body) Input string as post body (optional)
- returns: RequestBuilder<OuterString>
- returns: RequestBuilder<String>
*/
open class func fakeOuterStringSerializeWithRequestBuilder(body: OuterString? = nil) -> RequestBuilder<OuterString> {
open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder<String> {
let path = "/fake/outer/string"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body?.encodeToJSON()
let url = URLComponents(string: URLString)
let requestBuilder: RequestBuilder<OuterString>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
}
/**
To test \"client\" model
- parameter body: (body) client model
- parameter client: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) {
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) {
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@ -154,17 +146,16 @@ open class FakeAPI: APIBase {
To test \"client\" model
- PATCH /fake
- To test \"client\" model
- examples: [{contentType=application/json, example={
"client" : "client"
}}]
- parameter body: (body) client model
- parameter client: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = client.encodeToJSON()
let url = URLComponents(string: URLString)
@ -191,7 +182,7 @@ open class FakeAPI: APIBase {
- parameter callback: (form) None (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int32? = nil, int32: Int32? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: ISOFullDate? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int32? = nil, int32: Int32? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: ISOFullDate? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute { (response, error) -> Void in
completion(error)
}
@ -203,7 +194,7 @@ open class FakeAPI: APIBase {
- POST /fake
- Fake endpoint for testing various parameters
- BASIC:
- type: basic
- type: http
- name: http_basic_test
- parameter number: (form) None
- parameter double: (form) None
@ -221,7 +212,7 @@ open class FakeAPI: APIBase {
- parameter callback: (form) None (optional)
- returns: RequestBuilder<Void>
*/
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int32? = nil, int32: Int32? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: ISOFullDate? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int32? = nil, int32: Int32? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: ISOFullDate? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let formParams: [String:Any?] = [
@ -251,23 +242,6 @@ open class FakeAPI: APIBase {
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
}
/**
* enum for parameter enumFormStringArray
*/
public enum EnumFormStringArray_testEnumParameters: String {
case greaterThan = ">"
case dollar = "$"
}
/**
* enum for parameter enumFormString
*/
public enum EnumFormString_testEnumParameters: String {
case abc = "_abc"
case efg = "-efg"
case xyz = "(xyz)"
}
/**
* enum for parameter enumHeaderStringArray
*/
@ -310,6 +284,23 @@ open class FakeAPI: APIBase {
case number2 = -2
}
/**
* enum for parameter enumFormStringArray
*/
public enum EnumFormStringArray_testEnumParameters: String {
case greaterThan = "">""
case dollar = ""$""
}
/**
* enum for parameter enumFormString
*/
public enum EnumFormString_testEnumParameters: String {
case abc = "_abc"
case efg = "-efg"
case xyz = "(xyz)"
}
/**
* enum for parameter enumQueryDouble
*/
@ -320,18 +311,18 @@ open class FakeAPI: APIBase {
/**
To test enum parameters
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
- parameter enumFormString: (form) Form parameter enum test (string) (optional, default to -efg)
- parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional)
- parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to -efg)
- parameter enumHeaderString: (header) Header parameter enum test (string) (optional)
- parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional)
- parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to -efg)
- parameter enumQueryString: (query) Query parameter enum test (string) (optional)
- parameter enumQueryInteger: (query) Query parameter enum test (double) (optional)
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
- parameter enumFormString: (form) Form parameter enum test (string) (optional)
- parameter enumQueryDouble: (form) Query parameter enum test (double) (optional)
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
testEnumParametersWithRequestBuilder(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in
open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in
completion(error)
}
}
@ -341,18 +332,17 @@ open class FakeAPI: APIBase {
To test enum parameters
- GET /fake
- To test enum parameters
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
- parameter enumFormString: (form) Form parameter enum test (string) (optional, default to -efg)
- parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional)
- parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to -efg)
- parameter enumHeaderString: (header) Header parameter enum test (string) (optional)
- parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional)
- parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to -efg)
- parameter enumQueryString: (query) Query parameter enum test (string) (optional)
- parameter enumQueryInteger: (query) Query parameter enum test (double) (optional)
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
- parameter enumFormString: (form) Form parameter enum test (string) (optional)
- parameter enumQueryDouble: (form) Query parameter enum test (double) (optional)
- returns: RequestBuilder<Void>
*/
open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder<Void> {
open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder<Void> {
let path = "/fake"
let URLString = PetstoreClientAPI.basePath + path
let formParams: [String:Any?] = [
@ -366,8 +356,8 @@ open class FakeAPI: APIBase {
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems(values:[
"enum_query_string_array": enumQueryStringArray,
"enum_query_string": enumQueryString?.rawValue,
"enum_query_string_array": enumQueryStringArray,
"enum_query_string": enumQueryString?.rawValue,
"enum_query_integer": enumQueryInteger?.rawValue
])
let nillableHeaders: [String: Any?] = [
@ -397,8 +387,6 @@ open class FakeAPI: APIBase {
/**
test json serialization of form data
- GET /fake/jsonFormData
-
- parameter param: (form) field1
- parameter param2: (form) field2
- returns: RequestBuilder<Void>

View File

@ -1,8 +1,8 @@
//
// FakeClassnameTags123API.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -12,11 +12,11 @@ import Alamofire
open class FakeClassnameTags123API: APIBase {
/**
To test class name in snake case
- parameter body: (body) client model
- parameter client: (body) client model
- parameter completion: completion handler to receive the data and the error objects
*/
open class func testClassname(body: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) {
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func testClassname(client: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) {
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@ -31,13 +31,13 @@ open class FakeClassnameTags123API: APIBase {
- examples: [{contentType=application/json, example={
"client" : "client"
}}]
- parameter body: (body) client model
- parameter client: (body) client model
- returns: RequestBuilder<Client>
*/
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
let path = "/fake_classname_test"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = client.encodeToJSON()
let url = URLComponents(string: URLString)

View File

@ -1,8 +1,8 @@
//
// PetAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -12,11 +12,11 @@ import Alamofire
open class PetAPI: APIBase {
/**
Add a new pet to the store
- parameter body: (body) Pet object that needs to be added to the store
- parameter pet: (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(body: Pet, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func addPet(pet: Pet, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error)
}
}
@ -25,17 +25,16 @@ open class PetAPI: APIBase {
/**
Add a new pet to the store
- POST /pet
-
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store
- parameter pet: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = pet.encodeToJSON()
let url = URLComponents(string: URLString)
@ -60,7 +59,6 @@ open class PetAPI: APIBase {
/**
Deletes a pet
- DELETE /pet/{petId}
-
- OAuth:
- type: oauth2
- name: petstore_auth
@ -115,7 +113,23 @@ open class PetAPI: APIBase {
- OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/xml, example=<Pet>
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -124,7 +138,8 @@ open class PetAPI: APIBase {
<tags>
</tags>
<status>aeiou</status>
</Pet>}, {contentType=application/json, example=[ {
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -140,24 +155,7 @@ open class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}]
- examples: [{contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -166,39 +164,7 @@ open class PetAPI: APIBase {
<tags>
</tags>
<status>aeiou</status>
</Pet>}, {contentType=application/json, example=[ {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}]
</Pet>}]
- parameter status: (query) Status values that need to be considered for filter
- returns: RequestBuilder<[Pet]>
*/
@ -236,7 +202,23 @@ open class PetAPI: APIBase {
- OAuth:
- type: oauth2
- name: petstore_auth
- examples: [{contentType=application/xml, example=<Pet>
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -245,7 +227,8 @@ open class PetAPI: APIBase {
<tags>
</tags>
<status>aeiou</status>
</Pet>}, {contentType=application/json, example=[ {
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -261,24 +244,7 @@ open class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}]
- examples: [{contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -287,39 +253,7 @@ open class PetAPI: APIBase {
<tags>
</tags>
<status>aeiou</status>
</Pet>}, {contentType=application/json, example=[ {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]}]
</Pet>}]
- parameter tags: (query) Tags to filter by
- returns: RequestBuilder<[Pet]>
*/
@ -357,16 +291,7 @@ open class PetAPI: APIBase {
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}, {contentType=application/json, example={
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -382,8 +307,7 @@ open class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}}]
- examples: [{contentType=application/xml, example=<Pet>
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
@ -392,7 +316,8 @@ open class PetAPI: APIBase {
<tags>
</tags>
<status>aeiou</status>
</Pet>}, {contentType=application/json, example={
</Pet>}]
- examples: [{contentType=application/json, example={
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
@ -408,7 +333,16 @@ open class PetAPI: APIBase {
"id" : 1
} ],
"status" : "available"
}}]
}}, {contentType=application/xml, example=<Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet>}]
- parameter petId: (path) ID of pet to return
- returns: RequestBuilder<Pet>
*/
@ -429,11 +363,11 @@ open class PetAPI: APIBase {
/**
Update an existing pet
- parameter body: (body) Pet object that needs to be added to the store
- parameter pet: (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(body: Pet, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func updatePet(pet: Pet, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
completion(error)
}
}
@ -442,17 +376,16 @@ open class PetAPI: APIBase {
/**
Update an existing pet
- PUT /pet
-
- OAuth:
- type: oauth2
- name: petstore_auth
- parameter body: (body) Pet object that needs to be added to the store
- parameter pet: (body) Pet object that needs to be added to the store
- returns: RequestBuilder<Void>
*/
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
let path = "/pet"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = pet.encodeToJSON()
let url = URLComponents(string: URLString)
@ -478,7 +411,6 @@ open class PetAPI: APIBase {
/**
Updates a pet in the store with form data
- POST /pet/{petId}
-
- OAuth:
- type: oauth2
- name: petstore_auth
@ -525,7 +457,6 @@ open class PetAPI: APIBase {
/**
uploads an image
- POST /pet/{petId}/uploadImage
-
- OAuth:
- type: oauth2
- name: petstore_auth

View File

@ -1,8 +1,8 @@
//
// StoreAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -26,7 +26,6 @@ open class StoreAPI: APIBase {
Delete purchase order by ID
- DELETE /store/order/{order_id}
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
- parameter orderId: (path) ID of the order that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -63,9 +62,6 @@ open class StoreAPI: APIBase {
- API Key:
- type: apiKey api_key
- name: api_key
- examples: [{contentType=application/json, example={
"key" : 0
}}]
- returns: RequestBuilder<[String:Int32]>
*/
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int32]> {
@ -96,37 +92,36 @@ open class StoreAPI: APIBase {
Find purchase order by ID
- GET /store/order/{order_id}
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- examples: [{contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}, {contentType=application/json, example={
- examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"
}}]
- examples: [{contentType=application/xml, example=<Order>
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}, {contentType=application/json, example={
</Order>}]
- examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"
}}]
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter orderId: (path) ID of pet that needs to be fetched
- returns: RequestBuilder<Order>
*/
@ -147,11 +142,11 @@ open class StoreAPI: APIBase {
/**
Place an order for a pet
- parameter body: (body) order placed for purchasing the pet
- parameter order: (body) order placed for purchasing the pet
- parameter completion: completion handler to receive the data and the error objects
*/
open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?, _ error: ErrorResponse?) -> Void)) {
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?, _ error: ErrorResponse?) -> Void)) {
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
completion(response?.body, error)
}
}
@ -160,45 +155,43 @@ open class StoreAPI: APIBase {
/**
Place an order for a pet
- POST /store/order
-
- examples: [{contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}, {contentType=application/json, example={
- examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"
}}]
- examples: [{contentType=application/xml, example=<Order>
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}, {contentType=application/json, example={
</Order>}]
- examples: [{contentType=application/json, example={
"petId" : 6,
"quantity" : 1,
"id" : 0,
"shipDate" : "2000-01-23T04:56:07.000+00:00",
"complete" : false,
"status" : "placed"
}}]
- parameter body: (body) order placed for purchasing the pet
}}, {contentType=application/xml, example=<Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order>}]
- parameter order: (body) order placed for purchasing the pet
- returns: RequestBuilder<Order>
*/
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
let path = "/store/order"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = order.encodeToJSON()
let url = URLComponents(string: URLString)

View File

@ -1,8 +1,8 @@
//
// UserAPI.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -12,11 +12,11 @@ import Alamofire
open class UserAPI: APIBase {
/**
Create user
- parameter body: (body) Created user object
- parameter user: (body) Created user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUser(body: User, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func createUser(user: User, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error)
}
}
@ -26,14 +26,13 @@ open class UserAPI: APIBase {
Create user
- POST /user
- This can only be done by the logged in user.
- parameter body: (body) Created user object
- parameter user: (body) Created user object
- returns: RequestBuilder<Void>
*/
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
let path = "/user"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = user.encodeToJSON()
let url = URLComponents(string: URLString)
@ -44,11 +43,11 @@ open class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object
- parameter user: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error)
}
}
@ -57,15 +56,13 @@ open class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithArray
-
- parameter body: (body) List of user object
- parameter user: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithArray"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = user.encodeToJSON()
let url = URLComponents(string: URLString)
@ -76,11 +73,11 @@ open class UserAPI: APIBase {
/**
Creates list of users with given input array
- parameter body: (body) List of user object
- parameter user: (body) List of user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func createUsersWithListInput(body: [User], completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
open class func createUsersWithListInput(user: [User], completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
completion(error)
}
}
@ -89,15 +86,13 @@ open class UserAPI: APIBase {
/**
Creates list of users with given input array
- POST /user/createWithList
-
- parameter body: (body) List of user object
- parameter user: (body) List of user object
- returns: RequestBuilder<Void>
*/
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
let path = "/user/createWithList"
let URLString = PetstoreClientAPI.basePath + path
let parameters = body.encodeToJSON()
let parameters = user.encodeToJSON()
let url = URLComponents(string: URLString)
@ -122,7 +117,6 @@ open class UserAPI: APIBase {
Delete user
- DELETE /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) The name that needs to be deleted
- returns: RequestBuilder<Void>
*/
@ -156,18 +150,7 @@ open class UserAPI: APIBase {
/**
Get user by user name
- GET /user/{username}
-
- examples: [{contentType=application/xml, example=<User>
<id>123456789</id>
<username>aeiou</username>
<firstName>aeiou</firstName>
<lastName>aeiou</lastName>
<email>aeiou</email>
<password>aeiou</password>
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User>}, {contentType=application/json, example={
- examples: [{contentType=application/json, example={
"firstName" : "firstName",
"lastName" : "lastName",
"password" : "password",
@ -176,8 +159,7 @@ open class UserAPI: APIBase {
"id" : 0,
"email" : "email",
"username" : "username"
}}]
- examples: [{contentType=application/xml, example=<User>
}}, {contentType=application/xml, example=<User>
<id>123456789</id>
<username>aeiou</username>
<firstName>aeiou</firstName>
@ -186,7 +168,8 @@ open class UserAPI: APIBase {
<password>aeiou</password>
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User>}, {contentType=application/json, example={
</User>}]
- examples: [{contentType=application/json, example={
"firstName" : "firstName",
"lastName" : "lastName",
"password" : "password",
@ -195,7 +178,16 @@ open class UserAPI: APIBase {
"id" : 0,
"email" : "email",
"username" : "username"
}}]
}}, {contentType=application/xml, example=<User>
<id>123456789</id>
<username>aeiou</username>
<firstName>aeiou</firstName>
<lastName>aeiou</lastName>
<email>aeiou</email>
<password>aeiou</password>
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User>}]
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
- returns: RequestBuilder<User>
*/
@ -230,12 +222,7 @@ open class UserAPI: APIBase {
/**
Logs user into the system
- GET /user/login
-
- responseHeaders: [X-Rate-Limit(Int32), X-Expires-After(Date)]
- responseHeaders: [X-Rate-Limit(Int32), X-Expires-After(Date)]
- examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example=""}]
- examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example=""}]
- parameter username: (query) The user name for login
- parameter password: (query) The password for login in clear text
- returns: RequestBuilder<String>
@ -247,7 +234,7 @@ open class UserAPI: APIBase {
var url = URLComponents(string: URLString)
url?.queryItems = APIHelper.mapValuesToQueryItems(values:[
"username": username,
"username": username,
"password": password
])
@ -270,8 +257,6 @@ open class UserAPI: APIBase {
/**
Logs out current logged in user session
- GET /user/logout
-
- returns: RequestBuilder<Void>
*/
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
@ -289,11 +274,11 @@ open class UserAPI: APIBase {
/**
Updated user
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object
- parameter user: (body) Updated user object
- parameter completion: completion handler to receive the data and the error objects
*/
open class func updateUser(username: String, body: User, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
open class func updateUser(username: String, user: User, completion: @escaping ((_ error: ErrorResponse?) -> Void)) {
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
completion(error)
}
}
@ -303,18 +288,17 @@ open class UserAPI: APIBase {
Updated user
- PUT /user/{username}
- This can only be done by the logged in user.
- parameter username: (path) name that need to be deleted
- parameter body: (body) Updated user object
- parameter user: (body) Updated user object
- returns: RequestBuilder<Void>
*/
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
var path = "/user/{username}"
let usernamePreEscape = "\(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 = body.encodeToJSON()
let parameters = user.encodeToJSON()
let url = URLComponents(string: URLString)

View File

@ -1,7 +1,7 @@
// AlamofireImplementations.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -296,8 +296,6 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
}
return
} else if "" is T {
// swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release
// https://github.com/swagger-api/swagger-parser/pull/34
completion(Response(response: response.response!, body: ("" as! T)), nil)
return
}

View File

@ -1,7 +1,7 @@
// Configuration.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,7 +1,7 @@
// Extensions.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,7 +1,7 @@
// Models.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
@ -498,6 +498,41 @@ class Decoders {
return .failure(.typeMismatch(expected: "Capitalization", actual: "\(source)"))
}
}
// Decoder for [Cat]
Decoders.addDecoder(clazz: [Cat].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[Cat]> in
return Decoders.decode(clazz: [Cat].self, source: source)
}
// Decoder for Cat
Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Cat> in
if let sourceDictionary = source as? [AnyHashable: Any] {
let _result = instance == nil ? Cat() : instance as! Cat
if decoders["\(Animal.self)"] != nil {
_ = Decoders.decode(clazz: Animal.self, source: source, instance: _result)
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) {
case let .success(value): _result.className = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) {
case let .success(value): _result.color = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["declawed"] as AnyObject?) {
case let .success(value): _result.declawed = value
case let .failure(error): break
}
return .success(_result)
} else {
return .failure(.typeMismatch(expected: "Cat", actual: "\(source)"))
}
}
// Decoder for [Category]
Decoders.addDecoder(clazz: [Category].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[Category]> in
return Decoders.decode(clazz: [Category].self, source: source)
@ -564,6 +599,41 @@ class Decoders {
return .failure(.typeMismatch(expected: "Client", actual: "\(source)"))
}
}
// Decoder for [Dog]
Decoders.addDecoder(clazz: [Dog].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[Dog]> in
return Decoders.decode(clazz: [Dog].self, source: source)
}
// Decoder for Dog
Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Dog> in
if let sourceDictionary = source as? [AnyHashable: Any] {
let _result = instance == nil ? Dog() : instance as! Dog
if decoders["\(Animal.self)"] != nil {
_ = Decoders.decode(clazz: Animal.self, source: source, instance: _result)
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) {
case let .success(value): _result.className = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) {
case let .success(value): _result.color = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["breed"] as AnyObject?) {
case let .success(value): _result.breed = value
case let .failure(error): break
}
return .success(_result)
} else {
return .failure(.typeMismatch(expected: "Dog", actual: "\(source)"))
}
}
// Decoder for [EnumArrays]
Decoders.addDecoder(clazz: [EnumArrays].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[EnumArrays]> in
return Decoders.decode(clazz: [EnumArrays].self, source: source)
@ -695,7 +765,7 @@ class Decoders {
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: Data.self, source: sourceDictionary["binary"] as AnyObject?) {
switch Decoders.decodeOptional(clazz: URL.self, source: sourceDictionary["binary"] as AnyObject?) {
case let .success(value): _result.binary = value
case let .failure(error): break
@ -767,7 +837,7 @@ class Decoders {
let _result = instance == nil ? List() : instance as! List
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["123-list"] as AnyObject?) {
case let .success(value): _result._123List = value
case let .success(value): _result._123list = value
case let .failure(error): break
}
@ -889,7 +959,7 @@ class Decoders {
}
switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["123Number"] as AnyObject?) {
case let .success(value): _result._123Number = value
case let .success(value): _result._123number = value
case let .failure(error): break
}
@ -968,19 +1038,6 @@ class Decoders {
return .failure(.typeMismatch(expected: "Order", actual: "\(source)"))
}
}
// Decoder for [OuterBoolean]
Decoders.addDecoder(clazz: [OuterBoolean].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[OuterBoolean]> in
return Decoders.decode(clazz: [OuterBoolean].self, source: source)
}
// Decoder for OuterBoolean
Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in
if let source = source as? OuterBoolean {
return .success(source)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)"))
}
}
// Decoder for [OuterComposite]
Decoders.addDecoder(clazz: [OuterComposite].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[OuterComposite]> in
return Decoders.decode(clazz: [OuterComposite].self, source: source)
@ -990,19 +1047,19 @@ class Decoders {
Decoders.addDecoder(clazz: OuterComposite.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterComposite> in
if let sourceDictionary = source as? [AnyHashable: Any] {
let _result = instance == nil ? OuterComposite() : instance as! OuterComposite
switch Decoders.decodeOptional(clazz: OuterNumber.self, source: sourceDictionary["my_number"] as AnyObject?) {
switch Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["my_number"] as AnyObject?) {
case let .success(value): _result.myNumber = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: OuterString.self, source: sourceDictionary["my_string"] as AnyObject?) {
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["my_string"] as AnyObject?) {
case let .success(value): _result.myString = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: OuterBoolean.self, source: sourceDictionary["my_boolean"] as AnyObject?) {
switch Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["my_boolean"] as AnyObject?) {
case let .success(value): _result.myBoolean = value
case let .failure(error): break
@ -1023,32 +1080,6 @@ class Decoders {
//TODO: I don't think we need this anymore
return Decoders.decode(clazz: OuterEnum.self, source: source, instance: instance)
}
// Decoder for [OuterNumber]
Decoders.addDecoder(clazz: [OuterNumber].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[OuterNumber]> in
return Decoders.decode(clazz: [OuterNumber].self, source: source)
}
// Decoder for OuterNumber
Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in
if let source = source as? OuterNumber {
return .success(source)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)"))
}
}
// Decoder for [OuterString]
Decoders.addDecoder(clazz: [OuterString].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[OuterString]> in
return Decoders.decode(clazz: [OuterString].self, source: source)
}
// Decoder for OuterString
Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in
if let source = source as? OuterString {
return .success(source)
} else {
return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)"))
}
}
// Decoder for [Pet]
Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[Pet]> in
return Decoders.decode(clazz: [Pet].self, source: source)
@ -1253,76 +1284,6 @@ class Decoders {
return .failure(.typeMismatch(expected: "User", actual: "\(source)"))
}
}
// Decoder for [Cat]
Decoders.addDecoder(clazz: [Cat].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[Cat]> in
return Decoders.decode(clazz: [Cat].self, source: source)
}
// Decoder for Cat
Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Cat> in
if let sourceDictionary = source as? [AnyHashable: Any] {
let _result = instance == nil ? Cat() : instance as! Cat
if decoders["\(Animal.self)"] != nil {
_ = Decoders.decode(clazz: Animal.self, source: source, instance: _result)
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) {
case let .success(value): _result.className = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) {
case let .success(value): _result.color = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["declawed"] as AnyObject?) {
case let .success(value): _result.declawed = value
case let .failure(error): break
}
return .success(_result)
} else {
return .failure(.typeMismatch(expected: "Cat", actual: "\(source)"))
}
}
// Decoder for [Dog]
Decoders.addDecoder(clazz: [Dog].self) { (source: AnyObject, instance: AnyObject?) -> Decoded<[Dog]> in
return Decoders.decode(clazz: [Dog].self, source: source)
}
// Decoder for Dog
Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Dog> in
if let sourceDictionary = source as? [AnyHashable: Any] {
let _result = instance == nil ? Dog() : instance as! Dog
if decoders["\(Animal.self)"] != nil {
_ = Decoders.decode(clazz: Animal.self, source: source, instance: _result)
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["className"] as AnyObject?) {
case let .success(value): _result.className = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) {
case let .success(value): _result.color = value
case let .failure(error): break
}
switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["breed"] as AnyObject?) {
case let .success(value): _result.breed = value
case let .failure(error): break
}
return .success(_result)
} else {
return .failure(.typeMismatch(expected: "Dog", actual: "\(source)"))
}
}
}()
static fileprivate func initialize() {

View File

@ -1,8 +1,8 @@
//
// AdditionalPropertiesClass.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Animal.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// ApiResponse.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// ArrayOfArrayOfNumberOnly.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// ArrayOfNumberOnly.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// ArrayTest.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Capitalization.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Cat.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Category.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// ClassModel.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Client.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// Dog.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// EnumArrays.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// EnumClass.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

View File

@ -1,8 +1,8 @@
//
// EnumTest.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation

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