File tree Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 97
97
*/
98
98
- (void )addProperty : (NSString *)name ;
99
99
100
+ /* *
101
+ * Add a simple property with custom json name.
102
+ *
103
+ * @param name The name of the property in the class.
104
+ * @param jsonName The label of the property in JSON.
105
+ */
106
+ - (void )addProperty : (NSString *)name withJsonName : (NSString *)json ;
107
+
100
108
/* *
101
109
* Add a simple property with custom transform object.
102
110
*
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ - (void)addProperty:(NSString*)name {
53
53
[self addProperty: name withDescription: [[JSONAPIPropertyDescriptor alloc ] initWithJsonName: name]];
54
54
}
55
55
56
+ - (void )addProperty : (NSString *)name withJsonName : (NSString *)json
57
+ {
58
+ [self addProperty: name withDescription: [[JSONAPIPropertyDescriptor alloc ] initWithJsonName: json]];
59
+ }
60
+
56
61
- (void )addProperty : (NSString *)name withDescription : (JSONAPIPropertyDescriptor*)description {
57
62
[[self properties ] setValue: description forKey: name];
58
63
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ + (JSONAPIResourceDescriptor*)descriptor {
25
25
26
26
[__descriptor setIdProperty: @" ID" ];
27
27
28
- [__descriptor addProperty: @" text" withDescription: [[JSONAPIPropertyDescriptor alloc ] initWithJsonName: @" body" ] ];
28
+ [__descriptor addProperty: @" text" withJsonName: @" body" ];
29
29
30
30
[__descriptor hasOne: [PeopleResource class ] withName: @" author" ];
31
31
});
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ + (JSONAPIResourceDescriptor*)descriptor {
23
23
[__descriptor setIdProperty: @" ID" ];
24
24
25
25
[__descriptor addProperty: @" firstName" withDescription: [[JSONAPIPropertyDescriptor alloc ] initWithJsonName: @" first-name" ]];
26
- [__descriptor addProperty: @" lastName" withDescription: [[JSONAPIPropertyDescriptor alloc ] initWithJsonName: @" last-name" ] ];
26
+ [__descriptor addProperty: @" lastName" withJsonName: @" last-name" ];
27
27
[__descriptor addProperty: @" twitter" ];
28
28
});
29
29
You can’t perform that action at this time.
0 commit comments