mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
add extension for hashable in swift5 (#7300)
This commit is contained in:
parent
98582d5780
commit
11a674f248
@ -197,6 +197,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
typeMapping.put("array", "Array");
|
||||
typeMapping.put("List", "Array");
|
||||
typeMapping.put("map", "Dictionary");
|
||||
typeMapping.put("set", "Set");
|
||||
typeMapping.put("date", "Date");
|
||||
typeMapping.put("Date", "Date");
|
||||
typeMapping.put("DateTime", "Date");
|
||||
|
@ -1,5 +1,9 @@
|
||||
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable { {{/objcCompatible}}
|
||||
{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable { {{/objcCompatible}}
|
||||
{{^objcCompatible}}
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
||||
{{/objcCompatible}}
|
||||
{{#objcCompatible}}
|
||||
@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
|
||||
{{/objcCompatible}}
|
||||
|
||||
{{#allVars}}
|
||||
{{#isEnum}}
|
||||
@ -86,4 +90,4 @@
|
||||
case {{name}}{{#vendorExtensions.x-codegen-escaped-property-name}} = "{{{baseName}}}"{{/vendorExtensions.x-codegen-escaped-property-name}}{{/allVars}}
|
||||
}
|
||||
{{/vendorExtensions.x-codegen-has-escaped-property-names}}{{/additionalPropertiesType}}
|
||||
}
|
||||
}
|
||||
|
@ -1134,6 +1134,7 @@ definitions:
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
x-swift-hashable: true
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
internal struct Pet: Codable {
|
||||
internal struct Pet: Codable, Hashable {
|
||||
|
||||
internal enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -8,7 +8,6 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model with \"_class\" property */
|
||||
|
||||
@objc public class ClassModel: NSObject, Codable {
|
||||
|
||||
public var _class: String?
|
||||
|
@ -8,7 +8,6 @@
|
||||
import Foundation
|
||||
|
||||
/** Must be named `File` for test. */
|
||||
|
||||
@objc public class File: NSObject, Codable {
|
||||
|
||||
/** Test capitalization */
|
||||
|
@ -8,7 +8,6 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name starting with number */
|
||||
|
||||
@objc public class Model200Response: NSObject, Codable {
|
||||
|
||||
public var name: Int?
|
||||
|
@ -8,7 +8,6 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing model name same as property name */
|
||||
|
||||
@objc public class Name: NSObject, Codable {
|
||||
|
||||
public var name: Int
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
@objc public class Pet: NSObject, Codable {
|
||||
@objc public class Pet: NSObject, Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -8,7 +8,6 @@
|
||||
import Foundation
|
||||
|
||||
/** Model for testing reserved words */
|
||||
|
||||
@objc public class Return: NSObject, Codable {
|
||||
|
||||
public var _return: Int?
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Pet: Codable {
|
||||
public struct Pet: Codable, Hashable {
|
||||
|
||||
public enum Status: String, Codable, CaseIterable {
|
||||
case available = "available"
|
||||
|
Loading…
x
Reference in New Issue
Block a user