mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Merge branch 'obj/SupportForByteArray' of https://github.com/mateuszmackowiak/swagger-codegen into mateuszmackowiak-obj/SupportForByteArray
This commit is contained in:
commit
f28e2f2a1b
@ -28,6 +28,9 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String AUTHOR_EMAIL = "authorEmail";
|
||||
public static final String GIT_REPO_URL = "gitRepoURL";
|
||||
public static final String LICENSE = "license";
|
||||
|
||||
public static final String BinaryDataType = "ObjcClientCodegenBinaryData";
|
||||
|
||||
protected Set<String> foundationClasses = new HashSet<String>();
|
||||
protected String podName = "SwaggerClient";
|
||||
protected String podVersion = "1.0.0";
|
||||
@ -66,6 +69,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
defaultIncludes.add("NSMutableArray");
|
||||
defaultIncludes.add("NSMutableDictionary");
|
||||
|
||||
defaultIncludes.add(BinaryDataType);
|
||||
|
||||
languageSpecificPrimitives.clear();
|
||||
languageSpecificPrimitives.add("NSNumber");
|
||||
languageSpecificPrimitives.add("NSString");
|
||||
@ -92,10 +97,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("List", "NSArray");
|
||||
typeMapping.put("object", "NSObject");
|
||||
typeMapping.put("file", "NSURL");
|
||||
//TODO binary should be mapped to byte array
|
||||
// mapped to String as a workaround
|
||||
typeMapping.put("binary", "NSString");
|
||||
typeMapping.put("ByteArray", "NSString");
|
||||
typeMapping.put("binary", BinaryDataType);
|
||||
typeMapping.put("ByteArray", BinaryDataType);
|
||||
|
||||
// ref: http://www.tutorialspoint.com/objective_c/objective_c_basic_syntax.htm
|
||||
setReservedWordsLowerCase(
|
||||
@ -280,11 +283,13 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
String innerType = getSwaggerType(inner);
|
||||
|
||||
String innerTypeDeclaration = getTypeDeclaration(inner);
|
||||
|
||||
if (innerTypeDeclaration.endsWith("*")) {
|
||||
innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1);
|
||||
}
|
||||
|
||||
if(innerTypeDeclaration.equalsIgnoreCase(BinaryDataType)) {
|
||||
return "NSData*";
|
||||
}
|
||||
// In this codition, type of property p is array of primitive,
|
||||
// return container type with pointer, e.g. `NSArray* /* NSString */'
|
||||
if (languageSpecificPrimitives.contains(innerType)) {
|
||||
|
@ -33,7 +33,7 @@ NSInteger const {{classPrefix}}UnknownResponseObjectErrorCode = 143528;
|
||||
formatter.numberStyle = NSNumberFormatterDecimalStyle;
|
||||
_numberFormatter = formatter;
|
||||
_primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"];
|
||||
_basicReturnTypes = @[@"NSObject", @"id"];
|
||||
_basicReturnTypes = @[@"NSObject", @"id", @"NSData"];
|
||||
_arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>"
|
||||
options:NSRegularExpressionCaseInsensitive
|
||||
error:nil];
|
||||
|
@ -6,7 +6,7 @@ This ObjC package is automatically generated by the [Swagger Codegen](https://gi
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version:
|
||||
- Build date: 2016-05-06T12:20:47.112+02:00
|
||||
- Build date: 2016-05-08T12:06:01.121+02:00
|
||||
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
@ -33,7 +33,7 @@ NSInteger const SWGUnknownResponseObjectErrorCode = 143528;
|
||||
formatter.numberStyle = NSNumberFormatterDecimalStyle;
|
||||
_numberFormatter = formatter;
|
||||
_primitiveTypes = @[@"NSString", @"NSDate", @"NSNumber"];
|
||||
_basicReturnTypes = @[@"NSObject", @"id"];
|
||||
_basicReturnTypes = @[@"NSObject", @"id", @"NSData"];
|
||||
_arrayOfModelsPatExpression = [NSRegularExpression regularExpressionWithPattern:@"NSArray<(.+)>"
|
||||
options:NSRegularExpressionCaseInsensitive
|
||||
error:nil];
|
||||
|
Loading…
x
Reference in New Issue
Block a user