mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Update model body template in objc client.
* Add some comments.
This commit is contained in:
parent
f9ad16e7aa
commit
37c79525f7
@ -4,11 +4,20 @@
|
||||
|
||||
@implementation {{classname}}
|
||||
|
||||
/**
|
||||
* Maps json key to property name.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ {{#vars}}@"{{baseName}}": @"{{name}}"{{#hasMore}}, {{/hasMore}}{{/vars}} }];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the property with the given name is optional.
|
||||
* If `propertyName` is optional, then return `YES`, or return `NO`.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[{{#vars}}{{^required}}@"{{name}}"{{#hasMore}}, {{/hasMore}}{{/required}}{{/vars}}];
|
||||
@ -21,6 +30,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that represents the properties json of the model.
|
||||
* This method will be called when logging model object using `NSLog`.
|
||||
*/
|
||||
- (NSString *)description {
|
||||
return [[self toDictionary] description];
|
||||
}
|
||||
|
@ -2,11 +2,20 @@
|
||||
|
||||
@implementation SWGCategory
|
||||
|
||||
/**
|
||||
* Maps json key to property name.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the property with the given name is optional.
|
||||
* If `propertyName` is optional, then return `YES`, or return `NO`.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[@"_id", @"name"];
|
||||
@ -19,6 +28,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that represents the properties json of the model.
|
||||
* This method will be called when logging model object using `NSLog`.
|
||||
*/
|
||||
- (NSString *)description {
|
||||
return [[self toDictionary] description];
|
||||
}
|
||||
|
@ -2,11 +2,20 @@
|
||||
|
||||
@implementation SWGOrder
|
||||
|
||||
/**
|
||||
* Maps json key to property name.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"petId": @"petId", @"quantity": @"quantity", @"shipDate": @"shipDate", @"status": @"status", @"complete": @"complete" }];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the property with the given name is optional.
|
||||
* If `propertyName` is optional, then return `YES`, or return `NO`.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[@"_id", @"petId", @"quantity", @"shipDate", @"status", @"complete"];
|
||||
@ -19,6 +28,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that represents the properties json of the model.
|
||||
* This method will be called when logging model object using `NSLog`.
|
||||
*/
|
||||
- (NSString *)description {
|
||||
return [[self toDictionary] description];
|
||||
}
|
||||
|
@ -2,11 +2,20 @@
|
||||
|
||||
@implementation SWGPet
|
||||
|
||||
/**
|
||||
* Maps json key to property name.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"category": @"category", @"name": @"name", @"photoUrls": @"photoUrls", @"tags": @"tags", @"status": @"status" }];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the property with the given name is optional.
|
||||
* If `propertyName` is optional, then return `YES`, or return `NO`.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[@"_id", @"category", @"tags", @"status"];
|
||||
@ -19,6 +28,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that represents the properties json of the model.
|
||||
* This method will be called when logging model object using `NSLog`.
|
||||
*/
|
||||
- (NSString *)description {
|
||||
return [[self toDictionary] description];
|
||||
}
|
||||
|
@ -2,11 +2,20 @@
|
||||
|
||||
@implementation SWGTag
|
||||
|
||||
/**
|
||||
* Maps json key to property name.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"name": @"name" }];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the property with the given name is optional.
|
||||
* If `propertyName` is optional, then return `YES`, or return `NO`.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[@"_id", @"name"];
|
||||
@ -19,6 +28,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that represents the properties json of the model.
|
||||
* This method will be called when logging model object using `NSLog`.
|
||||
*/
|
||||
- (NSString *)description {
|
||||
return [[self toDictionary] description];
|
||||
}
|
||||
|
@ -2,11 +2,20 @@
|
||||
|
||||
@implementation SWGUser
|
||||
|
||||
/**
|
||||
* Maps json key to property name.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (JSONKeyMapper *)keyMapper
|
||||
{
|
||||
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"id": @"_id", @"username": @"username", @"firstName": @"firstName", @"lastName": @"lastName", @"email": @"email", @"password": @"password", @"phone": @"phone", @"userStatus": @"userStatus" }];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the property with the given name is optional.
|
||||
* If `propertyName` is optional, then return `YES`, or return `NO`.
|
||||
* This method is used by `JSONModel`.
|
||||
*/
|
||||
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
||||
{
|
||||
NSArray *optionalProperties = @[@"_id", @"username", @"firstName", @"lastName", @"email", @"password", @"phone", @"userStatus"];
|
||||
@ -19,6 +28,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that represents the properties json of the model.
|
||||
* This method will be called when logging model object using `NSLog`.
|
||||
*/
|
||||
- (NSString *)description {
|
||||
return [[self toDictionary] description];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user