forked from loafle/openapi-generator-original
Issue 3175 - using @objcMembers to expose all props and funcs to ObjC code when objcCompatible is requested. (#15188)
This commit is contained in:
parent
90b78fe97e
commit
6a67551ea5
@ -21,7 +21,7 @@ extension {{projectName}}API {
|
||||
|
||||
{{#description}}
|
||||
/** {{{.}}} */{{/description}}
|
||||
{{#objcCompatible}}@objc {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} {
|
||||
{{#objcCompatible}}@objcMembers {{/objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} class {{classname}}{{#objcCompatible}} : NSObject{{/objcCompatible}} {
|
||||
{{#operation}}
|
||||
{{#allParams}}
|
||||
{{#isEnum}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
||||
{{/objcCompatible}}{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}} {
|
||||
{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useJsonEncodable}}, JSONEncodable{{/useJsonEncodable}} {
|
||||
{{/objcCompatible}}
|
||||
|
||||
{{#allVars}}
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc open class AnotherFakeAPI : NSObject {
|
||||
@objcMembers open class AnotherFakeAPI : NSObject {
|
||||
|
||||
/**
|
||||
To test special tags
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc open class FakeAPI : NSObject {
|
||||
@objcMembers open class FakeAPI : NSObject {
|
||||
|
||||
/**
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc open class FakeClassnameTags123API : NSObject {
|
||||
@objcMembers open class FakeClassnameTags123API : NSObject {
|
||||
|
||||
/**
|
||||
To test class name in snake case
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc open class PetAPI : NSObject {
|
||||
@objcMembers open class PetAPI : NSObject {
|
||||
|
||||
/**
|
||||
Add a new pet to the store
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc open class StoreAPI : NSObject {
|
||||
@objcMembers open class StoreAPI : NSObject {
|
||||
|
||||
/**
|
||||
Delete purchase order by ID
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc open class UserAPI : NSObject {
|
||||
@objcMembers open class UserAPI : NSObject {
|
||||
|
||||
/**
|
||||
Create user
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class AdditionalPropertiesClass: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class AdditionalPropertiesClass: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var mapString: [String: String]?
|
||||
public var mapMapString: [String: [String: String]]?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Animal: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Animal: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class ApiResponse: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class ApiResponse: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var code: Int?
|
||||
public var codeNum: NSNumber? {
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class ArrayOfArrayOfNumberOnly: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class ArrayOfArrayOfNumberOnly: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var arrayArrayNumber: [[Double]]?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class ArrayOfNumberOnly: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class ArrayOfNumberOnly: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var arrayNumber: [Double]?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class ArrayTest: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class ArrayTest: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var arrayOfString: [String]?
|
||||
public var arrayArrayOfInteger: [[Int64]]?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Capitalization: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Capitalization: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var smallCamel: String?
|
||||
public var capitalCamel: String?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Cat: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Cat: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class CatAllOf: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class CatAllOf: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var declawed: Bool?
|
||||
public var declawedNum: NSNumber? {
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Category: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Category: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _id: Int64?
|
||||
public var _idNum: NSNumber? {
|
||||
|
@ -11,7 +11,7 @@ import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing model with \"_class\" property */
|
||||
@objc public class ClassModel: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class ClassModel: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _class: String?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Client: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Client: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var client: String?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Dog: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Dog: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _className: String
|
||||
public var color: String? = "red"
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class DogAllOf: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class DogAllOf: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var breed: String?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class EnumArrays: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class EnumArrays: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public enum JustSymbol: String, Codable, CaseIterable {
|
||||
case greaterThanOrEqualTo = ">="
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class EnumTest: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class EnumTest: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public enum EnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
|
@ -11,7 +11,7 @@ import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Must be named `File` for test. */
|
||||
@objc public class File: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class File: NSObject, Codable, JSONEncodable {
|
||||
|
||||
/** Test capitalization */
|
||||
public var sourceURI: String?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class FileSchemaTestClass: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class FileSchemaTestClass: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var file: File?
|
||||
public var files: [File]?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class FormatTest: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class FormatTest: NSObject, Codable, JSONEncodable {
|
||||
|
||||
static let integerRule = NumericRule<Int>(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil)
|
||||
static let int32Rule = NumericRule<Int>(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil)
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class HasOnlyReadOnly: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class HasOnlyReadOnly: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var bar: String?
|
||||
public var foo: String?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class List: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class List: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _123list: String?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class MapTest: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class MapTest: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public enum MapOfEnumString: String, Codable, CaseIterable {
|
||||
case upper = "UPPER"
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var uuid: UUID?
|
||||
public var dateTime: Date?
|
||||
|
@ -11,7 +11,7 @@ import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing model name starting with number */
|
||||
@objc public class Model200Response: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Model200Response: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var name: Int?
|
||||
public var nameNum: NSNumber? {
|
||||
|
@ -11,7 +11,7 @@ import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing model name same as property name */
|
||||
@objc public class Name: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Name: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var name: Int
|
||||
public var snakeCase: NullEncodable<Int> = .encodeValue(11033)
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class NumberOnly: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class NumberOnly: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var justNumber: Double?
|
||||
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Order: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Order: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case placed = "placed"
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class OuterComposite: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class OuterComposite: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Pet: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Pet: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class ReadOnlyFirst: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class ReadOnlyFirst: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var bar: String?
|
||||
public var baz: String?
|
||||
|
@ -11,7 +11,7 @@ import AnyCodable
|
||||
#endif
|
||||
|
||||
/** Model for testing reserved words */
|
||||
@objc public class Return: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Return: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _return: Int?
|
||||
public var _returnNum: NSNumber? {
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class SpecialModelName: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class SpecialModelName: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var specialPropertyName: Int64?
|
||||
public var specialPropertyNameNum: NSNumber? {
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class StringBooleanMap: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class StringBooleanMap: NSObject, Codable, JSONEncodable {
|
||||
|
||||
|
||||
public enum CodingKeys: CodingKey, CaseIterable {
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class Tag: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class Tag: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _id: Int64?
|
||||
public var _idNum: NSNumber? {
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class TypeHolderDefault: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class TypeHolderDefault: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var stringItem: String = "what"
|
||||
public var numberItem: Double
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class TypeHolderExample: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class TypeHolderExample: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var stringItem: String
|
||||
public var numberItem: Double
|
||||
|
@ -10,7 +10,7 @@ import Foundation
|
||||
import AnyCodable
|
||||
#endif
|
||||
|
||||
@objc public class User: NSObject, Codable, JSONEncodable {
|
||||
@objcMembers public class User: NSObject, Codable, JSONEncodable {
|
||||
|
||||
public var _id: Int64?
|
||||
public var _idNum: NSNumber? {
|
||||
|
Loading…
x
Reference in New Issue
Block a user