@@ -73,14 +73,16 @@ public protocol ResourceObjectProxy: Equatable, JSONTyped {
7373 associatedtype Description : ResourceObjectProxyDescription
7474 associatedtype EntityRawIdType : JSONAPI . MaybeRawId
7575
76+ typealias Id = JSONAPI . Id < EntityRawIdType , Self >
77+
7678 typealias Attributes = Description . Attributes
7779 typealias Relationships = Description . Relationships
7880
7981 /// The `Entity`'s Id. This can be of type `Unidentified` if
8082 /// the entity is being created clientside and the
8183 /// server is being asked to create a unique Id. Otherwise,
8284 /// this should be of a type conforming to `IdType`.
83- var id : JSONAPI . Id < EntityRawIdType , Self > { get }
85+ var id : Id { get }
8486
8587 /// The JSON API compliant attributes of this `Entity`.
8688 var attributes : Attributes { get }
@@ -89,10 +91,6 @@ public protocol ResourceObjectProxy: Equatable, JSONTyped {
8991 var relationships : Relationships { get }
9092}
9193
92- extension ResourceObjectProxy {
93- public typealias ID = JSONAPI . Id < EntityRawIdType , Self >
94- }
95-
9694extension ResourceObjectProxy {
9795 /// The JSON API compliant "type" of this `ResourceObject`.
9896 public static var jsonType : String { return Description . jsonType }
@@ -130,7 +128,7 @@ public struct ResourceObject<Description: JSONAPI.ResourceObjectDescription, Met
130128 /// the entity is being created clientside and the
131129 /// server is being asked to create a unique Id. Otherwise,
132130 /// this should be of a type conforming to `IdType`.
133- public let id : ID
131+ public let id : ResourceObject . Id
134132
135133 /// The JSON API compliant attributes of this `ResourceObject`.
136134 public let attributes : Description . Attributes
@@ -144,7 +142,7 @@ public struct ResourceObject<Description: JSONAPI.ResourceObjectDescription, Met
144142 /// Links related to the entity.
145143 public let links : LinksType
146144
147- public init ( id: ID , attributes: Description . Attributes , relationships: Description . Relationships , meta: MetaType , links: LinksType ) {
145+ public init ( id: ResourceObject . Id , attributes: Description . Attributes , relationships: Description . Relationships , meta: MetaType , links: LinksType ) {
148146 self . id = id
149147 self . attributes = attributes
150148 self . relationships = relationships
@@ -165,7 +163,9 @@ extension ResourceObject: Hashable where EntityRawIdType: RawIdType {
165163 }
166164}
167165
168- extension ResourceObject : JSONAPIIdentifiable , IdentifiableResourceObjectType , Relatable where EntityRawIdType: JSONAPI . RawIdType { }
166+ extension ResourceObject : JSONAPIIdentifiable , IdentifiableResourceObjectType , Relatable where EntityRawIdType: JSONAPI . RawIdType {
167+ public typealias ID = ResourceObject . Id
168+ }
169169
170170@available ( OSX 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * )
171171extension ResourceObject : Swift . Identifiable where EntityRawIdType: JSONAPI . RawIdType { }
@@ -179,7 +179,7 @@ extension ResourceObject: CustomStringConvertible {
179179// MARK: - Convenience initializers
180180extension ResourceObject where EntityRawIdType: CreatableRawIdType {
181181 public init ( attributes: Description . Attributes , relationships: Description . Relationships , meta: MetaType , links: LinksType ) {
182- self . id = ResourceObject . ID ( )
182+ self . id = ResourceObject . Id ( )
183183 self . attributes = attributes
184184 self . relationships = relationships
185185 self . meta = meta
@@ -410,7 +410,7 @@ public extension ResourceObject {
410410 }
411411
412412 let maybeUnidentified = Unidentified ( ) as? EntityRawIdType
413- id = try maybeUnidentified. map { ResourceObject . ID ( rawValue: $0) } ?? container. decode ( ResourceObject . ID . self, forKey: . id)
413+ id = try maybeUnidentified. map { ResourceObject . Id ( rawValue: $0) } ?? container. decode ( ResourceObject . Id . self, forKey: . id)
414414
415415 do {
416416 attributes = try ( NoAttributes ( ) as? Description . Attributes)
0 commit comments