Add Hashable for Struct (#9166)

* Add hashable for struct

* Remove x-swift-hashable

* Run the shell script ./bin/generate-samples.sh
This commit is contained in:
Makoto Aoyama 2021-04-06 11:50:23 +09:00 committed by GitHub
parent 29c131e781
commit c3b7ecff21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
314 changed files with 313 additions and 314 deletions

View File

@ -1,4 +1,4 @@
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} {
{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} struct {{classname}}: Codable, Hashable {
{{/objcCompatible}}{{#objcCompatible}}@objc {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable {
{{/objcCompatible}}

View File

@ -1086,7 +1086,6 @@ definitions:
xml:
name: Order
Category:
x-swift-hashable: true
type: object
required:
- name

View File

@ -7,7 +7,7 @@
import Foundation
public struct AdditionalPropertiesClass: Codable {
public struct AdditionalPropertiesClass: Codable, Hashable {
public var mapString: [String: String]?
public var mapMapString: [String: [String: String]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Animal: Codable {
public struct Animal: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct ApiResponse: Codable {
public struct ApiResponse: Codable, Hashable {
public var code: Int?
public var type: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayOfArrayOfNumberOnly: Codable {
public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public var arrayArrayNumber: [[Double]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayOfNumberOnly: Codable {
public struct ArrayOfNumberOnly: Codable, Hashable {
public var arrayNumber: [Double]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayTest: Codable {
public struct ArrayTest: Codable, Hashable {
public var arrayOfString: [String]?
public var arrayArrayOfInteger: [[Int64]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Capitalization: Codable {
public struct Capitalization: Codable, Hashable {
public var smallCamel: String?
public var capitalCamel: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Cat: Codable {
public struct Cat: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct CatAllOf: Codable {
public struct CatAllOf: Codable, Hashable {
public var declawed: Bool?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model with \"_class\" property */
public struct ClassModel: Codable {
public struct ClassModel: Codable, Hashable {
public var _class: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Client: Codable {
public struct Client: Codable, Hashable {
public var client: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Dog: Codable {
public struct Dog: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct DogAllOf: Codable {
public struct DogAllOf: Codable, Hashable {
public var breed: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct EnumArrays: Codable {
public struct EnumArrays: Codable, Hashable {
public enum JustSymbol: String, Codable, CaseIterable {
case greaterThanOrEqualTo = ">="

View File

@ -7,7 +7,7 @@
import Foundation
public struct EnumTest: Codable {
public struct EnumTest: Codable, Hashable {
public enum EnumString: String, Codable, CaseIterable {
case upper = "UPPER"

View File

@ -8,7 +8,7 @@
import Foundation
/** Must be named `File` for test. */
public struct File: Codable {
public struct File: Codable, Hashable {
/** Test capitalization */
public var sourceURI: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct FileSchemaTestClass: Codable {
public struct FileSchemaTestClass: Codable, Hashable {
public var file: File?
public var files: [File]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct FormatTest: Codable {
public struct FormatTest: Codable, Hashable {
public var integer: Int?
public var int32: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct HasOnlyReadOnly: Codable {
public struct HasOnlyReadOnly: Codable, Hashable {
public var bar: String?
public var foo: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct List: Codable {
public struct List: Codable, Hashable {
public var _123list: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct MapTest: Codable {
public struct MapTest: Codable, Hashable {
public enum MapOfEnumString: String, Codable, CaseIterable {
case upper = "UPPER"

View File

@ -7,7 +7,7 @@
import Foundation
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
public var uuid: UUID?
public var dateTime: Date?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name starting with number */
public struct Model200Response: Codable {
public struct Model200Response: Codable, Hashable {
public var name: Int?
public var _class: String?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name same as property name */
public struct Name: Codable {
public struct Name: Codable, Hashable {
public var name: Int
public var snakeCase: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct NumberOnly: Codable {
public struct NumberOnly: Codable, Hashable {
public var justNumber: Double?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Order: Codable {
public struct Order: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case placed = "placed"

View File

@ -7,7 +7,7 @@
import Foundation
public struct OuterComposite: Codable {
public struct OuterComposite: Codable, Hashable {
public var myNumber: Double?
public var myString: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ReadOnlyFirst: Codable {
public struct ReadOnlyFirst: Codable, Hashable {
public var bar: String?
public var baz: String?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing reserved words */
public struct Return: Codable {
public struct Return: Codable, Hashable {
public var _return: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct SpecialModelName: Codable {
public struct SpecialModelName: Codable, Hashable {
public var specialPropertyName: Int64?

View File

@ -7,7 +7,7 @@
import Foundation
public struct StringBooleanMap: Codable {
public struct StringBooleanMap: Codable, Hashable {
public var additionalProperties: [String: Bool] = [:]

View File

@ -7,7 +7,7 @@
import Foundation
public struct TypeHolderDefault: Codable {
public struct TypeHolderDefault: Codable, Hashable {
public var stringItem: String = "what"
public var numberItem: Double

View File

@ -7,7 +7,7 @@
import Foundation
public struct TypeHolderExample: Codable {
public struct TypeHolderExample: Codable, Hashable {
public var stringItem: String
public var numberItem: Double

View File

@ -7,7 +7,7 @@
import Foundation
public struct User: Codable {
public struct User: Codable, Hashable {
public var id: Int64?
public var username: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct AdditionalPropertiesClass: Codable {
public struct AdditionalPropertiesClass: Codable, Hashable {
public var mapString: [String: String]?
public var mapMapString: [String: [String: String]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Animal: Codable {
public struct Animal: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct ApiResponse: Codable {
public struct ApiResponse: Codable, Hashable {
public var code: Int?
public var type: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayOfArrayOfNumberOnly: Codable {
public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public var arrayArrayNumber: [[Double]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayOfNumberOnly: Codable {
public struct ArrayOfNumberOnly: Codable, Hashable {
public var arrayNumber: [Double]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayTest: Codable {
public struct ArrayTest: Codable, Hashable {
public var arrayOfString: [String]?
public var arrayArrayOfInteger: [[Int64]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Capitalization: Codable {
public struct Capitalization: Codable, Hashable {
public var smallCamel: String?
public var capitalCamel: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Cat: Codable {
public struct Cat: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct CatAllOf: Codable {
public struct CatAllOf: Codable, Hashable {
public var declawed: Bool?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model with \"_class\" property */
public struct ClassModel: Codable {
public struct ClassModel: Codable, Hashable {
public var _class: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Client: Codable {
public struct Client: Codable, Hashable {
public var client: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Dog: Codable {
public struct Dog: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct DogAllOf: Codable {
public struct DogAllOf: Codable, Hashable {
public var breed: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct EnumArrays: Codable {
public struct EnumArrays: Codable, Hashable {
public enum JustSymbol: String, Codable, CaseIterable {
case greaterThanOrEqualTo = ">="

View File

@ -7,7 +7,7 @@
import Foundation
public struct EnumTest: Codable {
public struct EnumTest: Codable, Hashable {
public enum EnumString: String, Codable, CaseIterable {
case upper = "UPPER"

View File

@ -8,7 +8,7 @@
import Foundation
/** Must be named `File` for test. */
public struct File: Codable {
public struct File: Codable, Hashable {
/** Test capitalization */
public var sourceURI: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct FileSchemaTestClass: Codable {
public struct FileSchemaTestClass: Codable, Hashable {
public var file: File?
public var files: [File]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct FormatTest: Codable {
public struct FormatTest: Codable, Hashable {
public var integer: Int?
public var int32: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct HasOnlyReadOnly: Codable {
public struct HasOnlyReadOnly: Codable, Hashable {
public var bar: String?
public var foo: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct List: Codable {
public struct List: Codable, Hashable {
public var _123list: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct MapTest: Codable {
public struct MapTest: Codable, Hashable {
public enum MapOfEnumString: String, Codable, CaseIterable {
case upper = "UPPER"

View File

@ -7,7 +7,7 @@
import Foundation
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
public var uuid: UUID?
public var dateTime: Date?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name starting with number */
public struct Model200Response: Codable {
public struct Model200Response: Codable, Hashable {
public var name: Int?
public var _class: String?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name same as property name */
public struct Name: Codable {
public struct Name: Codable, Hashable {
public var name: Int
public var snakeCase: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct NumberOnly: Codable {
public struct NumberOnly: Codable, Hashable {
public var justNumber: Double?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Order: Codable {
public struct Order: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case placed = "placed"

View File

@ -7,7 +7,7 @@
import Foundation
public struct OuterComposite: Codable {
public struct OuterComposite: Codable, Hashable {
public var myNumber: Double?
public var myString: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ReadOnlyFirst: Codable {
public struct ReadOnlyFirst: Codable, Hashable {
public var bar: String?
public var baz: String?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing reserved words */
public struct Return: Codable {
public struct Return: Codable, Hashable {
public var _return: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct SpecialModelName: Codable {
public struct SpecialModelName: Codable, Hashable {
public var specialPropertyName: Int64?

View File

@ -7,7 +7,7 @@
import Foundation
public struct StringBooleanMap: Codable {
public struct StringBooleanMap: Codable, Hashable {
public var additionalProperties: [String: Bool] = [:]

View File

@ -7,7 +7,7 @@
import Foundation
public struct TypeHolderDefault: Codable {
public struct TypeHolderDefault: Codable, Hashable {
public var stringItem: String = "what"
public var numberItem: Double

View File

@ -7,7 +7,7 @@
import Foundation
public struct TypeHolderExample: Codable {
public struct TypeHolderExample: Codable, Hashable {
public var stringItem: String
public var numberItem: Double

View File

@ -7,7 +7,7 @@
import Foundation
public struct User: Codable {
public struct User: Codable, Hashable {
public var id: Int64?
public var username: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct AdditionalPropertiesClass: Codable {
public struct AdditionalPropertiesClass: Codable, Hashable {
public var mapString: [String: String]?
public var mapMapString: [String: [String: String]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Animal: Codable {
public struct Animal: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct ApiResponse: Codable {
public struct ApiResponse: Codable, Hashable {
public var code: Int?
public var type: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayOfArrayOfNumberOnly: Codable {
public struct ArrayOfArrayOfNumberOnly: Codable, Hashable {
public var arrayArrayNumber: [[Double]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayOfNumberOnly: Codable {
public struct ArrayOfNumberOnly: Codable, Hashable {
public var arrayNumber: [Double]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ArrayTest: Codable {
public struct ArrayTest: Codable, Hashable {
public var arrayOfString: [String]?
public var arrayArrayOfInteger: [[Int64]]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Capitalization: Codable {
public struct Capitalization: Codable, Hashable {
public var smallCamel: String?
public var capitalCamel: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Cat: Codable {
public struct Cat: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct CatAllOf: Codable {
public struct CatAllOf: Codable, Hashable {
public var declawed: Bool?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model with \"_class\" property */
public struct ClassModel: Codable {
public struct ClassModel: Codable, Hashable {
public var _class: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Client: Codable {
public struct Client: Codable, Hashable {
public var client: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Dog: Codable {
public struct Dog: Codable, Hashable {
public var className: String
public var color: String? = "red"

View File

@ -7,7 +7,7 @@
import Foundation
public struct DogAllOf: Codable {
public struct DogAllOf: Codable, Hashable {
public var breed: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct EnumArrays: Codable {
public struct EnumArrays: Codable, Hashable {
public enum JustSymbol: String, Codable, CaseIterable {
case greaterThanOrEqualTo = ">="

View File

@ -7,7 +7,7 @@
import Foundation
public struct EnumTest: Codable {
public struct EnumTest: Codable, Hashable {
public enum EnumString: String, Codable, CaseIterable {
case upper = "UPPER"

View File

@ -8,7 +8,7 @@
import Foundation
/** Must be named `File` for test. */
public struct File: Codable {
public struct File: Codable, Hashable {
/** Test capitalization */
public var sourceURI: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct FileSchemaTestClass: Codable {
public struct FileSchemaTestClass: Codable, Hashable {
public var file: File?
public var files: [File]?

View File

@ -7,7 +7,7 @@
import Foundation
public struct FormatTest: Codable {
public struct FormatTest: Codable, Hashable {
public var integer: Int?
public var int32: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct HasOnlyReadOnly: Codable {
public struct HasOnlyReadOnly: Codable, Hashable {
public var bar: String?
public var foo: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct List: Codable {
public struct List: Codable, Hashable {
public var _123list: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct MapTest: Codable {
public struct MapTest: Codable, Hashable {
public enum MapOfEnumString: String, Codable, CaseIterable {
case upper = "UPPER"

View File

@ -7,7 +7,7 @@
import Foundation
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable, Hashable {
public var uuid: UUID?
public var dateTime: Date?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name starting with number */
public struct Model200Response: Codable {
public struct Model200Response: Codable, Hashable {
public var name: Int?
public var _class: String?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing model name same as property name */
public struct Name: Codable {
public struct Name: Codable, Hashable {
public var name: Int
public var snakeCase: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct NumberOnly: Codable {
public struct NumberOnly: Codable, Hashable {
public var justNumber: Double?

View File

@ -7,7 +7,7 @@
import Foundation
public struct Order: Codable {
public struct Order: Codable, Hashable {
public enum Status: String, Codable, CaseIterable {
case placed = "placed"

View File

@ -7,7 +7,7 @@
import Foundation
public struct OuterComposite: Codable {
public struct OuterComposite: Codable, Hashable {
public var myNumber: Double?
public var myString: String?

View File

@ -7,7 +7,7 @@
import Foundation
public struct ReadOnlyFirst: Codable {
public struct ReadOnlyFirst: Codable, Hashable {
public var bar: String?
public var baz: String?

View File

@ -8,7 +8,7 @@
import Foundation
/** Model for testing reserved words */
public struct Return: Codable {
public struct Return: Codable, Hashable {
public var _return: Int?

View File

@ -7,7 +7,7 @@
import Foundation
public struct SpecialModelName: Codable {
public struct SpecialModelName: Codable, Hashable {
public var specialPropertyName: Int64?

Some files were not shown because too many files have changed in this diff Show More