From 072b081ac373fb7b0a053a26be8c34a4a878ddcb Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Wed, 2 Jan 2019 19:35:50 -0800 Subject: [PATCH] Breaking - Rename static var type: String to static var jsonType:String to avoid unnecessary conflict with Swift.type(of:) --- Sources/JSONAPI/Resource/Entity.swift | 12 +++++----- Sources/JSONAPI/Resource/Relationship.swift | 14 +++++------ .../Attribute/Attribute+FunctorTests.swift | 2 +- .../ComputedPropertiesTests.swift | 2 +- .../CustomAttributesTests.swift | 4 ++-- .../JSONAPITests/Document/DocumentTests.swift | 4 ++-- Tests/JSONAPITests/Entity/EntityTests.swift | 24 +++++++++---------- .../JSONAPITests/Includes/IncludeTests.swift | 18 +++++++------- .../JSONAPITestLib/EntityCheckTests.swift | 14 +++++------ .../JSONAPITestLib/Id+LiteralTests.swift | 2 +- .../Relationship+LiteralTests.swift | 2 +- .../NonJSONAPIRelatableTests.swift | 6 ++--- Tests/JSONAPITests/Poly/PolyProxyTests.swift | 8 +++---- Tests/JSONAPITests/Poly/PolyTests.swift | 18 +++++++------- .../Relationships/RelationshipTests.swift | 2 +- .../ResourceBody/ResourceBodyTests.swift | 2 +- .../EncodedEntityPropertyTest.swift | 2 +- 17 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Sources/JSONAPI/Resource/Entity.swift b/Sources/JSONAPI/Resource/Entity.swift index 6a53977..fedb19a 100644 --- a/Sources/JSONAPI/Resource/Entity.swift +++ b/Sources/JSONAPI/Resource/Entity.swift @@ -37,7 +37,7 @@ extension NoAttributes: CustomStringConvertible { /// Something that is JSONTyped provides a String representation /// of its type. public protocol JSONTyped { - static var type: String { get } + static var jsonType: String { get } } /// An `EntityProxyDescription` is an `EntityDescription` @@ -81,7 +81,7 @@ public protocol EntityProxy: Equatable, JSONTyped { extension EntityProxy { /// The JSON API compliant "type" of this `Entity`. - public static var type: String { return Description.type } + public static var jsonType: String { return Description.jsonType } } /// EntityType is the protocol that Entity conforms to. This @@ -136,7 +136,7 @@ extension Entity: Identifiable, IdentifiableEntityType, Relatable where EntityRa extension Entity: CustomStringConvertible { public var description: String { - return "Entity<\(Entity.type)>(id: \(String(describing: id)), attributes: \(String(describing: attributes)), relationships: \(String(describing: relationships)))" + return "Entity<\(Entity.jsonType)>(id: \(String(describing: id)), attributes: \(String(describing: attributes)), relationships: \(String(describing: relationships)))" } } @@ -529,7 +529,7 @@ public extension Entity { public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: ResourceObjectCodingKeys.self) - try container.encode(Entity.type, forKey: .type) + try container.encode(Entity.jsonType, forKey: .type) if EntityRawIdType.self != Unidentified.self { try container.encode(id, forKey: .id) @@ -558,8 +558,8 @@ public extension Entity { let type = try container.decode(String.self, forKey: .type) - guard Entity.type == type else { - throw JSONAPIEncodingError.typeMismatch(expected: Description.type, found: type) + guard Entity.jsonType == type else { + throw JSONAPIEncodingError.typeMismatch(expected: Description.jsonType, found: type) } let maybeUnidentified = Unidentified() as? EntityRawIdType diff --git a/Sources/JSONAPI/Resource/Relationship.swift b/Sources/JSONAPI/Resource/Relationship.swift index 700627a..e5e1e60 100644 --- a/Sources/JSONAPI/Resource/Relationship.swift +++ b/Sources/JSONAPI/Resource/Relationship.swift @@ -134,7 +134,7 @@ public protocol OptionalRelatable: Identifiable where Identifier == Wrapped.Iden extension Optional: Identifiable, OptionalRelatable, JSONTyped where Wrapped: JSONAPI.Relatable { public typealias Identifier = Wrapped.Identifier? - public static var type: String { return Wrapped.type } + public static var jsonType: String { return Wrapped.jsonType } } // MARK: Codable @@ -180,8 +180,8 @@ extension ToOneRelationship: Codable where Identifiable.Identifier: OptionalId { let type = try identifier.decode(String.self, forKey: .entityType) - guard type == Identifiable.type else { - throw JSONAPIEncodingError.typeMismatch(expected: Identifiable.type, found: type) + guard type == Identifiable.jsonType else { + throw JSONAPIEncodingError.typeMismatch(expected: Identifiable.jsonType, found: type) } id = Identifiable.Identifier(rawValue: try identifier.decode(Identifiable.Identifier.RawType.self, forKey: .id)) @@ -214,7 +214,7 @@ extension ToOneRelationship: Codable where Identifiable.Identifier: OptionalId { var identifier = container.nestedContainer(keyedBy: ResourceIdentifierCodingKeys.self, forKey: .data) try identifier.encode(id.rawValue, forKey: .id) - try identifier.encode(Identifiable.type, forKey: .entityType) + try identifier.encode(Identifiable.jsonType, forKey: .entityType) } } @@ -242,8 +242,8 @@ extension ToManyRelationship: Codable { let type = try identifier.decode(String.self, forKey: .entityType) - guard type == Relatable.type else { - throw JSONAPIEncodingError.typeMismatch(expected: Relatable.type, found: type) + guard type == Relatable.jsonType else { + throw JSONAPIEncodingError.typeMismatch(expected: Relatable.jsonType, found: type) } newIds.append(Relatable.Identifier(rawValue: try identifier.decode(Relatable.Identifier.RawType.self, forKey: .id))) @@ -268,7 +268,7 @@ extension ToManyRelationship: Codable { var identifier = identifiers.nestedContainer(keyedBy: ResourceIdentifierCodingKeys.self) try identifier.encode(id.rawValue, forKey: .id) - try identifier.encode(Relatable.type, forKey: .entityType) + try identifier.encode(Relatable.jsonType, forKey: .entityType) } } } diff --git a/Tests/JSONAPITests/Attribute/Attribute+FunctorTests.swift b/Tests/JSONAPITests/Attribute/Attribute+FunctorTests.swift index 451fc95..4274015 100644 --- a/Tests/JSONAPITests/Attribute/Attribute+FunctorTests.swift +++ b/Tests/JSONAPITests/Attribute/Attribute+FunctorTests.swift @@ -38,7 +38,7 @@ class Attribute_FunctorTests: XCTestCase { // MARK: Test types extension Attribute_FunctorTests { enum TestTypeDescription: EntityDescription { - public static var type: String { return "test" } + public static var jsonType: String { return "test" } public struct Attributes: JSONAPI.Attributes { let name: Attribute diff --git a/Tests/JSONAPITests/Computed Properties/ComputedPropertiesTests.swift b/Tests/JSONAPITests/Computed Properties/ComputedPropertiesTests.swift index 50290a9..f80839a 100644 --- a/Tests/JSONAPITests/Computed Properties/ComputedPropertiesTests.swift +++ b/Tests/JSONAPITests/Computed Properties/ComputedPropertiesTests.swift @@ -46,7 +46,7 @@ class ComputedPropertiesTests: XCTestCase { // MARK: Test types extension ComputedPropertiesTests { public enum TestTypeDescription: EntityDescription { - public static var type: String { return "test" } + public static var jsonType: String { return "test" } public struct Attributes: JSONAPI.Attributes { public let name: Attribute diff --git a/Tests/JSONAPITests/Custom Attributes Tests/CustomAttributesTests.swift b/Tests/JSONAPITests/Custom Attributes Tests/CustomAttributesTests.swift index 9454069..3282b4e 100644 --- a/Tests/JSONAPITests/Custom Attributes Tests/CustomAttributesTests.swift +++ b/Tests/JSONAPITests/Custom Attributes Tests/CustomAttributesTests.swift @@ -40,7 +40,7 @@ class CustomAttributesTests: XCTestCase { // MARK: - Test Types extension CustomAttributesTests { enum CustomAttributeEntityDescription: EntityDescription { - public static var type: String { return "test1" } + public static var jsonType: String { return "test1" } public struct Attributes: JSONAPI.Attributes { let firstName: Attribute @@ -58,7 +58,7 @@ extension CustomAttributesTests { typealias CustomAttributeEntity = BasicEntity enum CustomKeysEntityDescription: EntityDescription { - public static var type: String { return "test1" } + public static var jsonType: String { return "test1" } public struct Attributes: JSONAPI.Attributes { public let firstNameSilly: Attribute diff --git a/Tests/JSONAPITests/Document/DocumentTests.swift b/Tests/JSONAPITests/Document/DocumentTests.swift index 2dfeab8..cc2ff8d 100644 --- a/Tests/JSONAPITests/Document/DocumentTests.swift +++ b/Tests/JSONAPITests/Document/DocumentTests.swift @@ -1094,7 +1094,7 @@ extension DocumentTests { // MARK: - Test Types extension DocumentTests { enum AuthorType: EntityDescription { - static var type: String { return "authors" } + static var jsonType: String { return "authors" } typealias Attributes = NoAttributes typealias Relationships = NoRelationships @@ -1103,7 +1103,7 @@ extension DocumentTests { typealias Author = BasicEntity enum ArticleType: EntityDescription { - static var type: String { return "articles" } + static var jsonType: String { return "articles" } typealias Attributes = NoAttributes diff --git a/Tests/JSONAPITests/Entity/EntityTests.swift b/Tests/JSONAPITests/Entity/EntityTests.swift index 23c72ef..68a3d1f 100644 --- a/Tests/JSONAPITests/Entity/EntityTests.swift +++ b/Tests/JSONAPITests/Entity/EntityTests.swift @@ -613,7 +613,7 @@ extension EntityTests { extension EntityTests { enum TestEntityType1: EntityDescription { - static var type: String { return "test_entities"} + static var jsonType: String { return "test_entities"} typealias Attributes = NoAttributes typealias Relationships = NoRelationships @@ -622,7 +622,7 @@ extension EntityTests { typealias TestEntity1 = BasicEntity enum TestEntityType2: EntityDescription { - static var type: String { return "second_test_entities"} + static var jsonType: String { return "second_test_entities"} typealias Attributes = NoAttributes @@ -634,7 +634,7 @@ extension EntityTests { typealias TestEntity2 = BasicEntity enum TestEntityType3: EntityDescription { - static var type: String { return "third_test_entities"} + static var jsonType: String { return "third_test_entities"} typealias Attributes = NoAttributes @@ -646,7 +646,7 @@ extension EntityTests { typealias TestEntity3 = BasicEntity enum TestEntityType4: EntityDescription { - static var type: String { return "fourth_test_entities"} + static var jsonType: String { return "fourth_test_entities"} struct Relationships: JSONAPI.Relationships { let other: ToOneRelationship @@ -668,7 +668,7 @@ extension EntityTests { typealias TestEntity4WithMetaAndLinks = Entity enum TestEntityType5: EntityDescription { - static var type: String { return "fifth_test_entities"} + static var jsonType: String { return "fifth_test_entities"} typealias Relationships = NoRelationships @@ -680,7 +680,7 @@ extension EntityTests { typealias TestEntity5 = BasicEntity enum TestEntityType6: EntityDescription { - static var type: String { return "sixth_test_entities" } + static var jsonType: String { return "sixth_test_entities" } typealias Relationships = NoRelationships @@ -694,7 +694,7 @@ extension EntityTests { typealias TestEntity6 = BasicEntity enum TestEntityType7: EntityDescription { - static var type: String { return "seventh_test_entities" } + static var jsonType: String { return "seventh_test_entities" } typealias Relationships = NoRelationships @@ -707,7 +707,7 @@ extension EntityTests { typealias TestEntity7 = BasicEntity enum TestEntityType8: EntityDescription { - static var type: String { return "eighth_test_entities" } + static var jsonType: String { return "eighth_test_entities" } typealias Relationships = NoRelationships @@ -725,7 +725,7 @@ extension EntityTests { typealias TestEntity8 = BasicEntity enum TestEntityType9: EntityDescription { - public static var type: String { return "ninth_test_entities" } + public static var jsonType: String { return "ninth_test_entities" } typealias Attributes = NoAttributes @@ -748,7 +748,7 @@ extension EntityTests { typealias TestEntity9 = BasicEntity enum TestEntityType10: EntityDescription { - public static var type: String { return "tenth_test_entities" } + public static var jsonType: String { return "tenth_test_entities" } typealias Attributes = NoAttributes @@ -761,7 +761,7 @@ extension EntityTests { typealias TestEntity10 = BasicEntity enum TestEntityType11: EntityDescription { - public static var type: String { return "eleventh_test_entities" } + public static var jsonType: String { return "eleventh_test_entities" } public struct Attributes: JSONAPI.Attributes { let number: ValidatedAttribute @@ -773,7 +773,7 @@ extension EntityTests { typealias TestEntity11 = BasicEntity enum UnidentifiedTestEntityType: EntityDescription { - public static var type: String { return "unidentified_test_entities" } + public static var jsonType: String { return "unidentified_test_entities" } struct Attributes: JSONAPI.Attributes { let me: Attribute? diff --git a/Tests/JSONAPITests/Includes/IncludeTests.swift b/Tests/JSONAPITests/Includes/IncludeTests.swift index 59b4746..ad4beeb 100644 --- a/Tests/JSONAPITests/Includes/IncludeTests.swift +++ b/Tests/JSONAPITests/Includes/IncludeTests.swift @@ -198,7 +198,7 @@ extension IncludedTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity1" } + public static var jsonType: String { return "test_entity1" } public struct Attributes: JSONAPI.Attributes { let foo: Attribute @@ -210,7 +210,7 @@ extension IncludedTests { enum TestEntityType2: EntityDescription { - public static var type: String { return "test_entity2" } + public static var jsonType: String { return "test_entity2" } public struct Relationships: JSONAPI.Relationships { let entity1: ToOneRelationship @@ -228,7 +228,7 @@ extension IncludedTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity3" } + public static var jsonType: String { return "test_entity3" } public struct Relationships: JSONAPI.Relationships { let entity1: ToOneRelationship @@ -244,7 +244,7 @@ extension IncludedTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity4" } + public static var jsonType: String { return "test_entity4" } } typealias TestEntity4 = BasicEntity @@ -255,7 +255,7 @@ extension IncludedTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity5" } + public static var jsonType: String { return "test_entity5" } } typealias TestEntity5 = BasicEntity @@ -264,7 +264,7 @@ extension IncludedTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity6" } + public static var jsonType: String { return "test_entity6" } struct Relationships: JSONAPI.Relationships { let entity4: ToOneRelationship @@ -277,7 +277,7 @@ extension IncludedTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity7" } + public static var jsonType: String { return "test_entity7" } typealias Relationships = NoRelationships } @@ -288,7 +288,7 @@ extension IncludedTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity8" } + public static var jsonType: String { return "test_entity8" } typealias Relationships = NoRelationships } @@ -299,7 +299,7 @@ extension IncludedTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity9" } + public static var jsonType: String { return "test_entity9" } typealias Relationships = NoRelationships } diff --git a/Tests/JSONAPITests/JSONAPITestLib/EntityCheckTests.swift b/Tests/JSONAPITests/JSONAPITestLib/EntityCheckTests.swift index 5796669..cf4a802 100644 --- a/Tests/JSONAPITests/JSONAPITestLib/EntityCheckTests.swift +++ b/Tests/JSONAPITests/JSONAPITestLib/EntityCheckTests.swift @@ -41,7 +41,7 @@ class EntityCheckTests: XCTestCase { // MARK: - Test types extension EntityCheckTests { enum OkDescription: EntityDescription { - public static var type: String { return "hello" } + public static var jsonType: String { return "hello" } public typealias Attributes = NoAttributes public typealias Relationships = NoRelationships @@ -50,7 +50,7 @@ extension EntityCheckTests { public typealias OkEntity = BasicEntity enum OtherOkDescription: EntityDescription { - public static var type: String { return "hmm" } + public static var jsonType: String { return "hmm" } public typealias Attributes = NoAttributes public typealias Relationships = NoRelationships @@ -59,7 +59,7 @@ extension EntityCheckTests { public typealias OtherOkEntity = BasicEntity enum EnumAttributesDescription: EntityDescription { - public static var type: String { return "hello" } + public static var jsonType: String { return "hello" } public enum Attributes: JSONAPI.Attributes { case hello @@ -78,7 +78,7 @@ extension EntityCheckTests { public typealias EnumAttributesEntity = BasicEntity enum EnumRelationshipsDescription: EntityDescription { - public static var type: String { return "hello" } + public static var jsonType: String { return "hello" } public typealias Attributes = NoAttributes @@ -97,7 +97,7 @@ extension EntityCheckTests { public typealias EnumRelationshipsEntity = BasicEntity enum BadAttributeDescription: EntityDescription { - public static var type: String { return "hello" } + public static var jsonType: String { return "hello" } public struct Attributes: JSONAPI.Attributes { let x: Attribute @@ -110,7 +110,7 @@ extension EntityCheckTests { public typealias BadAttributeEntity = BasicEntity enum BadRelationshipDescription: EntityDescription { - public static var type: String { return "hello" } + public static var jsonType: String { return "hello" } public typealias Attributes = NoAttributes @@ -123,7 +123,7 @@ extension EntityCheckTests { public typealias BadRelationshipEntity = BasicEntity enum OptionalArrayAttributeDescription: EntityDescription { - public static var type: String { return "hello" } + public static var jsonType: String { return "hello" } public struct Attributes: JSONAPI.Attributes { let x: Attribute<[String]> diff --git a/Tests/JSONAPITests/JSONAPITestLib/Id+LiteralTests.swift b/Tests/JSONAPITests/JSONAPITestLib/Id+LiteralTests.swift index d45fcc5..a6812be 100644 --- a/Tests/JSONAPITests/JSONAPITestLib/Id+LiteralTests.swift +++ b/Tests/JSONAPITests/JSONAPITestLib/Id+LiteralTests.swift @@ -25,7 +25,7 @@ class Id_LiteralTests: XCTestCase { // MARK: - Test types extension Id_LiteralTests { enum TestDescription: EntityDescription { - public static var type: String { return "test" } + public static var jsonType: String { return "test" } public typealias Attributes = NoAttributes public typealias Relationships = NoRelationships diff --git a/Tests/JSONAPITests/JSONAPITestLib/Relationship+LiteralTests.swift b/Tests/JSONAPITests/JSONAPITestLib/Relationship+LiteralTests.swift index 77aa83d..87e7f4f 100644 --- a/Tests/JSONAPITests/JSONAPITestLib/Relationship+LiteralTests.swift +++ b/Tests/JSONAPITests/JSONAPITestLib/Relationship+LiteralTests.swift @@ -28,7 +28,7 @@ class Relationship_LiteralTests: XCTestCase { // MARK: - Test types extension Relationship_LiteralTests { enum TestDescription: EntityDescription { - public static var type: String { return "test" } + public static var jsonType: String { return "test" } public typealias Attributes = NoAttributes public typealias Relationships = NoRelationships diff --git a/Tests/JSONAPITests/NonJSONAPIRelatable/NonJSONAPIRelatableTests.swift b/Tests/JSONAPITests/NonJSONAPIRelatable/NonJSONAPIRelatableTests.swift index 3a71caf..cb32d69 100644 --- a/Tests/JSONAPITests/NonJSONAPIRelatable/NonJSONAPIRelatableTests.swift +++ b/Tests/JSONAPITests/NonJSONAPIRelatable/NonJSONAPIRelatableTests.swift @@ -53,7 +53,7 @@ class NonJSONAPIRelatableTests: XCTestCase { // MARK: - Test Types extension NonJSONAPIRelatableTests { enum TestEntityDescription: EntityDescription { - static var type: String { return "test" } + static var jsonType: String { return "test" } typealias Attributes = NoAttributes @@ -66,7 +66,7 @@ extension NonJSONAPIRelatableTests { typealias TestEntity = JSONAPI.Entity enum TestEntity2Description: EntityDescription { - static var type: String { return "test" } + static var jsonType: String { return "test" } typealias Attributes = NoAttributes @@ -81,7 +81,7 @@ extension NonJSONAPIRelatableTests { typealias TestEntity2 = JSONAPI.Entity struct NonJSONAPIEntity: Relatable, JSONTyped { - static var type: String { return "other" } + static var jsonType: String { return "other" } typealias Identifier = NonJSONAPIEntity.Id diff --git a/Tests/JSONAPITests/Poly/PolyProxyTests.swift b/Tests/JSONAPITests/Poly/PolyProxyTests.swift index dc0416e..093558e 100644 --- a/Tests/JSONAPITests/Poly/PolyProxyTests.swift +++ b/Tests/JSONAPITests/Poly/PolyProxyTests.swift @@ -11,7 +11,7 @@ import JSONAPI public class PolyProxyTests: XCTestCase { func test_generalReasonableness() { XCTAssertNotEqual(decoded(type: User.self, data: poly_user_stub_1), decoded(type: User.self, data: poly_user_stub_2)) - XCTAssertEqual(User.type, "users") + XCTAssertEqual(User.jsonType, "users") } func test_UserADecode() { @@ -65,7 +65,7 @@ public class PolyProxyTests: XCTestCase { // MARK: - Test types public extension PolyProxyTests { public enum UserDescription1: EntityDescription { - public static var type: String { return "users" } + public static var jsonType: String { return "users" } public struct Attributes: JSONAPI.Attributes { let firstName: Attribute @@ -76,7 +76,7 @@ public extension PolyProxyTests { } public enum UserDescription2: EntityDescription { - public static var type: String { return "users" } + public static var jsonType: String { return "users" } public struct Attributes: JSONAPI.Attributes { let name: Attribute<[String]> @@ -124,7 +124,7 @@ extension Poly2: EntityProxy, JSONTyped where A == PolyProxyTests.UserA, B == Po } public enum SharedUserDescription: EntityProxyDescription { - public static var type: String { return A.type } + public static var jsonType: String { return A.jsonType } public struct Attributes: Equatable { let name: Attribute diff --git a/Tests/JSONAPITests/Poly/PolyTests.swift b/Tests/JSONAPITests/Poly/PolyTests.swift index c84cd6b..8db6509 100644 --- a/Tests/JSONAPITests/Poly/PolyTests.swift +++ b/Tests/JSONAPITests/Poly/PolyTests.swift @@ -572,7 +572,7 @@ extension PolyTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity1" } + public static var jsonType: String { return "test_entity1" } public struct Attributes: JSONAPI.Attributes { let foo: Attribute @@ -584,7 +584,7 @@ extension PolyTests { enum TestEntityType2: EntityDescription { - public static var type: String { return "test_entity2" } + public static var jsonType: String { return "test_entity2" } public struct Relationships: JSONAPI.Relationships { let entity1: ToOneRelationship @@ -602,7 +602,7 @@ extension PolyTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity3" } + public static var jsonType: String { return "test_entity3" } public struct Relationships: JSONAPI.Relationships { let entity1: ToOneRelationship @@ -618,7 +618,7 @@ extension PolyTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity4" } + public static var jsonType: String { return "test_entity4" } } typealias TestEntity4 = BasicEntity @@ -629,7 +629,7 @@ extension PolyTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity5" } + public static var jsonType: String { return "test_entity5" } } typealias TestEntity5 = BasicEntity @@ -638,7 +638,7 @@ extension PolyTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity6" } + public static var jsonType: String { return "test_entity6" } struct Relationships: JSONAPI.Relationships { let entity4: ToOneRelationship @@ -651,7 +651,7 @@ extension PolyTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity7" } + public static var jsonType: String { return "test_entity7" } typealias Relationships = NoRelationships } @@ -662,7 +662,7 @@ extension PolyTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity8" } + public static var jsonType: String { return "test_entity8" } typealias Relationships = NoRelationships } @@ -673,7 +673,7 @@ extension PolyTests { typealias Attributes = NoAttributes - public static var type: String { return "test_entity9" } + public static var jsonType: String { return "test_entity9" } typealias Relationships = NoRelationships } diff --git a/Tests/JSONAPITests/Relationships/RelationshipTests.swift b/Tests/JSONAPITests/Relationships/RelationshipTests.swift index eb01ae0..eec8179 100644 --- a/Tests/JSONAPITests/Relationships/RelationshipTests.swift +++ b/Tests/JSONAPITests/Relationships/RelationshipTests.swift @@ -177,7 +177,7 @@ extension RelationshipTests { typealias Relationships = NoRelationships - public static var type: String { return "test_entity1" } + public static var jsonType: String { return "test_entity1" } } typealias TestEntity1 = BasicEntity diff --git a/Tests/JSONAPITests/ResourceBody/ResourceBodyTests.swift b/Tests/JSONAPITests/ResourceBody/ResourceBodyTests.swift index 46a6716..a1e3b2e 100644 --- a/Tests/JSONAPITests/ResourceBody/ResourceBodyTests.swift +++ b/Tests/JSONAPITests/ResourceBody/ResourceBodyTests.swift @@ -102,7 +102,7 @@ class ResourceBodyTests: XCTestCase { } enum ArticleType: EntityDescription { - public static var type: String { return "articles" } + public static var jsonType: String { return "articles" } typealias Relationships = NoRelationships diff --git a/Tests/JSONAPITests/Test Helpers/EncodedEntityPropertyTest.swift b/Tests/JSONAPITests/Test Helpers/EncodedEntityPropertyTest.swift index c15c43f..d2ce1bc 100644 --- a/Tests/JSONAPITests/Test Helpers/EncodedEntityPropertyTest.swift +++ b/Tests/JSONAPITests/Test Helpers/EncodedEntityPropertyTest.swift @@ -27,7 +27,7 @@ func testEncoded(entity: E) { let jsonType = jsonDict?["type"] as? String - XCTAssertEqual(jsonType, E.type) + XCTAssertEqual(jsonType, E.jsonType) let jsonAttributes = jsonDict?["attributes"] as? [String: Any]