From 0db4b323848e6008b83f62d232ceb9279bf0ed51 Mon Sep 17 00:00:00 2001 From: Andrea Rossi Date: Sat, 7 Oct 2017 07:44:35 +0200 Subject: [PATCH] [objc] Let the developer specify the timezone to be used for date serialisation (#6628) * [objc] Update deployment target to 8.0 Updates the test project deployment target to 8.0, as that's the lowest supported by the latest XCode. * [objc] Update petstore tests based on current master Makes sure the tests are based on the latest version of master. * [objc] Allow specifying the serialization timezone Now it's possible to specify the timezone used for serializing dates --- .../objc/DefaultConfiguration-header.mustache | 5 +++++ ...JSONValueTransformer+ISO8601-body.mustache | 6 ++++++ .../resources/objc/Sanitizer-body.mustache | 10 +++++---- .../resources/objc/Sanitizer-header.mustache | 5 +++++ .../objc/.swagger-codegen/VERSION | 1 + .../objc/SwaggerClient/Api/SWGFakeApi.h | 2 +- .../Core/JSONValueTransformer+ISO8601.m | 6 ++++++ .../objc/SwaggerClient/Core/SWGApiClient.h | 21 +++++++++++++++++++ .../SwaggerClient/Core/SWGConfiguration.h | 2 +- .../Core/SWGDefaultConfiguration.h | 5 +++++ .../objc/SwaggerClient/Core/SWGSanitizer.h | 5 +++++ .../objc/SwaggerClient/Core/SWGSanitizer.m | 10 +++++---- .../objc/SwaggerClient/Model/SWGReturn.h | 1 + .../Core/JSONValueTransformer+ISO8601.m | 6 ++++++ .../Core/SWGDefaultConfiguration.h | 5 +++++ .../SwaggerClient/Core/SWGSanitizer.h | 5 +++++ .../SwaggerClient/Core/SWGSanitizer.m | 10 +++++---- .../Core/JSONValueTransformer+ISO8601.m | 6 ++++++ .../Core/SWGDefaultConfiguration.h | 5 +++++ .../default/SwaggerClient/Core/SWGSanitizer.h | 5 +++++ .../default/SwaggerClient/Core/SWGSanitizer.m | 10 +++++---- .../SwaggerClient.xcodeproj/project.pbxproj | 4 ++-- .../Tests/SWGApiClientTest.m | 4 ++-- 23 files changed, 117 insertions(+), 22 deletions(-) create mode 100644 samples/client/petstore-security-test/objc/.swagger-codegen/VERSION diff --git a/modules/swagger-codegen/src/main/resources/objc/DefaultConfiguration-header.mustache b/modules/swagger-codegen/src/main/resources/objc/DefaultConfiguration-header.mustache index fc1f88f3865..438ddb5b38c 100644 --- a/modules/swagger-codegen/src/main/resources/objc/DefaultConfiguration-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/DefaultConfiguration-header.mustache @@ -74,6 +74,11 @@ */ @property (nonatomic) NSString *sslCaCert; +/** + * The time zone to use for date serialization + */ +@property (nonatomic) NSTimeZone *serializationTimeZone; + /** * Sets API key * diff --git a/modules/swagger-codegen/src/main/resources/objc/JSONValueTransformer+ISO8601-body.mustache b/modules/swagger-codegen/src/main/resources/objc/JSONValueTransformer+ISO8601-body.mustache index b544a1dae58..a43b33a613a 100644 --- a/modules/swagger-codegen/src/main/resources/objc/JSONValueTransformer+ISO8601-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/JSONValueTransformer+ISO8601-body.mustache @@ -1,5 +1,6 @@ #import #import "JSONValueTransformer+ISO8601.h" +#import "{{classPrefix}}Sanitizer.h" @implementation JSONValueTransformer (ISO8601) @@ -8,4 +9,9 @@ return [NSDate dateWithISO8601String:string]; } +- (NSString *)JSONObjectFromNSDate:(NSDate *)date +{ + return [{{classPrefix}}Sanitizer dateToString:date]; +} + @end diff --git a/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache index 465633a902c..e1f758ce6b2 100644 --- a/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-body.mustache @@ -1,6 +1,7 @@ #import "{{classPrefix}}Sanitizer.h" #import "{{classPrefix}}Object.h" #import "{{classPrefix}}QueryParamCollection.h" +#import "{{classPrefix}}DefaultConfiguration.h" #import NSString * const k{{classPrefix}}ApplicationJSONType = @"application/json"; @@ -63,7 +64,7 @@ NSString * {{classPrefix}}PercentEscapedStringFromString(NSString *string) { return object; } else if ([object isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:object]; + return [{{classPrefix}}Sanitizer dateToString:object]; } else if ([object isKindOfClass:[NSArray class]]) { NSArray *objectArray = object; @@ -107,7 +108,7 @@ NSString * {{classPrefix}}PercentEscapedStringFromString(NSString *string) { return [param stringValue]; } else if ([param isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:param]; + return [{{classPrefix}}Sanitizer dateToString:param]; } else if ([param isKindOfClass:[NSArray class]]) { NSMutableArray *mutableParam = [NSMutableArray array]; @@ -125,8 +126,9 @@ NSString * {{classPrefix}}PercentEscapedStringFromString(NSString *string) { } } -- (NSString *)dateParameterToString:(id)param { - return [param ISO8601String]; ++ (NSString *)dateToString:(id)date { + NSTimeZone* timeZone = [{{classPrefix}}DefaultConfiguration sharedConfig].serializationTimeZone; + return [date ISO8601StringWithTimeZone:timeZone usingCalendar:nil]; } #pragma mark - Utility Methods diff --git a/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache index b6e77edb3f3..4ad7f10a234 100644 --- a/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/Sanitizer-header.mustache @@ -20,6 +20,11 @@ extern NSString * const k{{classPrefix}}ApplicationJSONType; */ - (NSString *) parameterToString: (id) param; +/** + * Convert date to NSString + */ ++ (NSString *)dateToString:(id)date; + /** * Detects Accept header from accepts NSArray * diff --git a/samples/client/petstore-security-test/objc/.swagger-codegen/VERSION b/samples/client/petstore-security-test/objc/.swagger-codegen/VERSION new file mode 100644 index 00000000000..f9f7450d135 --- /dev/null +++ b/samples/client/petstore-security-test/objc/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Api/SWGFakeApi.h b/samples/client/petstore-security-test/objc/SwaggerClient/Api/SWGFakeApi.h index bea37df4acb..bb864a4a4cf 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Api/SWGFakeApi.h +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Api/SWGFakeApi.h @@ -29,7 +29,7 @@ extern NSInteger kSWGFakeApiMissingParamErrorCode; /// /// code:400 message:"To test code injection *_/ ' \" =end -- \\r\\n \\n \\r" /// -/// @return +/// @return void -(NSURLSessionTask*) testCodeInjectEndRnNRWithTestCodeInjectEndRnNR: (NSString*) testCodeInjectEndRnNR completionHandler: (void (^)(NSError* error)) handler; diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.m b/samples/client/petstore-security-test/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.m index b544a1dae58..0f458f0af01 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.m +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Core/JSONValueTransformer+ISO8601.m @@ -1,5 +1,6 @@ #import #import "JSONValueTransformer+ISO8601.h" +#import "SWGSanitizer.h" @implementation JSONValueTransformer (ISO8601) @@ -8,4 +9,9 @@ - (NSDate *) NSDateFromNSString:(NSString *)string return [NSDate dateWithISO8601String:string]; } +- (NSString *)JSONObjectFromNSDate:(NSDate *)date +{ + return [SWGSanitizer dateToString:date]; +} + @end diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGApiClient.h b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGApiClient.h index f4c35e17a52..a828f11dcaf 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGApiClient.h +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGApiClient.h @@ -34,6 +34,27 @@ extern NSString *const SWGResponseObjectErrorKey; @property(nonatomic, strong) id sanitizer; +/** + * Gets if the client is unreachable + * + * @return The client offline state + */ ++(BOOL) getOfflineState; + +/** + * Sets the client reachability, this may be overridden by the reachability manager if reachability changes + * + * @param status The client reachability status. + */ ++(void) setReachabilityStatus:(AFNetworkReachabilityStatus) status; + +/** + * Gets the client reachability + * + * @return The client reachability. + */ ++(AFNetworkReachabilityStatus) getReachabilityStatus; + @property (nonatomic, strong) NSDictionary< NSString *, AFHTTPRequestSerializer *>* requestSerializerForContentType; /** diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGConfiguration.h b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGConfiguration.h index a22ceb78391..85aed9fc8ff 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGConfiguration.h +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGConfiguration.h @@ -86,4 +86,4 @@ static NSString * const kSWGAPIVersion = @"1.0.0"; */ @property (readonly, nonatomic, strong) NSDictionary *defaultHeaders; -@end \ No newline at end of file +@end diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGDefaultConfiguration.h b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGDefaultConfiguration.h index 21542307ae5..767acf2a1b3 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGDefaultConfiguration.h +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGDefaultConfiguration.h @@ -85,6 +85,11 @@ */ @property (nonatomic) NSString *sslCaCert; +/** + * The time zone to use for date serialization + */ +@property (nonatomic) NSTimeZone *serializationTimeZone; + /** * Sets API key * diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.h b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.h index 1ede89f6035..5a8b57777bc 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.h +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.h @@ -31,6 +31,11 @@ extern NSString * const kSWGApplicationJSONType; */ - (NSString *) parameterToString: (id) param; +/** + * Convert date to NSString + */ ++ (NSString *)dateToString:(id)date; + /** * Detects Accept header from accepts NSArray * diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.m b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.m index 49ff6ed014a..1b3e0e10b0d 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.m +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Core/SWGSanitizer.m @@ -1,6 +1,7 @@ #import "SWGSanitizer.h" #import "SWGObject.h" #import "SWGQueryParamCollection.h" +#import "SWGDefaultConfiguration.h" #import NSString * const kSWGApplicationJSONType = @"application/json"; @@ -63,7 +64,7 @@ - (id) sanitizeForSerialization:(id) object { return object; } else if ([object isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:object]; + return [SWGSanitizer dateToString:object]; } else if ([object isKindOfClass:[NSArray class]]) { NSArray *objectArray = object; @@ -107,7 +108,7 @@ - (NSString *) parameterToString:(id)param { return [param stringValue]; } else if ([param isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:param]; + return [SWGSanitizer dateToString:param]; } else if ([param isKindOfClass:[NSArray class]]) { NSMutableArray *mutableParam = [NSMutableArray array]; @@ -125,8 +126,9 @@ - (NSString *) parameterToString:(id)param { } } -- (NSString *)dateParameterToString:(id)param { - return [param ISO8601String]; ++ (NSString *)dateToString:(id)date { + NSTimeZone* timeZone = [SWGDefaultConfiguration sharedConfig].serializationTimeZone; + return [date ISO8601StringWithTimeZone:timeZone usingCalendar:nil]; } #pragma mark - Utility Methods diff --git a/samples/client/petstore-security-test/objc/SwaggerClient/Model/SWGReturn.h b/samples/client/petstore-security-test/objc/SwaggerClient/Model/SWGReturn.h index ee9a261859e..ced5718bf0b 100644 --- a/samples/client/petstore-security-test/objc/SwaggerClient/Model/SWGReturn.h +++ b/samples/client/petstore-security-test/objc/SwaggerClient/Model/SWGReturn.h @@ -16,6 +16,7 @@ + @protocol SWGReturn @end diff --git a/samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.m index b544a1dae58..0f458f0af01 100644 --- a/samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.m +++ b/samples/client/petstore/objc/core-data/SwaggerClient/Core/JSONValueTransformer+ISO8601.m @@ -1,5 +1,6 @@ #import #import "JSONValueTransformer+ISO8601.h" +#import "SWGSanitizer.h" @implementation JSONValueTransformer (ISO8601) @@ -8,4 +9,9 @@ - (NSDate *) NSDateFromNSString:(NSString *)string return [NSDate dateWithISO8601String:string]; } +- (NSString *)JSONObjectFromNSDate:(NSDate *)date +{ + return [SWGSanitizer dateToString:date]; +} + @end diff --git a/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGDefaultConfiguration.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGDefaultConfiguration.h index d3e02965656..bd56b94f4e6 100644 --- a/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGDefaultConfiguration.h +++ b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGDefaultConfiguration.h @@ -85,6 +85,11 @@ */ @property (nonatomic) NSString *sslCaCert; +/** + * The time zone to use for date serialization + */ +@property (nonatomic) NSTimeZone *serializationTimeZone; + /** * Sets API key * diff --git a/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.h b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.h index 28e84d83714..a896caea209 100644 --- a/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.h +++ b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.h @@ -31,6 +31,11 @@ extern NSString * const kSWGApplicationJSONType; */ - (NSString *) parameterToString: (id) param; +/** + * Convert date to NSString + */ ++ (NSString *)dateToString:(id)date; + /** * Detects Accept header from accepts NSArray * diff --git a/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.m b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.m index 49ff6ed014a..1b3e0e10b0d 100644 --- a/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.m +++ b/samples/client/petstore/objc/core-data/SwaggerClient/Core/SWGSanitizer.m @@ -1,6 +1,7 @@ #import "SWGSanitizer.h" #import "SWGObject.h" #import "SWGQueryParamCollection.h" +#import "SWGDefaultConfiguration.h" #import NSString * const kSWGApplicationJSONType = @"application/json"; @@ -63,7 +64,7 @@ - (id) sanitizeForSerialization:(id) object { return object; } else if ([object isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:object]; + return [SWGSanitizer dateToString:object]; } else if ([object isKindOfClass:[NSArray class]]) { NSArray *objectArray = object; @@ -107,7 +108,7 @@ - (NSString *) parameterToString:(id)param { return [param stringValue]; } else if ([param isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:param]; + return [SWGSanitizer dateToString:param]; } else if ([param isKindOfClass:[NSArray class]]) { NSMutableArray *mutableParam = [NSMutableArray array]; @@ -125,8 +126,9 @@ - (NSString *) parameterToString:(id)param { } } -- (NSString *)dateParameterToString:(id)param { - return [param ISO8601String]; ++ (NSString *)dateToString:(id)date { + NSTimeZone* timeZone = [SWGDefaultConfiguration sharedConfig].serializationTimeZone; + return [date ISO8601StringWithTimeZone:timeZone usingCalendar:nil]; } #pragma mark - Utility Methods diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m b/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m index b544a1dae58..0f458f0af01 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/JSONValueTransformer+ISO8601.m @@ -1,5 +1,6 @@ #import #import "JSONValueTransformer+ISO8601.h" +#import "SWGSanitizer.h" @implementation JSONValueTransformer (ISO8601) @@ -8,4 +9,9 @@ - (NSDate *) NSDateFromNSString:(NSString *)string return [NSDate dateWithISO8601String:string]; } +- (NSString *)JSONObjectFromNSDate:(NSDate *)date +{ + return [SWGSanitizer dateToString:date]; +} + @end diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGDefaultConfiguration.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGDefaultConfiguration.h index d3e02965656..bd56b94f4e6 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGDefaultConfiguration.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGDefaultConfiguration.h @@ -85,6 +85,11 @@ */ @property (nonatomic) NSString *sslCaCert; +/** + * The time zone to use for date serialization + */ +@property (nonatomic) NSTimeZone *serializationTimeZone; + /** * Sets API key * diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h index 28e84d83714..a896caea209 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.h @@ -31,6 +31,11 @@ extern NSString * const kSWGApplicationJSONType; */ - (NSString *) parameterToString: (id) param; +/** + * Convert date to NSString + */ ++ (NSString *)dateToString:(id)date; + /** * Detects Accept header from accepts NSArray * diff --git a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m index 49ff6ed014a..1b3e0e10b0d 100644 --- a/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m +++ b/samples/client/petstore/objc/default/SwaggerClient/Core/SWGSanitizer.m @@ -1,6 +1,7 @@ #import "SWGSanitizer.h" #import "SWGObject.h" #import "SWGQueryParamCollection.h" +#import "SWGDefaultConfiguration.h" #import NSString * const kSWGApplicationJSONType = @"application/json"; @@ -63,7 +64,7 @@ - (id) sanitizeForSerialization:(id) object { return object; } else if ([object isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:object]; + return [SWGSanitizer dateToString:object]; } else if ([object isKindOfClass:[NSArray class]]) { NSArray *objectArray = object; @@ -107,7 +108,7 @@ - (NSString *) parameterToString:(id)param { return [param stringValue]; } else if ([param isKindOfClass:[NSDate class]]) { - return [self dateParameterToString:param]; + return [SWGSanitizer dateToString:param]; } else if ([param isKindOfClass:[NSArray class]]) { NSMutableArray *mutableParam = [NSMutableArray array]; @@ -125,8 +126,9 @@ - (NSString *) parameterToString:(id)param { } } -- (NSString *)dateParameterToString:(id)param { - return [param ISO8601String]; ++ (NSString *)dateToString:(id)date { + NSTimeZone* timeZone = [SWGDefaultConfiguration sharedConfig].serializationTimeZone; + return [date ISO8601StringWithTimeZone:timeZone usingCalendar:nil]; } #pragma mark - Utility Methods diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj index a7eb97a8bcb..c2b960038e1 100644 --- a/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj +++ b/samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/project.pbxproj @@ -534,7 +534,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -567,7 +567,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; diff --git a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/SWGApiClientTest.m b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/SWGApiClientTest.m index 7e78cae4840..b6bee5a719a 100644 --- a/samples/client/petstore/objc/default/SwaggerClientTests/Tests/SWGApiClientTest.m +++ b/samples/client/petstore/objc/default/SwaggerClientTests/Tests/SWGApiClientTest.m @@ -154,11 +154,11 @@ - (void)testSanitizeForSerialization { // NSDate data = [NSDate dateWithISO8601String:@"1997-07-16T19:20:30.45+01:00"]; result = [self.apiClient.sanitizer sanitizeForSerialization:data]; - XCTAssertEqualObjects(result, [data ISO8601String]); + XCTAssertEqualObjects(result, [data ISO8601StringWithTimeZone:nil usingCalendar:nil]); data = [NSDate dateWithISO8601String:@"1997-07-16"]; result = [self.apiClient.sanitizer sanitizeForSerialization:data]; - XCTAssertEqualObjects(result, [data ISO8601String]); + XCTAssertEqualObjects(result, [data ISO8601StringWithTimeZone:nil usingCalendar:nil]); // model NSDictionary *petDict = @{@"id": @1, @"name": @"monkey",