add test case to python, better resered word handling for objc

This commit is contained in:
wing328 2016-02-25 20:09:58 +08:00
parent a351724365
commit 2d4ccbfd79
18 changed files with 377 additions and 198 deletions

View File

@ -249,12 +249,12 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
if (typeMapping.containsKey(swaggerType)) { if (typeMapping.containsKey(swaggerType)) {
type = typeMapping.get(swaggerType); type = typeMapping.get(swaggerType);
if (languageSpecificPrimitives.contains(type) && !foundationClasses.contains(type)) { if (languageSpecificPrimitives.contains(type) && !foundationClasses.contains(type)) {
return toModelName(type); return toModelNameWithoutReservedWordCheck(type);
} }
} else { } else {
type = swaggerType; type = swaggerType;
} }
return toModelName(type); return toModelNameWithoutReservedWordCheck(type);
} }
@Override @Override
@ -314,6 +314,23 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String toModelName(String type) { public String toModelName(String type) {
// model name cannot use reserved keyword
if (reservedWords.contains(type)) {
LOGGER.warn(type+ " (reserved word) cannot be used as model name. Renamed to " + ("object_" + type) + " before further processing");
type = "object_" + type; // e.g. return => ObjectReturn (after camelize)
}
return toModelNameWithoutReservedWordCheck(type);
}
/*
* Convert input to proper model name according to ObjC style guide
* without checking for reserved words
*
* @param type Model anme
* @return model Name in ObjC style guide
*/
public String toModelNameWithoutReservedWordCheck(String type) {
type = type.replaceAll("[^0-9a-zA-Z_]", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. type = type.replaceAll("[^0-9a-zA-Z_]", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
// language build-in classes // language build-in classes
@ -425,7 +442,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
// method name cannot use reserved keyword, e.g. return // method name cannot use reserved keyword, e.g. return
if (reservedWords.contains(operationId)) { if (reservedWords.contains(operationId)) {
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name"); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
operationId = "call_" + operationId;
} }
return camelize(sanitizeName(operationId), true); return camelize(sanitizeName(operationId), true);

View File

@ -219,7 +219,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
// model name cannot use reserved keyword, e.g. return // model name cannot use reserved keyword, e.g. return
if (reservedWords.contains(name)) { if (reservedWords.contains(name)) {
throw new RuntimeException(name + " (reserved word) cannot be used as a model name"); LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("object_" + name));
name = "object_" + name; // e.g. return => ObjectReturn (after camelize)
} }
// camelize the model name // camelize the model name
@ -231,7 +232,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public String toModelFilename(String name) { public String toModelFilename(String name) {
// model name cannot use reserved keyword, e.g. return // model name cannot use reserved keyword, e.g. return
if (reservedWords.contains(name)) { if (reservedWords.contains(name)) {
throw new RuntimeException(name + " (reserved word) cannot be used as a model name"); LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + underscore(dropDots("object_" + name)));
name = "object_" + name; // e.g. return => ObjectReturn (after camelize)
} }
// underscore the model file name // underscore the model file name
@ -267,14 +269,15 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
@Override @Override
public String toOperationId(String operationId) { public String toOperationId(String operationId) {
// throw exception if method name is empty // throw exception if method name is empty (should not occur as an auto-generated method name will be used)
if (StringUtils.isEmpty(operationId)) { if (StringUtils.isEmpty(operationId)) {
throw new RuntimeException("Empty method name (operationId) not allowed"); throw new RuntimeException("Empty method name (operationId) not allowed");
} }
// method name cannot use reserved keyword, e.g. return // method name cannot use reserved keyword, e.g. return
if (reservedWords.contains(operationId)) { if (reservedWords.contains(operationId)) {
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name"); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId)));
operationId = "call_" + operationId;
} }
return underscore(sanitizeName(operationId)); return underscore(sanitizeName(operationId));

View File

@ -2,14 +2,28 @@ package io.swagger.codegen.python;
import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenModel;
import io.swagger.codegen.CodegenOperation; import io.swagger.codegen.CodegenOperation;
import io.swagger.codegen.CodegenProperty;
import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.DefaultCodegen;
import io.swagger.codegen.languages.PythonClientCodegen; import io.swagger.codegen.languages.PythonClientCodegen;
import io.swagger.models.ArrayModel;
import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.Operation; import io.swagger.models.Operation;
import io.swagger.models.Swagger; import io.swagger.models.Swagger;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.DateTimeProperty;
import io.swagger.models.properties.LongProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import io.swagger.parser.SwaggerParser; import io.swagger.parser.SwaggerParser;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.testng.annotations.ITestAnnotation;
import com.google.common.collect.Sets;
import java.util.Map;
@SuppressWarnings("static-method") @SuppressWarnings("static-method")
public class PythonTest { public class PythonTest {
@ -35,4 +49,232 @@ public class PythonTest {
Assert.assertEquals(codegenOperation.returnType, "V1beta3Binding"); Assert.assertEquals(codegenOperation.returnType, "V1beta3Binding");
Assert.assertEquals(codegenOperation.returnBaseType, "V1beta3Binding"); Assert.assertEquals(codegenOperation.returnBaseType, "V1beta3Binding");
} }
@Test(description = "convert a simple java model")
public void simpleModelTest() {
final Model model = new ModelImpl()
.description("a sample model")
.property("id", new LongProperty())
.property("name", new StringProperty())
.property("createdAt", new DateTimeProperty())
.required("id")
.required("name");
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 3);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "id");
Assert.assertEquals(property1.datatype, "int");
Assert.assertEquals(property1.name, "id");
Assert.assertNull(property1.defaultValue);
Assert.assertEquals(property1.baseType, "int");
Assert.assertTrue(property1.hasMore);
Assert.assertTrue(property1.required);
Assert.assertTrue(property1.isPrimitiveType);
Assert.assertTrue(property1.isNotContainer);
final CodegenProperty property2 = cm.vars.get(1);
Assert.assertEquals(property2.baseName, "name");
Assert.assertEquals(property2.datatype, "str");
Assert.assertEquals(property2.name, "name");
Assert.assertNull(property2.defaultValue);
Assert.assertEquals(property2.baseType, "str");
Assert.assertTrue(property2.hasMore);
Assert.assertTrue(property2.required);
Assert.assertTrue(property2.isPrimitiveType);
Assert.assertTrue(property2.isNotContainer);
final CodegenProperty property3 = cm.vars.get(2);
Assert.assertEquals(property3.baseName, "createdAt");
Assert.assertEquals(property3.datatype, "datetime");
Assert.assertEquals(property3.name, "created_at");
Assert.assertNull(property3.defaultValue);
Assert.assertEquals(property3.baseType, "datetime");
Assert.assertNull(property3.hasMore);
Assert.assertNull(property3.required);
Assert.assertTrue(property3.isNotContainer);
}
@Test(description = "convert a model with list property")
public void listPropertyTest() {
final Model model = new ModelImpl()
.description("a sample model")
.property("id", new LongProperty())
.property("urls", new ArrayProperty()
.items(new StringProperty()))
.required("id");
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 2);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "id");
Assert.assertEquals(property1.datatype, "int");
Assert.assertEquals(property1.name, "id");
Assert.assertNull(property1.defaultValue);
Assert.assertEquals(property1.baseType, "int");
Assert.assertTrue(property1.hasMore);
Assert.assertTrue(property1.required);
Assert.assertTrue(property1.isPrimitiveType);
Assert.assertTrue(property1.isNotContainer);
final CodegenProperty property2 = cm.vars.get(1);
Assert.assertEquals(property2.baseName, "urls");
Assert.assertEquals(property2.datatype, "list[str]");
Assert.assertEquals(property2.name, "urls");
Assert.assertNull(property2.defaultValue);
Assert.assertEquals(property2.baseType, "list");
Assert.assertNull(property2.hasMore);
Assert.assertEquals(property2.containerType, "array");
Assert.assertNull(property2.required);
Assert.assertTrue(property2.isPrimitiveType);
Assert.assertTrue(property2.isContainer);
}
@Test(description = "convert a model with a map property")
public void mapPropertyTest() {
final Model model = new ModelImpl()
.description("a sample model")
.property("translations", new MapProperty()
.additionalProperties(new StringProperty()))
.required("id");
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "translations");
Assert.assertEquals(property1.datatype, "dict(str, str)");
Assert.assertEquals(property1.name, "translations");
Assert.assertEquals(property1.baseType, "dict");
Assert.assertEquals(property1.containerType, "map");
Assert.assertNull(property1.required);
Assert.assertTrue(property1.isContainer);
Assert.assertTrue(property1.isPrimitiveType);
}
@Test(description = "convert a model with complex property")
public void complexPropertyTest() {
final Model model = new ModelImpl()
.description("a sample model")
.property("children", new RefProperty("#/definitions/Children"));
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.datatype, "Children");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "Children");
Assert.assertNull(property1.required);
Assert.assertTrue(property1.isNotContainer);
}
@Test(description = "convert a model with complex list property")
public void complexListPropertyTest() {
final Model model = new ModelImpl()
.description("a sample model")
.property("children", new ArrayProperty()
.items(new RefProperty("#/definitions/Children")));
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.complexType, "Children");
Assert.assertEquals(property1.datatype, "list[Children]");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "list");
Assert.assertEquals(property1.containerType, "array");
Assert.assertNull(property1.required);
Assert.assertTrue(property1.isContainer);
}
@Test(description = "convert a model with complex map property")
public void complexMapPropertyTest() {
final Model model = new ModelImpl()
.description("a sample model")
.property("children", new MapProperty()
.additionalProperties(new RefProperty("#/definitions/Children")));
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.complexType, "Children");
Assert.assertEquals(property1.datatype, "dict(str, Children)");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.baseType, "dict");
Assert.assertEquals(property1.containerType, "map");
Assert.assertNull(property1.required);
Assert.assertTrue(property1.isContainer);
Assert.assertNull(property1.isNotContainer);
}
// should not start with 'null'. need help from the community to investigate further
@Test(enabled = false, description = "convert an array model")
public void arrayModelTest() {
final Model model = new ArrayModel()
.description("an array model")
.items(new RefProperty("#/definitions/Children"));
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "an array model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "null<Children>");
Assert.assertEquals(cm.imports.size(), 1);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
}
// should not start with 'null'. need help from the community to investigate further
@Test(enabled = false, description = "convert an map model")
public void mapModelTest() {
final Model model = new ModelImpl()
.description("a map model")
.additionalProperties(new RefProperty("#/definitions/Children"));
final DefaultCodegen codegen = new PythonClientCodegen();
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a map model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "null<String, Children>");
Assert.assertEquals(cm.imports.size(), 2); // TODO: need to verify
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
}
} }

