Skip to content

Commit 7dd0977

Browse files
committed
Attempt to force compiler to acknowledge that ResourceObjectProxy and ResourceObject have the same ID type.
1 parent 9374956 commit 7dd0977

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Sources/JSONAPI/Resource/Resource Object/ResourceObject.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,14 @@ public protocol ResourceObjectProxy: Equatable, JSONTyped {
7373
associatedtype Description: ResourceObjectProxyDescription
7474
associatedtype EntityRawIdType: JSONAPI.MaybeRawId
7575

76-
typealias ID = JSONAPI.Id<EntityRawIdType, Self>
77-
7876
typealias Attributes = Description.Attributes
7977
typealias Relationships = Description.Relationships
8078

8179
/// The `Entity`'s Id. This can be of type `Unidentified` if
8280
/// the entity is being created clientside and the
8381
/// server is being asked to create a unique Id. Otherwise,
8482
/// this should be of a type conforming to `IdType`.
85-
var id: ID { get }
83+
var id: JSONAPI.Id<EntityRawIdType, Self> { get }
8684

8785
/// The JSON API compliant attributes of this `Entity`.
8886
var attributes: Attributes { get }
@@ -91,6 +89,10 @@ public protocol ResourceObjectProxy: Equatable, JSONTyped {
9189
var relationships: Relationships { get }
9290
}
9391

92+
extension ResourceObjectProxy {
93+
public typealias ID = JSONAPI.Id<EntityRawIdType, Self>
94+
}
95+
9496
extension ResourceObjectProxy {
9597
/// The JSON API compliant "type" of this `ResourceObject`.
9698
public static var jsonType: String { return Description.jsonType }
@@ -121,7 +123,6 @@ public protocol IdentifiableResourceObjectType: ResourceObjectType, Relatable wh
121123
/// See https://jsonapi.org/format/#document-resource-objects
122124
public struct ResourceObject<Description: JSONAPI.ResourceObjectDescription, MetaType: JSONAPI.Meta, LinksType: JSONAPI.Links, EntityRawIdType: JSONAPI.MaybeRawId>: ResourceObjectType {
123125

124-
public typealias ID = JSONAPI.Id<EntityRawIdType, Self>
125126
public typealias Meta = MetaType
126127
public typealias Links = LinksType
127128

0 commit comments

Comments
 (0)