update samples

This commit is contained in:
William Cheng 2021-05-21 12:54:40 +08:00
parent 338812114c
commit 4948ce78ed
42 changed files with 86 additions and 2 deletions

View File

@ -5,7 +5,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
extension Bool: JSONEncodable { extension Bool: JSONEncodable {
func encodeToJSON() -> Any { return self as Any } func encodeToJSON() -> Any { return self as Any }
@ -185,6 +187,7 @@ extension HTTPURLResponse {
} }
} }
#if canImport(AnyCodable)
extension AnyCodable: Hashable { extension AnyCodable: Hashable {
public func hash(into hasher: inout Hasher) { public func hash(into hasher: inout Hasher) {
switch value { switch value {
@ -224,4 +227,5 @@ extension AnyCodable: Hashable {
hasher.combine(0) hasher.combine(0)
} }
} }
} }
#endif

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct AdditionalPropertiesClass: Codable { public struct AdditionalPropertiesClass: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Animal: Codable { public struct Animal: Codable {

View File

@ -6,6 +6,8 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public typealias AnimalFarm = [Animal] public typealias AnimalFarm = [Animal]

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct ApiResponse: Codable { public struct ApiResponse: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct ArrayOfArrayOfNumberOnly: Codable { public struct ArrayOfArrayOfNumberOnly: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct ArrayOfNumberOnly: Codable { public struct ArrayOfNumberOnly: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct ArrayTest: Codable { public struct ArrayTest: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Capitalization: Codable { public struct Capitalization: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Cat: Codable { public struct Cat: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct CatAllOf: Codable { public struct CatAllOf: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Category: Codable, Hashable { public struct Category: Codable, Hashable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
/** Model for testing model with \"_class\" property */ /** Model for testing model with \"_class\" property */
public struct ClassModel: Codable { public struct ClassModel: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Client: Codable { public struct Client: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Dog: Codable { public struct Dog: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct DogAllOf: Codable { public struct DogAllOf: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct EnumArrays: Codable { public struct EnumArrays: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public enum EnumClass: String, Codable, CaseIterable { public enum EnumClass: String, Codable, CaseIterable {
case abc = "_abc" case abc = "_abc"

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct EnumTest: Codable { public struct EnumTest: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
/** Must be named `File` for test. */ /** Must be named `File` for test. */
public struct File: Codable { public struct File: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct FileSchemaTestClass: Codable { public struct FileSchemaTestClass: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct FormatTest: Codable { public struct FormatTest: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct HasOnlyReadOnly: Codable { public struct HasOnlyReadOnly: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct List: Codable { public struct List: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct MapTest: Codable { public struct MapTest: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { public struct MixedPropertiesAndAdditionalPropertiesClass: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
/** Model for testing model name starting with number */ /** Model for testing model name starting with number */
public struct Model200Response: Codable { public struct Model200Response: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
/** Model for testing model name same as property name */ /** Model for testing model name same as property name */
public struct Name: Codable { public struct Name: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct NumberOnly: Codable { public struct NumberOnly: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Order: Codable { public struct Order: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct OuterComposite: Codable { public struct OuterComposite: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public enum OuterEnum: String, Codable, CaseIterable { public enum OuterEnum: String, Codable, CaseIterable {
case placed = "placed" case placed = "placed"

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Pet: Codable, Hashable { public struct Pet: Codable, Hashable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct ReadOnlyFirst: Codable { public struct ReadOnlyFirst: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
/** Model for testing reserved words */ /** Model for testing reserved words */
public struct Return: Codable { public struct Return: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct SpecialModelName: Codable { public struct SpecialModelName: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct StringBooleanMap: Codable { public struct StringBooleanMap: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct Tag: Codable, Hashable { public struct Tag: Codable, Hashable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct TypeHolderDefault: Codable { public struct TypeHolderDefault: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct TypeHolderExample: Codable { public struct TypeHolderExample: Codable {

View File

@ -6,7 +6,9 @@
// //
import Foundation import Foundation
#if canImport(AnyCodable)
import AnyCodable import AnyCodable
#endif
public struct User: Codable { public struct User: Codable {

View File

@ -11,5 +11,5 @@ targets:
settings: settings:
APPLICATION_EXTENSION_API_ONLY: true APPLICATION_EXTENSION_API_ONLY: true
scheme: {} scheme: {}
dependencies:
- carthage: AnyCodable - carthage: AnyCodable