View File

@ -156,15 +156,15 @@ namespace IO.Swagger.Test
} }
/// <summary> /// <summary>
/// Test GetPetByIdWithByteArray /// Test PetPetIdtestingByteArraytrueGet
/// </summary> /// </summary>
[Test] [Test]
public void GetPetByIdWithByteArrayTest() public void PetPetIdtestingByteArraytrueGetTest()
{ {
// TODO: add unit test for the method 'GetPetByIdWithByteArray' // TODO: add unit test for the method 'PetPetIdtestingByteArraytrueGet'
long? petId = null; // TODO: replace null with proper value long? petId = null; // TODO: replace null with proper value
var response = instance.GetPetByIdWithByteArray(petId); var response = instance.PetPetIdtestingByteArraytrueGet(petId);
Assert.IsInstanceOf<byte[]> (response, "response is byte[]"); Assert.IsInstanceOf<byte[]> (response, "response is byte[]");
} }

View File

@ -212,7 +212,7 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>byte[]</returns> /// <returns>byte[]</returns>
byte[] GetPetByIdWithByteArray (long? petId); byte[] PetPetIdtestingByteArraytrueGet (long? petId);
/// <summary> /// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39; /// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
@ -223,7 +223,7 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of byte[]</returns> /// <returns>ApiResponse of byte[]</returns>
ApiResponse<byte[]> GetPetByIdWithByteArrayWithHttpInfo (long? petId); ApiResponse<byte[]> PetPetIdtestingByteArraytrueGetWithHttpInfo (long? petId);
/// <summary> /// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store /// Fake endpoint to test byte array in body parameter for adding a new pet to the store
@ -446,7 +446,7 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of byte[]</returns> /// <returns>Task of byte[]</returns>
System.Threading.Tasks.Task<byte[]> GetPetByIdWithByteArrayAsync (long? petId); System.Threading.Tasks.Task<byte[]> PetPetIdtestingByteArraytrueGetAsync (long? petId);
/// <summary> /// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39; /// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
@ -457,7 +457,7 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of ApiResponse (byte[])</returns> /// <returns>Task of ApiResponse (byte[])</returns>
System.Threading.Tasks.Task<ApiResponse<byte[]>> GetPetByIdWithByteArrayAsyncWithHttpInfo (long? petId); System.Threading.Tasks.Task<ApiResponse<byte[]>> PetPetIdtestingByteArraytrueGetAsyncWithHttpInfo (long? petId);
/// <summary> /// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store /// Fake endpoint to test byte array in body parameter for adding a new pet to the store
@ -1972,9 +1972,9 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>byte[]</returns> /// <returns>byte[]</returns>
public byte[] GetPetByIdWithByteArray (long? petId) public byte[] PetPetIdtestingByteArraytrueGet (long? petId)
{ {
ApiResponse<byte[]> response = GetPetByIdWithByteArrayWithHttpInfo(petId); ApiResponse<byte[]> response = PetPetIdtestingByteArraytrueGetWithHttpInfo(petId);
return response.Data; return response.Data;
} }
@ -1984,12 +1984,12 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of byte[]</returns> /// <returns>ApiResponse of byte[]</returns>
public ApiResponse< byte[] > GetPetByIdWithByteArrayWithHttpInfo (long? petId) public ApiResponse< byte[] > PetPetIdtestingByteArraytrueGetWithHttpInfo (long? petId)
{ {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) if (petId == null)
throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetByIdWithByteArray"); throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->PetPetIdtestingByteArraytrueGet");
var path_ = "/pet/{petId}?testing_byte_array=true"; var path_ = "/pet/{petId}?testing_byte_array=true";
@ -2048,9 +2048,9 @@ namespace IO.Swagger.Api
int statusCode = (int) response.StatusCode; int statusCode = (int) response.StatusCode;
if (statusCode >= 400) if (statusCode >= 400)
throw new ApiException (statusCode, "Error calling GetPetByIdWithByteArray: " + response.Content, response.Content); throw new ApiException (statusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + response.Content, response.Content);
else if (statusCode == 0) else if (statusCode == 0)
throw new ApiException (statusCode, "Error calling GetPetByIdWithByteArray: " + response.ErrorMessage, response.ErrorMessage); throw new ApiException (statusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + response.ErrorMessage, response.ErrorMessage);
return new ApiResponse<byte[]>(statusCode, return new ApiResponse<byte[]>(statusCode,
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
@ -2065,9 +2065,9 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of byte[]</returns> /// <returns>Task of byte[]</returns>
public async System.Threading.Tasks.Task<byte[]> GetPetByIdWithByteArrayAsync (long? petId) public async System.Threading.Tasks.Task<byte[]> PetPetIdtestingByteArraytrueGetAsync (long? petId)
{ {
ApiResponse<byte[]> response = await GetPetByIdWithByteArrayAsyncWithHttpInfo(petId); ApiResponse<byte[]> response = await PetPetIdtestingByteArraytrueGetAsyncWithHttpInfo(petId);
return response.Data; return response.Data;
} }
@ -2078,10 +2078,10 @@ namespace IO.Swagger.Api
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception> /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param> /// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of ApiResponse (byte[])</returns> /// <returns>Task of ApiResponse (byte[])</returns>
public async System.Threading.Tasks.Task<ApiResponse<byte[]>> GetPetByIdWithByteArrayAsyncWithHttpInfo (long? petId) public async System.Threading.Tasks.Task<ApiResponse<byte[]>> PetPetIdtestingByteArraytrueGetAsyncWithHttpInfo (long? petId)
{ {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetByIdWithByteArray"); if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling PetPetIdtestingByteArraytrueGet");
var path_ = "/pet/{petId}?testing_byte_array=true"; var path_ = "/pet/{petId}?testing_byte_array=true";
@ -2142,9 +2142,9 @@ namespace IO.Swagger.Api
int statusCode = (int) response.StatusCode; int statusCode = (int) response.StatusCode;
if (statusCode >= 400) if (statusCode >= 400)
throw new ApiException (statusCode, "Error calling GetPetByIdWithByteArray: " + response.Content, response.Content); throw new ApiException (statusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + response.Content, response.Content);
else if (statusCode == 0) else if (statusCode == 0)
throw new ApiException (statusCode, "Error calling GetPetByIdWithByteArray: " + response.ErrorMessage, response.ErrorMessage); throw new ApiException (statusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + response.ErrorMessage, response.ErrorMessage);
return new ApiResponse<byte[]>(statusCode, return new ApiResponse<byte[]>(statusCode,
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),

View File

@ -136,7 +136,8 @@ static void (^reachabilityChangeBlock)(int);
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]]; NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
for (NSString *string in accepts) { for (NSString *string in accepts) {
NSString * lowerAccept = [string lowercaseString]; NSString * lowerAccept = [string lowercaseString];
if ([lowerAccept containsString:@"application/json"]) { // use rangeOfString instead of containsString for iOS 7 support
if ([lowerAccept rangeOfString:@"application/json"].location != NSNotFound) {
return @"application/json"; return @"application/json";
} }
[lowerAccepts addObject:lowerAccept]; [lowerAccepts addObject:lowerAccept];

View File

@ -107,6 +107,13 @@
- (NSDictionary *) authSettings { - (NSDictionary *) authSettings {
return @{ return @{
@"test_api_key_header":
@{
@"type": @"api_key",
@"in": @"header",
@"key": @"test_api_key_header",
@"value": [self getApiKeyWithPrefix:@"test_api_key_header"]
},
@"api_key": @"api_key":
@{ @{
@"type": @"api_key", @"type": @"api_key",
@ -114,6 +121,27 @@
@"key": @"api_key", @"key": @"api_key",
@"value": [self getApiKeyWithPrefix:@"api_key"] @"value": [self getApiKeyWithPrefix:@"api_key"]
}, },
@"test_api_client_secret":
@{
@"type": @"api_key",
@"in": @"header",
@"key": @"x-test_api_client_secret",
@"value": [self getApiKeyWithPrefix:@"x-test_api_client_secret"]
},
@"test_api_client_id":
@{
@"type": @"api_key",
@"in": @"header",
@"key": @"x-test_api_client_id",
@"value": [self getApiKeyWithPrefix:@"x-test_api_client_id"]
},
@"test_api_key_query":
@{
@"type": @"api_key",
@"in": @"query",
@"key": @"test_api_key_query",
@"value": [self getApiKeyWithPrefix:@"test_api_key_query"]
},
}; };
} }

View File

@ -142,7 +142,7 @@
/// ///
/// ///
/// @return NSString* /// @return NSString*
-(NSNumber*) getPetByIdWithByteArrayWithPetId: (NSNumber*) petId -(NSNumber*) petPetIdtestingByteArraytrueGetWithPetId: (NSNumber*) petId
completionHandler: (void (^)(NSString* output, NSError* error)) handler; completionHandler: (void (^)(NSString* output, NSError* error)) handler;

View File

@ -436,7 +436,7 @@ static SWGPetApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"api_key"]; NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
@ -760,13 +760,13 @@ static SWGPetApi* singletonAPI = nil;
/// ///
/// @returns NSString* /// @returns NSString*
/// ///
-(NSNumber*) getPetByIdWithByteArrayWithPetId: (NSNumber*) petId -(NSNumber*) petPetIdtestingByteArraytrueGetWithPetId: (NSNumber*) petId
completionHandler: (void (^)(NSString* output, NSError* error)) handler { completionHandler: (void (^)(NSString* output, NSError* error)) handler {
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == nil) { if (petId == nil) {
[NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `getPetByIdWithByteArray`"]; [NSException raise:@"Invalid parameter" format:@"Missing the required parameter `petId` when calling `petPetIdtestingByteArraytrueGet`"];
} }
@ -808,7 +808,7 @@ static SWGPetApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[@"api_key"]; NSArray *authSettings = @[@"api_key", @"petstore_auth"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

View File

@ -189,7 +189,7 @@ static SWGStoreApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[]; NSArray *authSettings = @[@"test_api_client_id", @"test_api_client_secret"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];
@ -272,7 +272,7 @@ static SWGStoreApi* singletonAPI = nil;
NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]]; NSString *requestContentType = [SWGApiClient selectHeaderContentType:@[]];
// Authentication setting // Authentication setting
NSArray *authSettings = @[]; NSArray *authSettings = @[@"test_api_key_header", @"test_api_key_query"];
id bodyParam = nil; id bodyParam = nil;
NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *formParams = [[NSMutableDictionary alloc] init];

File diff suppressed because one or more lines are too long

View File

@ -1,151 +1,3 @@
Collecting nose (from -r dev-requirements.txt (line 1))
Using cached nose-1.3.7-py2-none-any.whl
Collecting tox (from -r dev-requirements.txt (line 2))
Using cached tox-2.1.1-py2.py3-none-any.whl
Collecting coverage (from -r dev-requirements.txt (line 3))
Collecting randomize (from -r dev-requirements.txt (line 4))
Using cached randomize-0.13-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2))
Using cached virtualenv-13.1.2-py2.py3-none-any.whl
Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2))
Using cached py-1.4.30-py2.py3-none-any.whl
Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2))
Using cached pluggy-0.3.0-py2.py3-none-any.whl
Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize
Successfully installed coverage-3.7.1 nose-1.3.7 pluggy-0.3.0 py-1.4.30 randomize-0.13 tox-2.1.1 virtualenv-13.1.2
Requirement already satisfied (use --upgrade to upgrade): nose in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./.venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Collecting nose (from -r dev-requirements.txt (line 1))
Using cached nose-1.3.7-py2-none-any.whl
Collecting tox (from -r dev-requirements.txt (line 2))
Using cached tox-2.2.1-py2.py3-none-any.whl
Collecting coverage (from -r dev-requirements.txt (line 3))
Downloading coverage-4.0.3.tar.gz (354kB)
Collecting randomize (from -r dev-requirements.txt (line 4))
Using cached randomize-0.13-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /Library/Python/2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2))
Downloading py-1.4.31-py2.py3-none-any.whl (81kB)
Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2))
Using cached pluggy-0.3.1-py2.py3-none-any.whl
Installing collected packages: nose, py, pluggy, tox, coverage, randomize
Collecting nose (from -r dev-requirements.txt (line 1))
Using cached nose-1.3.7-py2-none-any.whl
Collecting tox (from -r dev-requirements.txt (line 2))
Using cached tox-2.2.1-py2.py3-none-any.whl
Collecting coverage (from -r dev-requirements.txt (line 3))
Using cached coverage-4.0.3.tar.gz
Collecting randomize (from -r dev-requirements.txt (line 4))
Using cached randomize-0.13-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /Library/Python/2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2))
Using cached py-1.4.31-py2.py3-none-any.whl
Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2))
Using cached pluggy-0.3.1-py2.py3-none-any.whl
Installing collected packages: nose, py, pluggy, tox, coverage, randomize
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Collecting nose (from -r dev-requirements.txt (line 1)) Collecting nose (from -r dev-requirements.txt (line 1))
Using cached nose-1.3.7-py2-none-any.whl Using cached nose-1.3.7-py2-none-any.whl
Collecting tox (from -r dev-requirements.txt (line 2)) Collecting tox (from -r dev-requirements.txt (line 2))
@ -154,10 +6,17 @@ Collecting coverage (from -r dev-requirements.txt (line 3))
Collecting randomize (from -r dev-requirements.txt (line 4)) Collecting randomize (from -r dev-requirements.txt (line 4))
Using cached randomize-0.13-py2.py3-none-any.whl Using cached randomize-0.13-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2)) Collecting virtualenv>=1.11.2 (from tox->-r dev-requirements.txt (line 2))
Using cached virtualenv-13.1.2-py2.py3-none-any.whl Downloading virtualenv-14.0.6-py2.py3-none-any.whl (1.8MB)
Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2)) Collecting py>=1.4.17 (from tox->-r dev-requirements.txt (line 2))
Using cached py-1.4.31-py2.py3-none-any.whl Using cached py-1.4.31-py2.py3-none-any.whl
Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2)) Collecting pluggy<0.4.0,>=0.3.0 (from tox->-r dev-requirements.txt (line 2))
Using cached pluggy-0.3.1-py2.py3-none-any.whl Using cached pluggy-0.3.1-py2.py3-none-any.whl
Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize Installing collected packages: nose, virtualenv, py, pluggy, tox, coverage, randomize
Successfully installed coverage-4.0.3 nose-1.3.7 pluggy-0.3.1 py-1.4.31 randomize-0.13 tox-2.3.1 virtualenv-13.1.2 Successfully installed coverage-4.0.3 nose-1.3.7 pluggy-0.3.1 py-1.4.31 randomize-0.13 tox-2.3.1 virtualenv-14.0.6
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))

