Skip to content

Commit 6d8d389

Browse files
committed
Fix long standing port handing of the "repeated" attribute.
In all cases, we had coded assuming the value would only be present if it is "true", that happened to work, but we really should have been looking at the boolean version of the string incase something served up `"repeated: false`.
1 parent dc3b18b commit 6d8d389

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Tools/ServiceGenerator/SGGenerator.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ - (NSString *)generateQueryPropertyBlock:(NSArray *)paramSchema
16141614
for (GTLRDiscovery_JsonSchema *param in paramSchema) {
16151615
// TODO: see the note in buildParameterLists: about how there could
16161616
// be arrays that don't make it into the uniqueParameters list.
1617-
if (param.repeated || [param.type isEqual:@"array"]) {
1617+
if (param.repeated.boolValue || [param.type isEqual:@"array"]) {
16181618
NSString *objcType = nil;
16191619
NSString *itemsClassName = nil;
16201620
[param sg_getQueryParamObjCType:&objcType
@@ -4479,7 +4479,7 @@ - (void)sg_getObjectParamObjCType:(NSString **)objcType
44794479
NSString *schemaType = resolvedSchema.type;
44804480
NSString *schemaFormat = resolvedSchema.format;
44814481

4482-
NSAssert(resolvedSchema.repeated == nil,
4482+
NSAssert(!resolvedSchema.repeated.boolValue,
44834483
@"Object scheme should use 'type' of 'array' and not 'repeated' : true");
44844484

44854485
// Look it up...
@@ -4547,12 +4547,12 @@ - (void)sg_getQueryParamObjCType:(NSString **)objcType
45474547
// default values and we don't need to communicate the "removal" of some
45484548
// property, we can use raw NSInteger, BOOL, etc. for the values. So only
45494549
// need objects form of it is repeating.
4550-
SGTypeInfo *typeInfo = LookupTypeInfo(self.type, self.format, self.repeated);
4550+
SGTypeInfo *typeInfo = LookupTypeInfo(self.type, self.format, self.repeated.boolValue);
45514551
NSAssert(typeInfo != nil,
45524552
@"Looking at parameter '%@:%@', found a type/format pair of '%@/%@', and don't how to map that to Objective-C",
45534553
self.sg_method.sg_name, self.sg_name, self.type, self.format);
45544554

4555-
if (self.repeated) {
4555+
if (self.repeated.boolValue) {
45564556
// Repeating means it's an array.
45574557
if (asPointer) *asPointer = YES;
45584558
if (objcPropertySemantics) *objcPropertySemantics = @"strong";

0 commit comments

Comments
 (0)