Test case
1 generated file · +1 −0test/inputs/schema/optional-constraints.schema
Mschema-objective-cdefault / QTTopLevel.m+1 −0
| @@ -84,6 +84,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 84 | 84 | if (dict[@"optDouble"] && [dict[@"optDouble"] doubleValue] > 99.5) return nil; |
| 85 | 85 | if (dict[@"optInt"] && [dict[@"optInt"] doubleValue] < 0) return nil; |
| 86 | 86 | if (dict[@"optInt"] && [dict[@"optInt"] doubleValue] > 100) return nil; |
| 87 | + if (dict[@"optPattern"] && [dict[@"optPattern"] rangeOfString:@"^[a-z]+$" options:NSRegularExpressionSearch].location == NSNotFound) return nil; | |
| 87 | 88 | if (dict[@"reqZeroMin"] && [dict[@"reqZeroMin"] doubleValue] < 0) return nil; |
| 88 | 89 | if (dict[@"reqZeroMin"] && [dict[@"reqZeroMin"] doubleValue] > 100) return nil; |
| 89 | 90 | [self setValuesForKeysWithDictionary:dict]; |
Test case
1 generated file · +3 −0test/inputs/schema/pattern.schema
Mschema-objective-cdefault / QTTopLevel.m+3 −0
| @@ -78,6 +78,9 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 78 | 78 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 79 | 79 | { |
| 80 | 80 | if (self = [super init]) { |
| 81 | + if (dict[@"pattern1"] && [dict[@"pattern1"] rangeOfString:@"a[.]*" options:NSRegularExpressionSearch].location == NSNotFound) return nil; | |
| 82 | + if (dict[@"pattern2"] && [dict[@"pattern2"] rangeOfString:@"b[.]*" options:NSRegularExpressionSearch].location == NSNotFound) return nil; | |
| 83 | + if (dict[@"union"] && [dict[@"union"] rangeOfString:@"(b[.]*)|(c[.]*)" options:NSRegularExpressionSearch].location == NSNotFound) return nil; | |
| 81 | 84 | [self setValuesForKeysWithDictionary:dict]; |
| 82 | 85 | } |
| 83 | 86 | return self; |
Test case
1 generated file · +1 −0test/inputs/schema/renaming-bug.schema
Mschema-objective-cdefault / QTTopLevel.m+1 −0
| @@ -231,6 +231,7 @@ NSString *_Nullable QTTopLevelToJSON(QTTopLevel *topLevel, NSStringEncoding enco | ||
| 231 | 231 | - (instancetype)initWithJSONDictionary:(NSDictionary *)dict |
| 232 | 232 | { |
| 233 | 233 | if (self = [super init]) { |
| 234 | + if (dict[@"version"] && [dict[@"version"] rangeOfString:@"^\\d{1,5}.{1}\\d{1,5}.{1}\\d{1,5}$" options:NSRegularExpressionSearch].location == NSNotFound) return nil; | |
| 234 | 235 | [self setValuesForKeysWithDictionary:dict]; |
| 235 | 236 | _fruits = map(_fruits, λ(id x, [QTFruit fromJSONDictionary:x])); |
| 236 | 237 | _vehicles = map(_vehicles, λ(id x, [QTVehicle fromJSONDictionary:x])); |
No generated files match these filters.