swagger-api/swagger-codegen

[OBJC] type object is not cast correctly

Open

#4.866 geöffnet am 28. Feb. 2017

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)HTML (5.474 Forks)batch import
Client: ObjcIssue: Bughelp wanted

Repository-Metriken

Stars
 (12.701 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Description

Type "object" in swagger.json is cast as NSObject which produces a bug

Swagger-codegen version

2.2.2-SNAPSHOT

Swagger declaration file content or url
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate 
-i http://127.0.0.1:9000/swagger.json 
-l objc 
-o samples/client/CLIENT 
-c config.json
Steps to reproduce

JSONModel crash after HTTP request is sent

Related issues
Suggest a Fix

Restlet studio manages this type correctly with the Class ASKFields:

ASKFields.h

#import "ASKRepresentation.h"
@interface ASKFields : ASKRepresentation
+ (instancetype)representation;
@end

ASKFields.m

#import "ASKFields.h"
@implementation ASKFields
+ (instancetype)representation {
    return [[self alloc] init];
}

- (NSString *)description {
    NSMutableString *result = [NSMutableString string];
    return result;
}

#pragma mark - Dictionary Representation
- (NSDictionary *)toDictionary {
    return @{
            };
}
+ (instancetype)fromDictionary:(NSDictionary *)aDictionary {
    if (aDictionary == nil) {
        return nil;
    }
    ASKFields *result = [self representation];
    return result;
}
@end

Contributor Guide