/* Options: Date: 2024-05-14 18:45:51 SwiftVersion: 5.0 Version: 6.111 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://test.servicestack.net //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: HelloWithInheritance.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack public class HelloWithInheritance : HelloBase, IReturn { public typealias Return = HelloWithInheritanceResponse public var name:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case name } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) name = try container.decodeIfPresent(String.self, forKey: .name) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if name != nil { try container.encode(name, forKey: .name) } } } public class HelloWithInheritanceResponse : HelloResponseBase { public var result:String required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case result } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) result = try container.decodeIfPresent(String.self, forKey: .result) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if result != nil { try container.encode(result, forKey: .result) } } } public class HelloBase : Codable { public var id:Int required public init(){} } public class HelloResponseBase : Codable { public var refId:Int required public init(){} }