forked from loafle/openapi-generator-original
		
	[swift5] Refactor encodeToJSON (#10961)
* Add protocol extension method * execute sample script * Add Packing.cmake * Revert "Add Packing.cmake" This reverts commit cb52547fe34c5d17dd83267daa259b7ee3ddd503. * Remove empty lines * Revert FILES * Add Packing.cmake
This commit is contained in:
		
							parent
							
								
									8e303150ae
								
							
						
					
					
						commit
						a620853216
					
				| @ -11,33 +11,15 @@ import AnyCodable | ||||
| import PromiseKit{{/usePromiseKit}}{{#useVapor}} | ||||
| import Vapor{{/useVapor}}{{^useVapor}} | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return CodableHelper.dateFormatter.string(from: self) | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| }{{/useVapor}}{{#generateModelAdditionalProperties}} | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
							
								
								
									
										24
									
								
								samples/client/petstore/c/Packing.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								samples/client/petstore/c/Packing.cmake
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| set(CPACK_PACKAGE_NAME lib${pkgName}) | ||||
| 
 | ||||
| set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) | ||||
| set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) | ||||
| set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) | ||||
| 
 | ||||
| set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_PACKAGE_DESCRIPTION_SUMMARY}) | ||||
| set(CPACK_PACKAGE_VENDOR ${PROJECT_PACKAGE_VENDOR}) | ||||
| set(CPACK_PACKAGE_CONTACT ${PROJECT_PACKAGE_CONTACT}) | ||||
| set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${PROJECT_PACKAGE_MAINTAINER}) | ||||
| 
 | ||||
| set(CPACK_VERBATIM_VARIABLES YES) | ||||
| 
 | ||||
| set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) | ||||
| 
 | ||||
| set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) | ||||
| 
 | ||||
| set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) | ||||
| 
 | ||||
| set(CPACK_DEB_COMPONENT_INSTALL YES) | ||||
| 
 | ||||
| set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) | ||||
| 
 | ||||
| include(CPack) | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| internal enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -10,33 +10,15 @@ import AnyCodable | ||||
| #endif | ||||
| import PromiseKit | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -84,18 +66,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension HTTPURLResponse { | ||||
|     var isStatusCodeSuccessful: Bool { | ||||
|         return (200 ..< 300).contains(statusCode) | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
| @ -9,33 +9,15 @@ import Foundation | ||||
| import AnyCodable | ||||
| #endif | ||||
| 
 | ||||
| extension Bool: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Float: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension Int32: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||
| } | ||||
| 
 | ||||
| extension Int64: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||
| } | ||||
| 
 | ||||
| extension Double: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| 
 | ||||
| extension String: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self } | ||||
| } | ||||
| extension Bool: JSONEncodable {} | ||||
| extension Float: JSONEncodable {} | ||||
| extension Int: JSONEncodable {} | ||||
| extension Int32: JSONEncodable {} | ||||
| extension Int64: JSONEncodable {} | ||||
| extension Double: JSONEncodable {} | ||||
| extension String: JSONEncodable {} | ||||
| extension URL: JSONEncodable {} | ||||
| extension UUID: JSONEncodable {} | ||||
| 
 | ||||
| extension RawRepresentable where RawValue: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { return self.rawValue } | ||||
| @ -83,18 +65,6 @@ extension Date: JSONEncodable { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension URL: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension UUID: JSONEncodable { | ||||
|     func encodeToJSON() -> Any { | ||||
|         return self.uuidString | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| extension String: CodingKey { | ||||
| 
 | ||||
|     public var stringValue: String { | ||||
|  | ||||
| @ -10,6 +10,10 @@ protocol JSONEncodable { | ||||
|     func encodeToJSON() -> Any | ||||
| } | ||||
| 
 | ||||
| extension JSONEncodable { | ||||
|     func encodeToJSON() -> Any { self } | ||||
| } | ||||
| 
 | ||||
| public enum ErrorResponse: Error { | ||||
|     case error(Int, Data?, URLResponse?, Error) | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user