diff --git a/bin/android-java-petstore.sh b/bin/android-java-petstore.sh
index edde6205216..312953e7d81 100755
--- a/bin/android-java-petstore.sh
+++ b/bin/android-java-petstore.sh
@@ -18,15 +18,10 @@ if [ ! -d "${APP_DIR}" ]; then
fi
cd $APP_DIR
-SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
+ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l android -o samples/client/petstore/android-java"
-if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar ]; then
- scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/*assembly*.jar $ags
-else
- echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
-fi
+java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags
diff --git a/bin/java-petstore-filemap.sh b/bin/java-petstore-filemap.sh
index bedec4ab2c7..fbe0f86c210 100755
--- a/bin/java-petstore-filemap.sh
+++ b/bin/java-petstore-filemap.sh
@@ -21,6 +21,6 @@ cd $APP_DIR
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l java"
+ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l java -o samples/client/petstore/java"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags
diff --git a/bin/java-petstore.sh b/bin/java-petstore.sh
index e895b18ee94..69c1faf9e6e 100755
--- a/bin/java-petstore.sh
+++ b/bin/java-petstore.sh
@@ -22,6 +22,6 @@ cd $APP_DIR
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l java"
+ags="$@ com.wordnik.swagger.codegen.Codegen -i http://petstore.swagger.wordnik.com/v2/swagger.json -l java -o samples/client/petstore/java"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags
diff --git a/bin/objc-petstore.sh b/bin/objc-petstore.sh
index 683b1a8371d..164eb72f11e 100755
--- a/bin/objc-petstore.sh
+++ b/bin/objc-petstore.sh
@@ -21,6 +21,6 @@ cd $APP_DIR
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l objc"
+ags="$@ com.wordnik.swagger.codegen.Codegen -i src/test/resources/petstore.json -l objc -o samples/client/petstore/objc"
java -cp $APP_DIR/target/*:$APP_DIR/target/lib/* $ags
diff --git a/samples/client/petstore/android-java/pom.xml b/samples/client/petstore/android-java/pom.xml
index 8415a2b66cf..2e7f6d8c612 100644
--- a/samples/client/petstore/android-java/pom.xml
+++ b/samples/client/petstore/android-java/pom.xml
@@ -2,9 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.wordnik
- swagger-petstore
+ swagger-client
jar
- swagger-petstore
+ swagger-client
1.0.0
scm:git:git@github.com:wordnik/swagger-mustache.git
@@ -149,4 +149,3 @@
4.0
-
diff --git a/samples/client/petstore/java/pom.xml b/samples/client/petstore/java/pom.xml
index 2f685c3927b..4561705d08d 100644
--- a/samples/client/petstore/java/pom.xml
+++ b/samples/client/petstore/java/pom.xml
@@ -2,9 +2,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.wordnik
- swagger-petstore
+ swagger-client
jar
- swagger-petstore
+ swagger-client
1.0.0
scm:git:git@github.com:wordnik/swagger-mustache.git
@@ -167,4 +167,3 @@
4.8.1
-
diff --git a/samples/client/petstore/objc/Podfile b/samples/client/petstore/objc/Podfile
index 36e97d70a75..0db992d7436 100644
--- a/samples/client/petstore/objc/Podfile
+++ b/samples/client/petstore/objc/Podfile
@@ -1,4 +1,3 @@
platform :ios, '6.0'
-xcodeproj 'PetstoreClient/PetstoreClient.xcodeproj'
+xcodeproj '/.xcodeproj'
pod 'AFNetworking', '~> 1.0'
-
diff --git a/samples/client/petstore/objc/client/SWGCategory.h b/samples/client/petstore/objc/client/SWGCategory.h
index 7443279dc27..474f70c37c4 100644
--- a/samples/client/petstore/objc/client/SWGCategory.h
+++ b/samples/client/petstore/objc/client/SWGCategory.h
@@ -5,15 +5,13 @@
@interface SWGCategory : SWGObject
@property(nonatomic) NSNumber* _id;
-
@property(nonatomic) NSString* name;
-
- (id) _id: (NSNumber*) _id
- name: (NSString*) name;
+
+ name: (NSString*) name;
+
- (id) initWithValues: (NSDictionary*)dict;
- (NSDictionary*) asDictionary;
-
@end
-
diff --git a/samples/client/petstore/objc/client/SWGCategory.m b/samples/client/petstore/objc/client/SWGCategory.m
index 4058217c9e1..8e1ab7845a6 100644
--- a/samples/client/petstore/objc/client/SWGCategory.m
+++ b/samples/client/petstore/objc/client/SWGCategory.m
@@ -4,32 +4,34 @@
@implementation SWGCategory
-(id)_id: (NSNumber*) _id
- name: (NSString*) name
-{
- __id = _id;
- _name = name;
- return self;
+ name: (NSString*) name {
+
+ __id = _id;
+ _name = name;
+
+ return self;
}
-(id) initWithValues:(NSDictionary*)dict
{
self = [super init];
if(self) {
- __id = dict[@"id"];
- _name = dict[@"name"];
+ __id = dict[@"id"];
+ _name = dict[@"name"];
-
}
return self;
}
-(NSDictionary*) asDictionary {
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
- if(__id != nil) dict[@"id"] = __id ;
- if(_name != nil) dict[@"name"] = _name ;
- NSDictionary* output = [dict copy];
+ if(__id != nil)
+ dict[@"id"] = [(SWGObject*)__id asDictionary];
+ if(_name != nil)
+ dict[@"name"] = [(SWGObject*)_name asDictionary];
+
+ NSDictionary* output = [dict copy];
return output;
}
@end
-
diff --git a/samples/client/petstore/objc/client/SWGOrder.h b/samples/client/petstore/objc/client/SWGOrder.h
index c1486966e24..b356595f828 100644
--- a/samples/client/petstore/objc/client/SWGOrder.h
+++ b/samples/client/petstore/objc/client/SWGOrder.h
@@ -1,29 +1,34 @@
#import
#import "SWGObject.h"
#import "SWGDate.h"
+#import "SWGMap.h"
@interface SWGOrder : SWGObject
@property(nonatomic) NSNumber* _id;
-
@property(nonatomic) NSNumber* petId;
-
@property(nonatomic) NSNumber* quantity;
-
-@property(nonatomic) NSString* status; /* Order Status [optional]*/
-
@property(nonatomic) SWGDate* shipDate;
-
+@property(nonatomic) NSString* status;
+@property(nonatomic) NSNumber* complete;
+@property(nonatomic) SWGMap* keyValuePairs;
- (id) _id: (NSNumber*) _id
- petId: (NSNumber*) petId
- quantity: (NSNumber*) quantity
- status: (NSString*) status
- shipDate: (SWGDate*) shipDate;
+
+ petId: (NSNumber*) petId
+
+ quantity: (NSNumber*) quantity
+
+ shipDate: (SWGDate*) shipDate
+
+ status: (NSString*) status
+
+ complete: (NSNumber*) complete
+
+ keyValuePairs: (SWGMap*) keyValuePairs;
+
- (id) initWithValues: (NSDictionary*)dict;
- (NSDictionary*) asDictionary;
-
@end
-
diff --git a/samples/client/petstore/objc/client/SWGOrder.m b/samples/client/petstore/objc/client/SWGOrder.m
index cdcf432bb88..ca9ede3c98b 100644
--- a/samples/client/petstore/objc/client/SWGOrder.m
+++ b/samples/client/petstore/objc/client/SWGOrder.m
@@ -6,61 +6,53 @@
-(id)_id: (NSNumber*) _id
petId: (NSNumber*) petId
quantity: (NSNumber*) quantity
- status: (NSString*) status
shipDate: (SWGDate*) shipDate
-{
- __id = _id;
- _petId = petId;
- _quantity = quantity;
- _status = status;
- _shipDate = shipDate;
- return self;
+ status: (NSString*) status
+ complete: (NSNumber*) complete
+ keyValuePairs: (SWGMap*) keyValuePairs {
+
+ __id = _id;
+ _petId = petId;
+ _quantity = quantity;
+ _shipDate = shipDate;
+ _status = status;
+ _complete = complete;
+ _keyValuePairs = keyValuePairs;
+
+ return self;
}
-(id) initWithValues:(NSDictionary*)dict
{
self = [super init];
if(self) {
- __id = dict[@"id"];
- _petId = dict[@"petId"];
- _quantity = dict[@"quantity"];
- _status = dict[@"status"];
- id shipDate_dict = dict[@"shipDate"];
- if(shipDate_dict != nil)
- _shipDate = [[SWGDate alloc]initWithValues:shipDate_dict];
+ __id = dict[@"id"];
+ _petId = dict[@"petId"];
+ _quantity = dict[@"quantity"];
+
+ _status = dict[@"status"];
+ _complete = dict[@"complete"];
+
-
}
return self;
}
-(NSDictionary*) asDictionary {
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
- if(__id != nil) dict[@"id"] = __id ;
- if(_petId != nil) dict[@"petId"] = _petId ;
- if(_quantity != nil) dict[@"quantity"] = _quantity ;
- if(_status != nil) dict[@"status"] = _status ;
- if(_shipDate != nil){
- if([_shipDate isKindOfClass:[NSArray class]]){
- NSMutableArray * array = [[NSMutableArray alloc] init];
- for( SWGDate *shipDate in (NSArray*)_shipDate) {
- [array addObject:[(SWGObject*)shipDate asDictionary]];
- }
- dict[@"shipDate"] = array;
- }
- else if(_shipDate && [_shipDate isKindOfClass:[SWGDate class]]) {
- NSString * dateString = [(SWGDate*)_shipDate toString];
- if(dateString){
- dict[@"shipDate"] = dateString;
- }
- }
- else {
- if(_shipDate != nil) dict[@"shipDate"] = [(SWGObject*)_shipDate asDictionary];
- }
- }
+ if(__id != nil)
+ dict[@"id"] = [(SWGObject*)__id asDictionary];
+ if(_petId != nil)
+ dict[@"petId"] = [(SWGObject*)_petId asDictionary];
+ if(_quantity != nil)
+ dict[@"quantity"] = [(SWGObject*)_quantity asDictionary];
+ if(_status != nil)
+ dict[@"status"] = [(SWGObject*)_status asDictionary];
+ if(_complete != nil)
+ dict[@"complete"] = [(SWGObject*)_complete asDictionary];
+
NSDictionary* output = [dict copy];
return output;
}
@end
-
diff --git a/samples/client/petstore/objc/client/SWGPet.h b/samples/client/petstore/objc/client/SWGPet.h
index d36a50cbf4d..9143a1e2b41 100644
--- a/samples/client/petstore/objc/client/SWGPet.h
+++ b/samples/client/petstore/objc/client/SWGPet.h
@@ -1,33 +1,31 @@
#import
#import "SWGObject.h"
-#import "SWGCategory.h"
#import "SWGTag.h"
+#import "SWGCategory.h"
@interface SWGPet : SWGObject
-@property(nonatomic) NSNumber* _id; /* unique identifier for the pet */
-
+@property(nonatomic) NSNumber* _id; /* the identifier for the pet */
@property(nonatomic) SWGCategory* category;
-
@property(nonatomic) NSString* name;
-
@property(nonatomic) NSArray* photoUrls;
-
@property(nonatomic) NSArray* tags;
-
-@property(nonatomic) NSString* status; /* pet status in the store [optional]*/
-
+@property(nonatomic) NSString* status;
- (id) _id: (NSNumber*) _id
- category: (SWGCategory*) category
- name: (NSString*) name
- photoUrls: (NSArray*) photoUrls
- tags: (NSArray*) tags
- status: (NSString*) status;
+
+ category: (SWGCategory*) category
+
+ name: (NSString*) name
+
+ photoUrls: (NSArray*) photoUrls
+
+ tags: (NSArray*) tags
+
+ status: (NSString*) status;
+
- (id) initWithValues: (NSDictionary*)dict;
- (NSDictionary*) asDictionary;
-
@end
-
diff --git a/samples/client/petstore/objc/client/SWGPet.m b/samples/client/petstore/objc/client/SWGPet.m
index 4bbfe48a8ea..c49eb99937b 100644
--- a/samples/client/petstore/objc/client/SWGPet.m
+++ b/samples/client/petstore/objc/client/SWGPet.m
@@ -8,35 +8,35 @@
name: (NSString*) name
photoUrls: (NSArray*) photoUrls
tags: (NSArray*) tags
- status: (NSString*) status
-{
- __id = _id;
- _category = category;
- _name = name;
- _photoUrls = photoUrls;
- _tags = tags;
- _status = status;
- return self;
+ status: (NSString*) status {
+
+ __id = _id;
+ _category = category;
+ _name = name;
+ _photoUrls = photoUrls;
+ _tags = tags;
+ _status = status;
+
+ return self;
}
-(id) initWithValues:(NSDictionary*)dict
{
self = [super init];
if(self) {
- __id = dict[@"id"];
- id category_dict = dict[@"category"];
- if(category_dict != nil)
- _category = [[SWGCategory alloc]initWithValues:category_dict];
- _name = dict[@"name"];
- _photoUrls = dict[@"photoUrls"];
+ __id = dict[@"id"];
+
+ _name = dict[@"name"];
+
+
+
id tags_dict = dict[@"tags"];
if([tags_dict isKindOfClass:[NSArray class]]) {
-
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*)tags_dict count]];
if([(NSArray*)tags_dict count] > 0) {
for (NSDictionary* dict in (NSArray*)tags_dict) {
- SWGTag* d = [[SWGTag alloc] initWithValues:dict];
+ SWGTag* d = [[SWGTag alloc] initWithValues:dict];
[objs addObject:d];
}
@@ -49,37 +49,20 @@
else {
_tags = [[NSArray alloc] init];
}
- _status = dict[@"status"];
-
+ _status = dict[@"status"];
+
}
return self;
}
-(NSDictionary*) asDictionary {
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
- if(__id != nil) dict[@"id"] = __id ;
- if(_category != nil){
- if([_category isKindOfClass:[NSArray class]]){
- NSMutableArray * array = [[NSMutableArray alloc] init];
- for( SWGCategory *category in (NSArray*)_category) {
- [array addObject:[(SWGObject*)category asDictionary]];
- }
- dict[@"category"] = array;
- }
- else if(_category && [_category isKindOfClass:[SWGDate class]]) {
- NSString * dateString = [(SWGDate*)_category toString];
- if(dateString){
- dict[@"category"] = dateString;
- }
- }
- else {
- if(_category != nil) dict[@"category"] = [(SWGObject*)_category asDictionary];
- }
- }
- if(_name != nil) dict[@"name"] = _name ;
- if(_photoUrls != nil) dict[@"photoUrls"] = _photoUrls ;
- if(_tags != nil){
+ if(__id != nil)
+ dict[@"id"] = [(SWGObject*)__id asDictionary];
+ if(_name != nil)
+ dict[@"name"] = [(SWGObject*)_name asDictionary];
+ if(_tags != nil){
if([_tags isKindOfClass:[NSArray class]]){
NSMutableArray * array = [[NSMutableArray alloc] init];
for( SWGTag *tags in (NSArray*)_tags) {
@@ -94,13 +77,14 @@
}
}
else {
- if(_tags != nil) dict[@"tags"] = [(SWGObject*)_tags asDictionary];
+ if(_tags != nil) dict[@"tags"] = [(SWGObject*)_tags asDictionary];
}
}
- if(_status != nil) dict[@"status"] = _status ;
- NSDictionary* output = [dict copy];
+ if(_status != nil)
+ dict[@"status"] = [(SWGObject*)_status asDictionary];
+
+ NSDictionary* output = [dict copy];
return output;
}
@end
-
diff --git a/samples/client/petstore/objc/client/SWGPetApi.h b/samples/client/petstore/objc/client/SWGPetApi.h
index 2e9b2cbf8af..66baf554182 100644
--- a/samples/client/petstore/objc/client/SWGPetApi.h
+++ b/samples/client/petstore/objc/client/SWGPetApi.h
@@ -1,7 +1,5 @@
#import
#import "SWGPet.h"
-#import "SWGFile.h"
-
@interface SWGPetApi: NSObject
@@ -13,91 +11,68 @@
+(NSString*) getBasePath;
/**
- Find pet by ID
- Returns a pet based on ID
- @param petId ID of pet that needs to be fetched
- */
--(NSNumber*) getPetByIdWithCompletionBlock :(NSNumber*) petId
- completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock;
-
-/**
-
- Deletes a pet
+ Update an existing pet
- @param petId Pet id to delete
- */
--(NSNumber*) deletePetWithCompletionBlock :(NSString*) petId
- completionHandler: (void (^)(NSError* error))completionBlock;
-/**
-
- partial updates to a pet
-
- @param petId ID of pet that needs to be fetched
@param body Pet object that needs to be added to the store
- */
--(NSNumber*) partialUpdateWithCompletionBlock :(NSString*) petId
- body:(SWGPet*) body
- completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
-
-/**
-
- Updates a pet in the store with form data
- @param petId ID of pet that needs to be updated
- @param name Updated name of the pet
- @param status Updated status of the pet
*/
--(NSNumber*) updatePetWithFormWithCompletionBlock :(NSString*) petId
- name:(NSString*) name
- status:(NSString*) status
- completionHandler: (void (^)(NSError* error))completionBlock;
-
-/**
-
- uploads an image
-
- @param additionalMetadata Additional data to pass to server
- @param body file to upload
- */
--(NSNumber*) uploadFileWithCompletionBlock :(NSString*) additionalMetadata
- body:(SWGFile*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
+-(NSNumber*) updatePetWithCompletionBlock : (SWGPet*) body
+ completionHandler: (void (^)(NSError* error))completionBlock;
/**
Add a new pet to the store
+
@param body Pet object that needs to be added to the store
- */
--(NSNumber*) addPetWithCompletionBlock :(SWGPet*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
-
-/**
-
- Update an existing pet
- @param body Pet object that needs to be updated in the store
*/
--(NSNumber*) updatePetWithCompletionBlock :(SWGPet*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
+-(NSNumber*) addPetWithCompletionBlock : (SWGPet*) body
+ completionHandler: (void (^)(NSError* error))completionBlock;
/**
Finds Pets by status
Multiple status values can be provided with comma seperated strings
+
@param status Status values that need to be considered for filter
+
*/
--(NSNumber*) findPetsByStatusWithCompletionBlock :(NSString*) status
- completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
+-(NSNumber*) findPetsByStatusWithCompletionBlock : (NSArray*) status
+ completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
/**
Finds Pets by tags
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
- @param tags Tags to filter by
- */
--(NSNumber*) findPetsByTagsWithCompletionBlock :(NSString*) tags
- completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
-@end
+ @param tags Tags to filter by
+
+ */
+-(NSNumber*) findPetsByTagsWithCompletionBlock : (NSArray*) tags
+ completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock;
+
+/**
+
+ Find pet by ID
+ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+
+ @param petId ID of pet that needs to be fetched
+
+ */
+-(NSNumber*) getPetByIdWithCompletionBlock : (NSNumber*) petId
+ completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock;
+
+/**
+
+ Deletes a pet
+
+
+ @param petId Pet id to delete
+
+ */
+-(NSNumber*) deletePetWithCompletionBlock : (NSNumber*) petId
+
+ completionHandler: (void (^)(NSError* error))completionBlock;
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m
index b911307b4e6..82bc422801b 100644
--- a/samples/client/petstore/objc/client/SWGPetApi.m
+++ b/samples/client/petstore/objc/client/SWGPetApi.m
@@ -2,13 +2,11 @@
#import "SWGFile.h"
#import "SWGApiClient.h"
#import "SWGPet.h"
-#import "SWGFile.h"
-
@implementation SWGPetApi
-static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
+static NSString * basePath = @"";
+(SWGPetApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static SWGPetApi* singletonAPI = nil;
@@ -52,281 +50,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
}
--(NSNumber*) getPetByIdWithCompletionBlock:(NSNumber*) petId
- completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(petId == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client dictionary:requestUrl
- method:@"GET"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType:requestContentType
- responseContentType:responseContentType
- completionBlock:^(NSDictionary *data, NSError *error) {
- if (error) {
- completionBlock(nil, error);return;
- }
- SWGPet *result = nil;
- if (data) {
- result = [[SWGPet alloc]initWithValues: data];
- }
- completionBlock(result , nil);}];
-
-
-}
-
--(NSNumber*) deletePetWithCompletionBlock:(NSString*) petId
- completionHandler: (void (^)(NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(petId == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client stringWithCompletionBlock:requestUrl
- method:@"DELETE"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(error);
- return;
- }
- completionBlock(nil);
- }];
-
-
-}
-
--(NSNumber*) partialUpdateWithCompletionBlock:(NSString*) petId
- body:(SWGPet*) body
- completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
-
- if(petId == nil) {
- // error
- }
- if(body == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client dictionary: requestUrl
- method: @"PATCH"
- queryParams: queryParams
- body: bodyDictionary
- headerParams: headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock: ^(NSDictionary *data, NSError *error) {
- if (error) {
- completionBlock(nil, error);return;
- }
-
- if([data isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]];
- for (NSDictionary* dict in (NSArray*)data) {
- SWGPet* d = [[SWGPet alloc]initWithValues: dict];
- [objs addObject:d];
- }
- completionBlock(objs, nil);
- }
- }];
-
-
-}
-
--(NSNumber*) updatePetWithFormWithCompletionBlock:(NSString*) petId
- name:(NSString*) name
- status:(NSString*) status
- completionHandler: (void (^)(NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(petId == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client stringWithCompletionBlock:requestUrl
- method:@"POST"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(error);
- return;
- }
- completionBlock(nil);
- }];
-
-
-}
-
--(NSNumber*) uploadFileWithCompletionBlock:(NSString*) additionalMetadata
- body:(SWGFile*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/uploadImage", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
-
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client stringWithCompletionBlock:requestUrl
- method:@"POST"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(error);
- return;
- }
- completionBlock(nil);
- }];
-
-
-}
-
--(NSNumber*) addPetWithCompletionBlock:(SWGPet*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) updatePetWithCompletionBlock:(SWGPet*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
@@ -334,121 +60,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
-
- if(body == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client stringWithCompletionBlock:requestUrl
- method:@"POST"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(error);
- return;
- }
- completionBlock(nil);
- }];
-}
-
--(NSNumber*) updatePetWithCompletionBlock:(SWGPet*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
+
+
+ id bodyDictionary = nil;
+
+
+
- if(body == nil) {
- // error
- }
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
method:@"PUT"
queryParams:queryParams
@@ -464,11 +98,65 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
+
}
--(NSNumber*) findPetsByStatusWithCompletionBlock:(NSString*) status
- completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{
+-(NSNumber*) addPetWithCompletionBlock:(SWGPet*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
+
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet", basePath];
+
+ // remove format in URL if needed
+ if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+
+
+ NSString* requestContentType = @"application/json";
+ NSString* responseContentType = @"application/json";
+
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+
+ return [client stringWithCompletionBlock:requestUrl
+ method:@"POST"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType: requestContentType
+ responseContentType: responseContentType
+ completionBlock:^(NSString *data, NSError *error) {
+ if (error) {
+ completionBlock(error);
+ return;
+ }
+ completionBlock(nil);
+ }];
+
+
+
+}
+
+-(NSNumber*) findPetsByStatusWithCompletionBlock:(NSArray*) status
+ completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock
+ {
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByStatus", basePath];
@@ -476,19 +164,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
if(status != nil)
queryParams[@"status"] = status;
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
id bodyDictionary = nil;
- if(status == nil) {
- // error
- }
+
+
+
+
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
return [client dictionary: requestUrl
method: @"GET"
queryParams: queryParams
@@ -498,24 +192,36 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
responseContentType: responseContentType
completionBlock: ^(NSDictionary *data, NSError *error) {
if (error) {
- completionBlock(nil, error);return;
+ completionBlock(nil, error);
+
+ return;
}
+
if([data isKindOfClass:[NSArray class]]){
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]];
for (NSDictionary* dict in (NSArray*)data) {
- SWGPet* d = [[SWGPet alloc]initWithValues: dict];
+
+
+ SWGPet* d = [[SWGPet alloc]initWithValues: dict];
+
[objs addObject:d];
}
completionBlock(objs, nil);
}
- }];
+
+
+
+ }];
+
+
}
--(NSNumber*) findPetsByTagsWithCompletionBlock:(NSString*) tags
- completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock{
+-(NSNumber*) findPetsByTagsWithCompletionBlock:(NSArray*) tags
+ completionHandler: (void (^)(NSArray* output, NSError* error))completionBlock
+ {
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/findByTags", basePath];
@@ -523,19 +229,25 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
if(tags != nil)
queryParams[@"tags"] = tags;
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
id bodyDictionary = nil;
- if(tags == nil) {
- // error
- }
+
+
+
+
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
return [client dictionary: requestUrl
method: @"GET"
queryParams: queryParams
@@ -545,22 +257,144 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
responseContentType: responseContentType
completionBlock: ^(NSDictionary *data, NSError *error) {
if (error) {
- completionBlock(nil, error);return;
+ completionBlock(nil, error);
+
+ return;
}
+
if([data isKindOfClass:[NSArray class]]){
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[data count]];
for (NSDictionary* dict in (NSArray*)data) {
- SWGPet* d = [[SWGPet alloc]initWithValues: dict];
+
+
+ SWGPet* d = [[SWGPet alloc]initWithValues: dict];
+
[objs addObject:d];
}
completionBlock(objs, nil);
}
- }];
+
+
+
+ }];
+
+
+
+
+}
+
+-(NSNumber*) getPetByIdWithCompletionBlock:(NSNumber*) petId
+ completionHandler: (void (^)(SWGPet* output, NSError* error))completionBlock
+ {
+
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
+
+ // remove format in URL if needed
+ if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
+
+
+ NSString* requestContentType = @"application/json";
+ NSString* responseContentType = @"application/json";
+
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+ return [client dictionary:requestUrl
+ method:@"GET"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType:requestContentType
+ responseContentType:responseContentType
+ completionBlock:^(NSDictionary *data, NSError *error) {
+ if (error) {
+ completionBlock(nil, error);
+
+ return;
+ }
+
+ SWGPet *result = nil;
+ if (data) {
+ result = [[SWGPet alloc]initWithValues: data];
+ }
+ completionBlock(result , nil);
+
+ }];
+
+
+}
+
+-(NSNumber*) deletePetWithCompletionBlock:(NSNumber*) petId
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
+
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/pet/{petId}", basePath];
+
+ // remove format in URL if needed
+ if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]];
+
+
+ NSString* requestContentType = @"application/json";
+ NSString* responseContentType = @"application/json";
+
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+
+ return [client stringWithCompletionBlock:requestUrl
+ method:@"DELETE"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType: requestContentType
+ responseContentType: responseContentType
+ completionBlock:^(NSString *data, NSError *error) {
+ if (error) {
+ completionBlock(error);
+ return;
+ }
+ completionBlock(nil);
+ }];
+
}
-@end
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/client/SWGStoreApi.h b/samples/client/petstore/objc/client/SWGStoreApi.h
index 9dcfdbd3ea7..c9539c9964e 100644
--- a/samples/client/petstore/objc/client/SWGStoreApi.h
+++ b/samples/client/petstore/objc/client/SWGStoreApi.h
@@ -2,7 +2,6 @@
#import "SWGOrder.h"
-
@interface SWGStoreApi: NSObject
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
@@ -12,29 +11,35 @@
+(NSString*) getBasePath;
/**
- Find purchase order by ID
- For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors
- @param orderId ID of pet that needs to be fetched
+ Place an order for a pet
+
+
+ @param body order placed for purchasing the pet
+
*/
--(NSNumber*) getOrderByIdWithCompletionBlock :(NSString*) orderId
- completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
+-(NSNumber*) placeOrderWithCompletionBlock : (SWGOrder*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock;
+/**
+
+ Find purchase order by ID
+ For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+ @param orderId ID of pet that needs to be fetched
+
+ */
+-(NSNumber*) getOrderByIdWithCompletionBlock : (NSString*) orderId
+ completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock;
/**
Delete purchase order by ID
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
@param orderId ID of the order that needs to be deleted
- */
--(NSNumber*) deleteOrderWithCompletionBlock :(NSString*) orderId
- completionHandler: (void (^)(NSError* error))completionBlock;
-
-/**
-
- Place an order for a pet
- @param body order placed for purchasing the pet
*/
--(NSNumber*) placeOrderWithCompletionBlock :(SWGOrder*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
+-(NSNumber*) deleteOrderWithCompletionBlock : (NSString*) orderId
-@end
+ completionHandler: (void (^)(NSError* error))completionBlock;
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/client/SWGStoreApi.m b/samples/client/petstore/objc/client/SWGStoreApi.m
index 8bb18a8c8e3..eb1ce893d44 100644
--- a/samples/client/petstore/objc/client/SWGStoreApi.m
+++ b/samples/client/petstore/objc/client/SWGStoreApi.m
@@ -5,9 +5,8 @@
-
@implementation SWGStoreApi
-static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
+static NSString * basePath = @"";
+(SWGStoreApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static SWGStoreApi* singletonAPI = nil;
@@ -51,88 +50,9 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
}
--(NSNumber*) getOrderByIdWithCompletionBlock:(NSString*) orderId
- completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [SWGApiClient escape:orderId]];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(orderId == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client dictionary:requestUrl
- method:@"GET"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType:requestContentType
- responseContentType:responseContentType
- completionBlock:^(NSDictionary *data, NSError *error) {
- if (error) {
- completionBlock(nil, error);return;
- }
- SWGOrder *result = nil;
- if (data) {
- result = [[SWGOrder alloc]initWithValues: data];
- }
- completionBlock(result , nil);}];
-
-
-}
-
--(NSNumber*) deleteOrderWithCompletionBlock:(NSString*) orderId
- completionHandler: (void (^)(NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [SWGApiClient escape:orderId]];
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(orderId == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client stringWithCompletionBlock:requestUrl
- method:@"DELETE"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(error);
- return;
- }
- completionBlock(nil);
- }];
-
-
-}
-
--(NSNumber*) placeOrderWithCompletionBlock:(SWGOrder*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) placeOrderWithCompletionBlock:(SWGOrder*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order", basePath];
@@ -140,50 +60,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
+
+
+ id bodyDictionary = nil;
+
+
+
- if(body == nil) {
- // error
- }
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
method:@"POST"
queryParams:queryParams
@@ -199,9 +98,121 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
+
+
+}
+
+-(NSNumber*) getOrderByIdWithCompletionBlock:(NSString*) orderId
+ completionHandler: (void (^)(SWGOrder* output, NSError* error))completionBlock
+ {
+
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
+
+ // remove format in URL if needed
+ if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [SWGApiClient escape:orderId]];
+
+
+ NSString* requestContentType = @"application/json";
+ NSString* responseContentType = @"application/json";
+
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+ return [client dictionary:requestUrl
+ method:@"GET"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType:requestContentType
+ responseContentType:responseContentType
+ completionBlock:^(NSDictionary *data, NSError *error) {
+ if (error) {
+ completionBlock(nil, error);
+
+ return;
+ }
+
+ SWGOrder *result = nil;
+ if (data) {
+ result = [[SWGOrder alloc]initWithValues: data];
+ }
+ completionBlock(result , nil);
+
+ }];
+
+
+}
+
+-(NSNumber*) deleteOrderWithCompletionBlock:(NSString*) orderId
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
+
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/store/order/{orderId}", basePath];
+
+ // remove format in URL if needed
+ if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"orderId", @"}"]] withString: [SWGApiClient escape:orderId]];
+
+
+ NSString* requestContentType = @"application/json";
+ NSString* responseContentType = @"application/json";
+
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+
+ return [client stringWithCompletionBlock:requestUrl
+ method:@"DELETE"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType: requestContentType
+ responseContentType: responseContentType
+ completionBlock:^(NSString *data, NSError *error) {
+ if (error) {
+ completionBlock(error);
+ return;
+ }
+ completionBlock(nil);
+ }];
+
+
}
-@end
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/client/SWGTag.h b/samples/client/petstore/objc/client/SWGTag.h
index 55ad9f0422e..7936df1f670 100644
--- a/samples/client/petstore/objc/client/SWGTag.h
+++ b/samples/client/petstore/objc/client/SWGTag.h
@@ -5,15 +5,13 @@
@interface SWGTag : SWGObject
@property(nonatomic) NSNumber* _id;
-
@property(nonatomic) NSString* name;
-
- (id) _id: (NSNumber*) _id
- name: (NSString*) name;
+
+ name: (NSString*) name;
+
- (id) initWithValues: (NSDictionary*)dict;
- (NSDictionary*) asDictionary;
-
@end
-
diff --git a/samples/client/petstore/objc/client/SWGTag.m b/samples/client/petstore/objc/client/SWGTag.m
index 0949e5eaa45..115e712c0fb 100644
--- a/samples/client/petstore/objc/client/SWGTag.m
+++ b/samples/client/petstore/objc/client/SWGTag.m
@@ -4,32 +4,34 @@
@implementation SWGTag
-(id)_id: (NSNumber*) _id
- name: (NSString*) name
-{
- __id = _id;
- _name = name;
- return self;
+ name: (NSString*) name {
+
+ __id = _id;
+ _name = name;
+
+ return self;
}
-(id) initWithValues:(NSDictionary*)dict
{
self = [super init];
if(self) {
- __id = dict[@"id"];
- _name = dict[@"name"];
+ __id = dict[@"id"];
+ _name = dict[@"name"];
-
}
return self;
}
-(NSDictionary*) asDictionary {
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
- if(__id != nil) dict[@"id"] = __id ;
- if(_name != nil) dict[@"name"] = _name ;
- NSDictionary* output = [dict copy];
+ if(__id != nil)
+ dict[@"id"] = [(SWGObject*)__id asDictionary];
+ if(_name != nil)
+ dict[@"name"] = [(SWGObject*)_name asDictionary];
+
+ NSDictionary* output = [dict copy];
return output;
}
@end
-
diff --git a/samples/client/petstore/objc/client/SWGUser.h b/samples/client/petstore/objc/client/SWGUser.h
index 659687bda0b..bd19dc2077c 100644
--- a/samples/client/petstore/objc/client/SWGUser.h
+++ b/samples/client/petstore/objc/client/SWGUser.h
@@ -5,33 +5,31 @@
@interface SWGUser : SWGObject
@property(nonatomic) NSNumber* _id;
-
-@property(nonatomic) NSString* firstName;
-
@property(nonatomic) NSString* username;
-
+@property(nonatomic) NSString* firstName;
@property(nonatomic) NSString* lastName;
-
@property(nonatomic) NSString* email;
-
@property(nonatomic) NSString* password;
-
@property(nonatomic) NSString* phone;
-
-@property(nonatomic) NSNumber* userStatus; /* User Status [optional]*/
-
+@property(nonatomic) NSNumber* userStatus;
- (id) _id: (NSNumber*) _id
- firstName: (NSString*) firstName
- username: (NSString*) username
- lastName: (NSString*) lastName
- email: (NSString*) email
- password: (NSString*) password
- phone: (NSString*) phone
- userStatus: (NSNumber*) userStatus;
+
+ username: (NSString*) username
+
+ firstName: (NSString*) firstName
+
+ lastName: (NSString*) lastName
+
+ email: (NSString*) email
+
+ password: (NSString*) password
+
+ phone: (NSString*) phone
+
+ userStatus: (NSNumber*) userStatus;
+
- (id) initWithValues: (NSDictionary*)dict;
- (NSDictionary*) asDictionary;
-
@end
-
diff --git a/samples/client/petstore/objc/client/SWGUser.m b/samples/client/petstore/objc/client/SWGUser.m
index 1b2f85a29c3..947d43a31d9 100644
--- a/samples/client/petstore/objc/client/SWGUser.m
+++ b/samples/client/petstore/objc/client/SWGUser.m
@@ -4,56 +4,64 @@
@implementation SWGUser
-(id)_id: (NSNumber*) _id
- firstName: (NSString*) firstName
username: (NSString*) username
+ firstName: (NSString*) firstName
lastName: (NSString*) lastName
email: (NSString*) email
password: (NSString*) password
phone: (NSString*) phone
- userStatus: (NSNumber*) userStatus
-{
- __id = _id;
- _firstName = firstName;
- _username = username;
- _lastName = lastName;
- _email = email;
- _password = password;
- _phone = phone;
- _userStatus = userStatus;
- return self;
+ userStatus: (NSNumber*) userStatus {
+
+ __id = _id;
+ _username = username;
+ _firstName = firstName;
+ _lastName = lastName;
+ _email = email;
+ _password = password;
+ _phone = phone;
+ _userStatus = userStatus;
+
+ return self;
}
-(id) initWithValues:(NSDictionary*)dict
{
self = [super init];
if(self) {
- __id = dict[@"id"];
- _firstName = dict[@"firstName"];
- _username = dict[@"username"];
- _lastName = dict[@"lastName"];
- _email = dict[@"email"];
- _password = dict[@"password"];
- _phone = dict[@"phone"];
- _userStatus = dict[@"userStatus"];
+ __id = dict[@"id"];
+ _username = dict[@"username"];
+ _firstName = dict[@"firstName"];
+ _lastName = dict[@"lastName"];
+ _email = dict[@"email"];
+ _password = dict[@"password"];
+ _phone = dict[@"phone"];
+ _userStatus = dict[@"userStatus"];
-
}
return self;
}
-(NSDictionary*) asDictionary {
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
- if(__id != nil) dict[@"id"] = __id ;
- if(_firstName != nil) dict[@"firstName"] = _firstName ;
- if(_username != nil) dict[@"username"] = _username ;
- if(_lastName != nil) dict[@"lastName"] = _lastName ;
- if(_email != nil) dict[@"email"] = _email ;
- if(_password != nil) dict[@"password"] = _password ;
- if(_phone != nil) dict[@"phone"] = _phone ;
- if(_userStatus != nil) dict[@"userStatus"] = _userStatus ;
- NSDictionary* output = [dict copy];
+ if(__id != nil)
+ dict[@"id"] = [(SWGObject*)__id asDictionary];
+ if(_username != nil)
+ dict[@"username"] = [(SWGObject*)_username asDictionary];
+ if(_firstName != nil)
+ dict[@"firstName"] = [(SWGObject*)_firstName asDictionary];
+ if(_lastName != nil)
+ dict[@"lastName"] = [(SWGObject*)_lastName asDictionary];
+ if(_email != nil)
+ dict[@"email"] = [(SWGObject*)_email asDictionary];
+ if(_password != nil)
+ dict[@"password"] = [(SWGObject*)_password asDictionary];
+ if(_phone != nil)
+ dict[@"phone"] = [(SWGObject*)_phone asDictionary];
+ if(_userStatus != nil)
+ dict[@"userStatus"] = [(SWGObject*)_userStatus asDictionary];
+
+ NSDictionary* output = [dict copy];
return output;
}
@end
-
diff --git a/samples/client/petstore/objc/client/SWGUserApi.h b/samples/client/petstore/objc/client/SWGUserApi.h
index 9a8cc281ef3..b2a2f8d2a7b 100644
--- a/samples/client/petstore/objc/client/SWGUserApi.h
+++ b/samples/client/petstore/objc/client/SWGUserApi.h
@@ -2,7 +2,6 @@
#import "SWGUser.h"
-
@interface SWGUserApi: NSObject
-(void) addHeader:(NSString*)value forKey:(NSString*)key;
@@ -12,76 +11,93 @@
+(NSString*) getBasePath;
/**
- Updated user
+ Create user
This can only be done by the logged in user.
- @param username name that need to be deleted
- @param body Updated user object
- */
--(NSNumber*) updateUserWithCompletionBlock :(NSString*) username
- body:(SWGUser*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
-/**
-
- Delete user
- This can only be done by the logged in user.
- @param username The name that needs to be deleted
- */
--(NSNumber*) deleteUserWithCompletionBlock :(NSString*) username
- completionHandler: (void (^)(NSError* error))completionBlock;
-
-/**
-
- Get user by user name
+ @param body Created user object
- @param username The name that needs to be fetched. Use user1 for testing.
*/
--(NSNumber*) getUserByNameWithCompletionBlock :(NSString*) username
- completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock;
+-(NSNumber*) createUserWithCompletionBlock : (SWGUser*) body
+ completionHandler: (void (^)(NSError* error))completionBlock;
+/**
+
+ Creates list of users with given input array
+
+
+ @param body List of user object
+
+ */
+-(NSNumber*) createUsersWithArrayInputWithCompletionBlock : (NSArray*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock;
+/**
+
+ Creates list of users with given input array
+
+
+ @param body List of user object
+
+ */
+-(NSNumber*) createUsersWithListInputWithCompletionBlock : (NSArray*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock;
/**
Logs user into the system
+
@param username The user name for login
@param password The password for login in clear text
+
*/
--(NSNumber*) loginUserWithCompletionBlock :(NSString*) username
- password:(NSString*) password
- completionHandler: (void (^)(NSString* output, NSError* error))completionBlock;
+-(NSNumber*) loginUserWithCompletionBlock : (NSString*) username
+ password: (NSString*) password
+ completionHandler: (void (^)(NSString* output, NSError* error))completionBlock;
/**
Logs out current logged in user session
+
+
*/
--(NSNumber*) logoutUserWithCompletionBlock :(void (^)(NSError* error))completionBlock;
+-(NSNumber*) logoutUserWithCompletionBlock :
+
+(void (^)(NSError* error))completionBlock;
+/**
+
+ Get user by user name
+
+
+ @param username The name that needs to be fetched. Use user1 for testing.
+
+ */
+-(NSNumber*) getUserByNameWithCompletionBlock : (NSString*) username
+ completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock;
/**
- Create user
+ Updated user
This can only be done by the logged in user.
- @param body Created user object
- */
--(NSNumber*) createUserWithCompletionBlock :(SWGUser*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
+ @param username name that need to be deleted
+ @param body Updated user object
+
+ */
+-(NSNumber*) updateUserWithCompletionBlock : (NSString*) username
+ body: (SWGUser*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock;
/**
- Creates list of users with given input array
+ Delete user
+ This can only be done by the logged in user.
+
+ @param username The name that needs to be deleted
- @param body List of user object
*/
--(NSNumber*) createUsersWithArrayInputWithCompletionBlock :(NSArray*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
+-(NSNumber*) deleteUserWithCompletionBlock : (NSString*) username
-/**
-
- Creates list of users with given list input
-
- @param body List of user object
- */
--(NSNumber*) createUsersWithListInputWithCompletionBlock :(NSArray*) body
- completionHandler: (void (^)(NSError* error))completionBlock;
-
-@end
+ completionHandler: (void (^)(NSError* error))completionBlock;
+@end
\ No newline at end of file
diff --git a/samples/client/petstore/objc/client/SWGUserApi.m b/samples/client/petstore/objc/client/SWGUserApi.m
index f7e9df6289a..531532a54dc 100644
--- a/samples/client/petstore/objc/client/SWGUserApi.m
+++ b/samples/client/petstore/objc/client/SWGUserApi.m
@@ -5,9 +5,8 @@
-
@implementation SWGUserApi
-static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
+static NSString * basePath = @"";
+(SWGUserApi*) apiWithHeader:(NSString*)headerValue key:(NSString*)key {
static SWGUserApi* singletonAPI = nil;
@@ -51,66 +50,41 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
}
--(NSNumber*) updateUserWithCompletionBlock:(NSString*) username
- body:(SWGUser*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) createUserWithCompletionBlock:(SWGUser*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath];
// remove format in URL if needed
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
+
+
+ id bodyDictionary = nil;
+
+
+
- if(username == nil) {
- // error
- }
- if(body == nil) {
- // error
- }
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
- method:@"PUT"
+ method:@"POST"
queryParams:queryParams
body:bodyDictionary
headerParams:headerParams
@@ -124,32 +98,45 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
+
}
--(NSNumber*) deleteUserWithCompletionBlock:(NSString*) username
- completionHandler: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) createUsersWithArrayInputWithCompletionBlock:(NSArray*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath];
// remove format in URL if needed
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
id bodyDictionary = nil;
- if(username == nil) {
- // error
- }
+
+
+
+
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
- method:@"DELETE"
+ method:@"POST"
queryParams:queryParams
body:bodyDictionary
headerParams:headerParams
@@ -163,53 +150,66 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
+
}
--(NSNumber*) getUserByNameWithCompletionBlock:(NSString*) username
- completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock{
+-(NSNumber*) createUsersWithListInputWithCompletionBlock:(NSArray*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath];
// remove format in URL if needed
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
id bodyDictionary = nil;
- if(username == nil) {
- // error
- }
+
+
+
+
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
- return [client dictionary:requestUrl
- method:@"GET"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType:requestContentType
- responseContentType:responseContentType
- completionBlock:^(NSDictionary *data, NSError *error) {
+
+
+
+
+
+
+ return [client stringWithCompletionBlock:requestUrl
+ method:@"POST"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType: requestContentType
+ responseContentType: responseContentType
+ completionBlock:^(NSString *data, NSError *error) {
if (error) {
- completionBlock(nil, error);return;
+ completionBlock(error);
+ return;
}
- SWGUser *result = nil;
- if (data) {
- result = [[SWGUser alloc]initWithValues: data];
- }
- completionBlock(result , nil);}];
+ completionBlock(nil);
+ }];
+
}
--(NSNumber*) loginUserWithCompletionBlock:(NSString*) username
- password:(NSString*) password
- completionHandler: (void (^)(NSString* output, NSError* error))completionBlock{
+-(NSNumber*) loginUserWithCompletionBlock:(NSString*) username
+ password:(NSString*) password
+ completionHandler: (void (^)(NSString* output, NSError* error))completionBlock
+ {
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/login", basePath];
@@ -217,44 +217,53 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
if(username != nil)
- queryParams[@"username"] = username;
- if(password != nil)
+ queryParams[@"username"] = username;if(password != nil)
queryParams[@"password"] = password;
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
id bodyDictionary = nil;
- if(username == nil) {
- // error
- }
- if(password == nil) {
- // error
- }
+
+
+
+
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
- return [client stringWithCompletionBlock:requestUrl
- method:@"GET"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(nil, error);
- return;
- }
- NSString *result = data ? [[NSString alloc]initWithString: data] : nil;
- completionBlock(result, nil);
- }];
+
+
+
+
+
+ return [client stringWithCompletionBlock: requestUrl
+ method: @"GET"
+ queryParams: queryParams
+ body: bodyDictionary
+ headerParams: headerParams
+ requestContentType: requestContentType
+ responseContentType: responseContentType
+ completionBlock: ^(NSString *data, NSError *error) {
+ if (error) {
+ completionBlock(nil, error);
+ return;
+ }
+ NSString *result = data ? [[NSString alloc]initWithString: data] : nil;
+ completionBlock(result, nil);
+ }];
+
}
--(NSNumber*) logoutUserWithCompletionBlock: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) logoutUserWithCompletionBlock:
+
+ (void (^)(NSError* error))completionBlock {
NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/logout", basePath];
@@ -262,14 +271,29 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
method:@"GET"
queryParams:queryParams
@@ -285,64 +309,105 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
+
}
--(NSNumber*) createUserWithCompletionBlock:(SWGUser*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) getUserByNameWithCompletionBlock:(NSString*) username
+ completionHandler: (void (^)(SWGUser* output, NSError* error))completionBlock
+ {
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user", basePath];
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
// remove format in URL if needed
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
+
+
+ id bodyDictionary = nil;
+
+
+
- if(body == nil) {
- // error
- }
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+ return [client dictionary:requestUrl
+ method:@"GET"
+ queryParams:queryParams
+ body:bodyDictionary
+ headerParams:headerParams
+ requestContentType:requestContentType
+ responseContentType:responseContentType
+ completionBlock:^(NSDictionary *data, NSError *error) {
+ if (error) {
+ completionBlock(nil, error);
+
+ return;
+ }
+
+ SWGUser *result = nil;
+ if (data) {
+ result = [[SWGUser alloc]initWithValues: data];
+ }
+ completionBlock(result , nil);
+
+ }];
+
+
+}
+
+-(NSNumber*) updateUserWithCompletionBlock:(NSString*) username
+ body:(SWGUser*) body
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
+
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
+
+ // remove format in URL if needed
+ if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
+
+
+ NSString* requestContentType = @"application/json";
+ NSString* responseContentType = @"application/json";
+
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
+ NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
+
+
+ id bodyDictionary = nil;
+
+
+
+
+ SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
- method:@"POST"
+ method:@"PUT"
queryParams:queryParams
body:bodyDictionary
headerParams:headerParams
@@ -356,64 +421,46 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
+
}
--(NSNumber*) createUsersWithArrayInputWithCompletionBlock:(NSArray*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
+-(NSNumber*) deleteUserWithCompletionBlock:(NSString*) username
+
+ completionHandler: (void (^)(NSError* error))completionBlock {
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithArray", basePath];
+ NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/{username}", basePath];
// remove format in URL if needed
if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
[requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
+ [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"username", @"}"]] withString: [SWGApiClient escape:username]];
+
+
NSString* requestContentType = @"application/json";
NSString* responseContentType = @"application/json";
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+ NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
+
NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
+
+
+ id bodyDictionary = nil;
+
+
+
- if(body == nil) {
- // error
- }
SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
+
+
+
+
+
+
return [client stringWithCompletionBlock:requestUrl
- method:@"POST"
+ method:@"DELETE"
queryParams:queryParams
body:bodyDictionary
headerParams:headerParams
@@ -427,80 +474,10 @@ static NSString * basePath = @"http://petstore.swagger.wordnik.com/api";
completionBlock(nil);
}];
-
-}
-
--(NSNumber*) createUsersWithListInputWithCompletionBlock:(NSArray*) body
- completionHandler: (void (^)(NSError* error))completionBlock{
-
- NSMutableString* requestUrl = [NSMutableString stringWithFormat:@"%@/user/createWithList", basePath];
-
- // remove format in URL if needed
- if ([requestUrl rangeOfString:@".{format}"].location != NSNotFound)
- [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:@".{format}"] withString:@".json"];
-
- NSString* requestContentType = @"application/json";
- NSString* responseContentType = @"application/json";
-
- NSMutableDictionary* queryParams = [[NSMutableDictionary alloc] init];
- NSMutableDictionary* headerParams = [[NSMutableDictionary alloc] init];
- id bodyDictionary = nil;
- if(body != nil && [body isKindOfClass:[NSArray class]]){
- NSMutableArray * objs = [[NSMutableArray alloc] init];
- for (id dict in (NSArray*)body) {
- if([dict respondsToSelector:@selector(asDictionary)]) {
- [objs addObject:[(SWGObject*)dict asDictionary]];
- }
- else{
- [objs addObject:dict];
- }
- }
- bodyDictionary = objs;
- }
- else if([body respondsToSelector:@selector(asDictionary)]) {
- bodyDictionary = [(SWGObject*)body asDictionary];
- }
- else if([body isKindOfClass:[NSString class]]) {
- // convert it to a dictionary
- NSError * error;
- NSString * str = (NSString*)body;
- NSDictionary *JSON =
- [NSJSONSerialization JSONObjectWithData:[str dataUsingEncoding:NSUTF8StringEncoding]
- options:NSJSONReadingMutableContainers
- error:&error];
- bodyDictionary = JSON;
- }
- else if([body isKindOfClass: [SWGFile class]]) {
- requestContentType = @"form-data";
- bodyDictionary = body;
- }
- else{
- NSLog(@"don't know what to do with %@", body);
- }
-
- if(body == nil) {
- // error
- }
- SWGApiClient* client = [SWGApiClient sharedClientFromPool:basePath];
-
- return [client stringWithCompletionBlock:requestUrl
- method:@"POST"
- queryParams:queryParams
- body:bodyDictionary
- headerParams:headerParams
- requestContentType: requestContentType
- responseContentType: responseContentType
- completionBlock:^(NSString *data, NSError *error) {
- if (error) {
- completionBlock(error);
- return;
- }
- completionBlock(nil);
- }];
}
-@end
+@end
\ No newline at end of file
diff --git a/src/main/java/com/wordnik/swagger/codegen/Codegen.java b/src/main/java/com/wordnik/swagger/codegen/Codegen.java
index 96872fb2efe..8d6282fa566 100644
--- a/src/main/java/com/wordnik/swagger/codegen/Codegen.java
+++ b/src/main/java/com/wordnik/swagger/codegen/Codegen.java
@@ -61,6 +61,8 @@ public class Codegen extends DefaultGenerator {
static CodegenConfig getConfig(String name) {
if("objc".equals(name))
return new ObjcClientCodegen();
+ else if("android".equals(name))
+ return new AndroidClientCodegen();
else if("java".equals(name))
return new JavaClientCodegen();
else if("jaxrs".equals(name))
diff --git a/src/main/java/com/wordnik/swagger/codegen/CodegenModel.java b/src/main/java/com/wordnik/swagger/codegen/CodegenModel.java
index 4cd6c74dd9e..7dcb491dda1 100644
--- a/src/main/java/com/wordnik/swagger/codegen/CodegenModel.java
+++ b/src/main/java/com/wordnik/swagger/codegen/CodegenModel.java
@@ -5,7 +5,7 @@ import com.wordnik.swagger.models.properties.*;
import java.util.*;
-class CodegenModel {
+public class CodegenModel {
public String parent;
public String name, classname, description;
public String defaultValue;
diff --git a/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java b/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java
index 0f867e91149..71aa90917c6 100644
--- a/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java
+++ b/src/main/java/com/wordnik/swagger/codegen/DefaultCodegen.java
@@ -155,6 +155,7 @@ public class DefaultCodegen {
typeMapping = new HashMap();
typeMapping.put("array", "List");
+ typeMapping.put("map", "Map");
typeMapping.put("List", "List");
typeMapping.put("boolean", "Boolean");
typeMapping.put("string", "String");
@@ -189,8 +190,10 @@ public class DefaultCodegen {
importMapping.put("File", "java.io.File");
importMapping.put("Date", "java.util.Date");
importMapping.put("Timestamp", "java.sql.Timestamp");
- importMapping.put("Array", "java.util.*");
- importMapping.put("ArrayList", "java.util.*");
+ importMapping.put("Map", "java.util.Map");
+ importMapping.put("HashMap", "java.util.HashMap");
+ importMapping.put("Array", "java.util.List");
+ importMapping.put("ArrayList", "java.util.ArrayList");
importMapping.put("List", "java.util.*");
importMapping.put("Set", "java.util.*");
importMapping.put("DateTime", "org.joda.time.*");
@@ -231,8 +234,11 @@ public class DefaultCodegen {
return "null";
else if (p instanceof LongProperty)
return "null";
- else if (p instanceof MapProperty)
- return "null";
+ else if (p instanceof MapProperty) {
+ MapProperty ap = (MapProperty) p;
+ String inner = getSwaggerType(ap.getAdditionalProperties());
+ return "new HashMap() ";
+ }
else if (p instanceof ArrayProperty) {
ArrayProperty ap = (ArrayProperty) p;
String inner = getSwaggerType(ap.getItems());
@@ -329,13 +335,22 @@ public class DefaultCodegen {
}
else {
ModelImpl impl = (ModelImpl) model;
+ // Json.prettyPrint(impl);
for(String key: impl.getProperties().keySet()) {
Property prop = impl.getProperties().get(key);
+
if(prop == null) {
System.out.println("null property for " + key);
}
else {
CodegenProperty cp = fromProperty(key, prop);
+ cp.required = false;
+ if(impl.getRequired() != null) {
+ for(String req : impl.getRequired()) {
+ if(key.equals(req))
+ cp.required = true;
+ }
+ }
if(cp.complexType != null && !defaultIncludes.contains(cp.complexType)) {
m.imports.add(cp.complexType);
}
@@ -363,7 +378,6 @@ public class DefaultCodegen {
}
}
}
-
return m;
}
@@ -377,7 +391,6 @@ public class DefaultCodegen {
property.setter = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
property.defaultValue = toDefaultValue(p);
- property.required = p.getRequired();
String type = getSwaggerType(p);
@@ -419,7 +432,17 @@ public class DefaultCodegen {
ArrayProperty ap = (ArrayProperty) p;
CodegenProperty cp = fromProperty("inner", ap.getItems());
- property.baseType = toInstantiationType(p);
+ property.baseType = getSwaggerType(p);
+ if(!languageSpecificPrimitives.contains(cp.baseType))
+ property.complexType = cp.baseType;
+ }
+ else if(p instanceof MapProperty) {
+ property.isContainer = true;
+ property.containerType = "map";
+ MapProperty ap = (MapProperty) p;
+ CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties());
+
+ property.baseType = getSwaggerType(p);
if(!languageSpecificPrimitives.contains(cp.baseType))
property.complexType = cp.baseType;
}
@@ -606,10 +629,10 @@ public class DefaultCodegen {
ArrayModel impl = (ArrayModel) model;
CodegenModel cm = fromModel(bp.getName(), impl);
// get the single property
- CodegenProperty cp = fromProperty("inner", impl.getItems());
-
+ ArrayProperty ap = new ArrayProperty().items(impl.getItems());
+ CodegenProperty cp = fromProperty("inner", ap);
imports.add(cp.baseType);
- p.dataType = getTypeDeclaration(typeMapping.get(impl.getType()));
+ p.dataType = cp.datatype;
p.isContainer = true;
}
else{
diff --git a/src/main/java/com/wordnik/swagger/codegen/languages/JavaClientCodegen.java b/src/main/java/com/wordnik/swagger/codegen/languages/JavaClientCodegen.java
index 8ec271fad1e..1bf0d5e92f8 100644
--- a/src/main/java/com/wordnik/swagger/codegen/languages/JavaClientCodegen.java
+++ b/src/main/java/com/wordnik/swagger/codegen/languages/JavaClientCodegen.java
@@ -69,7 +69,10 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
}
else if (p instanceof MapProperty) {
- throw new RuntimeException("not supported yet");
+ MapProperty mp = (MapProperty) p;
+ Property inner = mp.getAdditionalProperties();
+
+ return getSwaggerType(p) + "";
}
return super.getTypeDeclaration(p);
}
diff --git a/src/main/java/com/wordnik/swagger/codegen/languages/ObjcClientCodegen.java b/src/main/java/com/wordnik/swagger/codegen/languages/ObjcClientCodegen.java
index 1182575c093..79be19f8091 100644
--- a/src/main/java/com/wordnik/swagger/codegen/languages/ObjcClientCodegen.java
+++ b/src/main/java/com/wordnik/swagger/codegen/languages/ObjcClientCodegen.java
@@ -10,6 +10,7 @@ import java.io.File;
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
protected Set foundationClasses = new HashSet();
protected String sourceFolder = "client";
+ protected static String PREFIX = "SWG";
public ObjcClientCodegen() {
super();
@@ -22,7 +23,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
modelPackage = "";
defaultIncludes = new HashSet(
- Arrays.asList("bool",
+ Arrays.asList(
+ "bool",
"int",
"NSString",
"NSObject",
@@ -124,7 +126,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
return Character.toUpperCase(type.charAt(0)) + type.substring(1);
}
else {
- return "SWG" + Character.toUpperCase(type.charAt(0)) + type.substring(1);
+ return PREFIX + Character.toUpperCase(type.charAt(0)) + type.substring(1);
}
}
@@ -149,16 +151,16 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toModelFilename(String name) {
- return "SWG" + initialCaps(name);
+ return PREFIX + initialCaps(name);
}
@Override
public String toApiName(String name) {
- return "SWG" + initialCaps(name) + "Api";
+ return PREFIX + initialCaps(name) + "Api";
}
public String toApiFilename(String name) {
- return "SWG" + initialCaps(name) + "Api";
+ return PREFIX + initialCaps(name) + "Api";
}
@Override
diff --git a/src/main/resources/JavaJaxRS/model.mustache b/src/main/resources/JavaJaxRS/model.mustache
index 49406020a0b..3836a0ad927 100644
--- a/src/main/resources/JavaJaxRS/model.mustache
+++ b/src/main/resources/JavaJaxRS/model.mustache
@@ -2,16 +2,18 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
+
+import com.wordnik.swagger.annotations.*;
{{#models}}
{{#model}}{{#description}}
/**
* {{description}}
**/{{/description}}
+@ApiModel(description = "{{{description}}}")
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}}
/**{{#description}}
- * {{{description}}}{{/description}}
- * required: {{required}}{{#minimum}}
+ * {{{description}}}{{/description}}{{#minimum}}
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
* maximum: {{maximum}}{{/maximum}}
**/
@@ -20,7 +22,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}
//{{^min}}public enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };
{{/min}}{{/allowableValues}}{{/vars}}
- {{#vars}}public {{{datatype}}} {{getter}}() {
+ {{#vars}}
+ @ApiModelProperty(required = {{required}}, value = "{{{description}}}")
+ public {{{datatype}}} {{getter}}() {
return {{name}};
}
public void {{setter}}({{{datatype}}} {{name}}) {
diff --git a/src/main/resources/objc/model-body.mustache b/src/main/resources/objc/model-body.mustache
index 190d9bfc308..4d739ed6473 100644
--- a/src/main/resources/objc/model-body.mustache
+++ b/src/main/resources/objc/model-body.mustache
@@ -16,7 +16,8 @@
{
self = [super init];
if(self) {
- {{#vars}}{{#isPrimitiveType}}_{{name}} = dict[@"{{baseName}}"];{{/isPrimitiveType}}{{#complexType}}
+ {{#vars}}{{#isPrimitiveType}}_{{name}} = dict[@"{{baseName}}"];{{/isPrimitiveType}}
+ {{#complexType}}
id {{name}}_dict = dict[@"{{baseName}}"];{{#isContainer}}
if([{{name}}_dict isKindOfClass:[NSArray class]]) {
NSMutableArray * objs = [[NSMutableArray alloc] initWithCapacity:[(NSArray*){{name}}_dict count]];