View File

@ -9,8 +9,8 @@ from .models.order import Order
# import apis into sdk package # import apis into sdk package
from .apis.user_api import UserApi from .apis.user_api import UserApi
from .apis.store_api import StoreApi
from .apis.pet_api import PetApi from .apis.pet_api import PetApi
from .apis.store_api import StoreApi
# import ApiClient # import ApiClient
from .api_client import ApiClient from .api_client import ApiClient

View File

@ -395,8 +395,8 @@ class ApiClient(object):
for k, v in iteritems(files): for k, v in iteritems(files):
if not v: if not v:
continue continue
all_files = v if type(v) is list else [v] file_names = v if type(v) is list else [v]
for n in all_files: for n in file_names:
with open(n, 'rb') as f: with open(n, 'rb') as f:
filename = os.path.basename(f.name) filename = os.path.basename(f.name)
filedata = f.read() filedata = f.read()

View File

@ -2,5 +2,5 @@ from __future__ import absolute_import
# import apis into api package # import apis into api package
from .user_api import UserApi from .user_api import UserApi
from .store_api import StoreApi
from .pet_api import PetApi from .pet_api import PetApi
from .store_api import StoreApi

View File

@ -414,7 +414,7 @@ class PetApi(object):
select_header_content_type([]) select_header_content_type([])
# Authentication setting # Authentication setting
auth_settings = ['api_key'] auth_settings = ['api_key', 'petstore_auth']
response = self.api_client.call_api(resource_path, method, response = self.api_client.call_api(resource_path, method,
path_params, path_params,
@ -680,7 +680,7 @@ class PetApi(object):
callback=params.get('callback')) callback=params.get('callback'))
return response return response
def get_pet_by_id_with_byte_array(self, pet_id, **kwargs): def pet_pet_idtesting_byte_arraytrue_get(self, pet_id, **kwargs):
""" """
Fake endpoint to test byte array return by 'Find pet by ID' Fake endpoint to test byte array return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
@ -691,7 +691,7 @@ class PetApi(object):
>>> def callback_function(response): >>> def callback_function(response):
>>> pprint(response) >>> pprint(response)
>>> >>>
>>> thread = api.get_pet_by_id_with_byte_array(pet_id, callback=callback_function) >>> thread = api.pet_pet_idtesting_byte_arraytrue_get(pet_id, callback=callback_function)
:param callback function: The callback function :param callback function: The callback function
for asynchronous request. (optional) for asynchronous request. (optional)
@ -709,14 +709,14 @@ class PetApi(object):
if key not in all_params: if key not in all_params:
raise TypeError( raise TypeError(
"Got an unexpected keyword argument '%s'" "Got an unexpected keyword argument '%s'"
" to method get_pet_by_id_with_byte_array" % key " to method pet_pet_idtesting_byte_arraytrue_get" % key
) )
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'pet_id' is set # verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None): if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id_with_byte_array`") raise ValueError("Missing the required parameter `pet_id` when calling `pet_pet_idtesting_byte_arraytrue_get`")
resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json') resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -745,7 +745,7 @@ class PetApi(object):
select_header_content_type([]) select_header_content_type([])
# Authentication setting # Authentication setting
auth_settings = ['api_key'] auth_settings = ['api_key', 'petstore_auth']
response = self.api_client.call_api(resource_path, method, response = self.api_client.call_api(resource_path, method,
path_params, path_params,

View File

@ -180,7 +180,7 @@ class StoreApi(object):
select_header_content_type([]) select_header_content_type([])
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = ['test_api_client_id', 'test_api_client_secret']
response = self.api_client.call_api(resource_path, method, response = self.api_client.call_api(resource_path, method,
path_params, path_params,
@ -259,7 +259,7 @@ class StoreApi(object):
select_header_content_type([]) select_header_content_type([])
# Authentication setting # Authentication setting
auth_settings = [] auth_settings = ['test_api_key_header', 'test_api_key_query']
response = self.api_client.call_api(resource_path, method, response = self.api_client.call_api(resource_path, method,
path_params, path_params,

View File

@ -217,6 +217,13 @@ class Configuration(object):
:return: The Auth Settings information dict. :return: The Auth Settings information dict.
""" """
return { return {
'test_api_key_header':
{
'type': 'api_key',
'in': 'header',
'key': 'test_api_key_header',
'value': self.get_api_key_with_prefix('test_api_key_header')
},
'api_key': 'api_key':
{ {
'type': 'api_key', 'type': 'api_key',
@ -224,6 +231,27 @@ class Configuration(object):
'key': 'api_key', 'key': 'api_key',
'value': self.get_api_key_with_prefix('api_key') 'value': self.get_api_key_with_prefix('api_key')
}, },
'test_api_client_secret':
{
'type': 'api_key',
'in': 'header',
'key': 'x-test_api_client_secret',
'value': self.get_api_key_with_prefix('x-test_api_client_secret')
},
'test_api_client_id':
{
'type': 'api_key',
'in': 'header',
'key': 'x-test_api_client_id',
'value': self.get_api_key_with_prefix('x-test_api_client_id')
},
'test_api_key_query':
{
'type': 'api_key',
'in': 'query',
'key': 'test_api_key_query',
'value': self.get_api_key_with_prefix('test_api_key_query')
},
} }