- Remove petsotre demo leftovers

- Moved description method to basic class
This commit is contained in:
Mateusz Mackowiak
2016-05-06 12:13:34 +02:00
parent 385bf6d9ea
commit fa68f84ec6
19 changed files with 43 additions and 491 deletions

View File

@@ -1,4 +1,13 @@
#import "{{classPrefix}}Object.h"
@implementation {{classPrefix}}Object
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -6,13 +6,11 @@
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
{{#vars}}{{#defaultValue}}self.{{name}} = {{{defaultValue}}};
{{/defaultValue}}{{/vars}}
}
return self;
}
@@ -22,7 +20,6 @@
*/
- (id)initWithDictionary:(NSDictionary *)dict error:(NSError *__autoreleasing *)err {
NSString * discriminatedClassName = [dict valueForKey:@"{{discriminator}}"];
if(discriminatedClassName == nil ){
@@ -45,8 +42,7 @@
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
}
@@ -55,24 +51,11 @@
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
+ (BOOL)propertyIsOptional:(NSString *)propertyName {
NSArray *optionalProperties = @[{{#vars}}{{^required}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/required}}{{/vars}}];
return [optionalProperties containsObject:propertyName];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
{{/model}}

View File

@@ -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-06T11:35:18.146+02:00
- Build date: 2016-05-06T12:20:47.112+02:00
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
## Requirements

View File

@@ -1,20 +0,0 @@
#import <Foundation/Foundation.h>
#import "SWGObject.h"
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@protocol SWG200Response
@end
@interface SWG200Response : SWGObject
@property(nonatomic) NSNumber* name;
@end

View File

@@ -1,51 +0,0 @@
#import "SWG200Response.h"
@implementation SWG200Response
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
/**
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name" }];
}
/**
* Indicates whether the property with the given name is optional.
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
NSArray *optionalProperties = @[@"name"];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -4,12 +4,10 @@
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
@@ -18,8 +16,7 @@
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
}
@@ -28,24 +25,11 @@
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
+ (BOOL)propertyIsOptional:(NSString *)propertyName {
NSArray *optionalProperties = @[@"_id", @"name"];
return [optionalProperties containsObject:propertyName];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -1,32 +0,0 @@
#import <Foundation/Foundation.h>
#import "SWGObject.h"
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
#import "SWGTag.h"
@protocol SWGInlineResponse200
@end
@interface SWGInlineResponse200 : SWGObject
@property(nonatomic) NSArray* /* NSString */ photoUrls;
@property(nonatomic) NSString* name;
@property(nonatomic) NSNumber* _id;
@property(nonatomic) NSObject* category;
@property(nonatomic) NSArray<SWGTag>* tags;
/* pet status in the store [optional]
*/
@property(nonatomic) NSString* status;
@end

View File

@@ -1,51 +0,0 @@
#import "SWGInlineResponse200.h"
@implementation SWGInlineResponse200
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
/**
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"photoUrls": @"photoUrls", @"name": @"name", @"id": @"_id", @"category": @"category", @"tags": @"tags", @"status": @"status" }];
}
/**
* Indicates whether the property with the given name is optional.
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
NSArray *optionalProperties = @[@"photoUrls", @"name", @"category", @"tags", @"status"];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -1,22 +0,0 @@
#import <Foundation/Foundation.h>
#import "SWGObject.h"
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@protocol SWGName
@end
@interface SWGName : SWGObject
@property(nonatomic) NSNumber* name;
@property(nonatomic) NSNumber* snakeCase;
@end

View File

@@ -1,51 +0,0 @@
#import "SWGName.h"
@implementation SWGName
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
/**
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name", @"snake_case": @"snakeCase" }];
}
/**
* Indicates whether the property with the given name is optional.
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
NSArray *optionalProperties = @[@"snakeCase"];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -1,4 +1,13 @@
#import "SWGObject.h"
@implementation SWGObject
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -4,12 +4,10 @@
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
@@ -18,8 +16,7 @@
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
}
@@ -28,24 +25,11 @@
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
+ (BOOL)propertyIsOptional:(NSString *)propertyName {
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"];
return [optionalProperties containsObject:propertyName];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -4,12 +4,10 @@
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
@@ -18,8 +16,7 @@
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
}
@@ -28,24 +25,11 @@
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
+ (BOOL)propertyIsOptional:(NSString *)propertyName {
NSArray *optionalProperties = @[@"_id", @"category", @"tags", @"status"];
return [optionalProperties containsObject:propertyName];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -1,20 +0,0 @@
#import <Foundation/Foundation.h>
#import "SWGObject.h"
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@protocol SWGReturn
@end
@interface SWGReturn : SWGObject
@property(nonatomic) NSNumber* _return;
@end

View File

@@ -1,51 +0,0 @@
#import "SWGReturn.h"
@implementation SWGReturn
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
/**
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"return": @"_return" }];
}
/**
* Indicates whether the property with the given name is optional.
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
NSArray *optionalProperties = @[@"_return"];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -1,20 +0,0 @@
#import <Foundation/Foundation.h>
#import "SWGObject.h"
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@protocol SWGSpecialModelName_
@end
@interface SWGSpecialModelName_ : SWGObject
@property(nonatomic) NSNumber* specialPropertyName;
@end

View File

@@ -1,51 +0,0 @@
#import "SWGSpecialModelName_.h"
@implementation SWGSpecialModelName_
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
/**
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"$special[property.name]": @"specialPropertyName" }];
}
/**
* Indicates whether the property with the given name is optional.
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
NSArray *optionalProperties = @[@"specialPropertyName"];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -4,12 +4,10 @@
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
@@ -18,8 +16,7 @@
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
}
@@ -28,24 +25,11 @@
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
+ (BOOL)propertyIsOptional:(NSString *)propertyName {
NSArray *optionalProperties = @[@"_id", @"name"];
return [optionalProperties containsObject:propertyName];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end

View File

@@ -4,12 +4,10 @@
- (instancetype)init {
self = [super init];
if (self) {
// initalise property's default value, if any
}
return self;
}
@@ -18,8 +16,7 @@
* Maps json key to property name.
* This method is used by `JSONModel`.
*/
+ (JSONKeyMapper *)keyMapper
{
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
}
@@ -28,24 +25,11 @@
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
* This method is used by `JSONModel`.
*/
+ (BOOL)propertyIsOptional:(NSString *)propertyName
{
+ (BOOL)propertyIsOptional:(NSString *)propertyName {
NSArray *optionalProperties = @[@"_id", @"username", @"firstName", @"lastName", @"email", @"password", @"phone", @"userStatus"];
return [optionalProperties containsObject:propertyName];
if ([optionalProperties containsObject:propertyName]) {
return YES;
}
else {
return NO;
}
}
/**
* Gets the string presentation of the object.
* This method will be called when logging model object using `NSLog`.
*/
- (NSString *)description {
return [[self toDictionary] description];
}
@end