@@ -73,7 +73,7 @@ public protocol ResourceObjectProxy: Equatable, JSONTyped {
7373 associatedtype Description : ResourceObjectProxyDescription
7474 associatedtype EntityRawIdType : JSONAPI . MaybeRawId
7575
76- typealias ID = JSONAPI . Id < EntityRawIdType , Self >
76+ typealias Id = JSONAPI . Id < EntityRawIdType , Self >
7777
7878 typealias Attributes = Description . Attributes
7979 typealias Relationships = Description . Relationships
@@ -82,7 +82,7 @@ public protocol ResourceObjectProxy: Equatable, JSONTyped {
8282 /// the entity is being created clientside and the
8383 /// server is being asked to create a unique Id. Otherwise,
8484 /// this should be of a type conforming to `IdType`.
85- var id : ID { get }
85+ var id : Id { get }
8686
8787 /// The JSON API compliant attributes of this `Entity`.
8888 var attributes : Attributes { get }
@@ -121,15 +121,14 @@ public protocol IdentifiableResourceObjectType: ResourceObjectType, Relatable wh
121121/// See https://jsonapi.org/format/#document-resource-objects
122122public struct ResourceObject < Description: JSONAPI . ResourceObjectDescription , MetaType: JSONAPI . Meta , LinksType: JSONAPI . Links , EntityRawIdType: JSONAPI . MaybeRawId > : ResourceObjectType {
123123
124- public typealias ID = JSONAPI . Id < EntityRawIdType , Self >
125124 public typealias Meta = MetaType
126125 public typealias Links = LinksType
127126
128127 /// The `ResourceObject`'s Id. This can be of type `Unidentified` if
129128 /// the entity is being created clientside and the
130129 /// server is being asked to create a unique Id. Otherwise,
131130 /// this should be of a type conforming to `IdType`.
132- public let id : ID
131+ public let id : ResourceObject . Id
133132
134133 /// The JSON API compliant attributes of this `ResourceObject`.
135134 public let attributes : Description . Attributes
@@ -143,7 +142,7 @@ public struct ResourceObject<Description: JSONAPI.ResourceObjectDescription, Met
143142 /// Links related to the entity.
144143 public let links : LinksType
145144
146- 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 ) {
147146 self . id = id
148147 self . attributes = attributes
149148 self . relationships = relationships
@@ -164,7 +163,9 @@ extension ResourceObject: Hashable where EntityRawIdType: RawIdType {
164163 }
165164}
166165
167- 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+ }
168169
169170@available ( OSX 10 . 15 , iOS 13 , tvOS 13 , watchOS 6 , * )
170171extension ResourceObject : Swift . Identifiable where EntityRawIdType: JSONAPI . RawIdType { }
@@ -178,7 +179,7 @@ extension ResourceObject: CustomStringConvertible {
178179// MARK: - Convenience initializers
179180extension ResourceObject where EntityRawIdType: CreatableRawIdType {
180181 public init ( attributes: Description . Attributes , relationships: Description . Relationships , meta: MetaType , links: LinksType ) {
181- self . id = ResourceObject . ID ( )
182+ self . id = ResourceObject . Id ( )
182183 self . attributes = attributes
183184 self . relationships = relationships
184185 self . meta = meta
@@ -409,7 +410,7 @@ public extension ResourceObject {
409410 }
410411
411412 let maybeUnidentified = Unidentified ( ) as? EntityRawIdType
412- 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)
413414
414415 do {
415416 attributes = try ( NoAttributes ( ) as? Description . Attributes)
0 commit comments