Issue 3175 - using @objcMembers to expose all props and funcs to ObjC code when objcCompatible is requested. (#15188)

This commit is contained in:
Tom Sanidas 2023-04-14 04:31:59 -04:00 committed by GitHub
parent 90b78fe97e
commit 6a67551ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 45 additions and 45 deletions

View File

@ -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}}

View File

@ -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}}

View File

@ -10,7 +10,7 @@ import Foundation
import AnyCodable
#endif
@objc open class AnotherFakeAPI : NSObject {
@objcMembers open class AnotherFakeAPI : NSObject {
/**
To test special tags

View File

@ -10,7 +10,7 @@ import Foundation
import AnyCodable
#endif
@objc open class FakeAPI : NSObject {
@objcMembers open class FakeAPI : NSObject {
/**

View File

@ -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

View File

@ -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

View File

@ -10,7 +10,7 @@ import Foundation
import AnyCodable
#endif
@objc open class StoreAPI : NSObject {
@objcMembers open class StoreAPI : NSObject {
/**
Delete purchase order by ID

View File

@ -10,7 +10,7 @@ import Foundation
import AnyCodable
#endif
@objc open class UserAPI : NSObject {
@objcMembers open class UserAPI : NSObject {
/**
Create user

View File

@ -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]]?

View File

@ -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"

View File

@ -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? {

View File

@ -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]]?

View File

@ -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]?

View File

@ -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]]?

View File

@ -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?

View File

@ -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"

View File

@ -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? {

View File

@ -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? {

View File

@ -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?

View File

@ -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?

View File

@ -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"

View File

@ -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?

View File

@ -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 = ">="

View File

@ -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"

View File

@ -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?

View File

@ -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]?

View 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)

View File

@ -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?

View File

@ -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?

View File

@ -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"

View File

@ -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?

View File

@ -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? {

View File

@ -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)

View File

@ -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?

View File

@ -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"

View File

@ -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?

View File

@ -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"

View File

@ -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?

View File

@ -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? {

View File

@ -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? {

View File

@ -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 {

View File

@ -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? {

View File

@ -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

View File

@ -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

View File

@ -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? {