@@ -52,27 +52,31 @@ public struct ToOneRelationship<Identifiable: JSONAPI.JSONAPIIdentifiable, IdMet
5252 public let meta : MetaType
5353 public let links : LinksType
5454
55- public init ( id: Identifiable . ID , meta: MetaType , links: LinksType ) where IdMetaType == NoIdMetadata {
56- self . id = id
57- self . idMeta = . none
55+ public init ( id: ( Identifiable . ID , IdMetaType ) , meta: MetaType , links: LinksType ) {
56+ self . id = id. 0
57+ self . idMeta = id . 1
5858 self . meta = meta
5959 self . links = links
6060 }
61+ }
6162
62- public init ( id: ( Identifiable . ID , IdMetaType ) , meta: MetaType , links: LinksType ) {
63- self . id = id. 0
64- self . idMeta = id. 1
63+ extension ToOneRelationship where IdMetaType == NoIdMetadata {
64+ public init ( id: Identifiable . ID , meta: MetaType , links: LinksType ) {
65+ self . id = id
66+ self . idMeta = . none
6567 self . meta = meta
6668 self . links = links
6769 }
6870}
6971
7072extension ToOneRelationship where MetaType == NoMetadata , LinksType == NoLinks {
71- public init ( id: Identifiable . ID ) where IdMetaType == NoIdMetadata {
73+ public init ( id: ( Identifiable . ID , IdMetaType ) ) {
7274 self . init ( id: id, meta: . none, links: . none)
7375 }
76+ }
7477
75- public init ( id: ( Identifiable . ID , IdMetaType ) ) {
78+ extension ToOneRelationship where IdMetaType == NoIdMetadata , MetaType == NoMetadata , LinksType == NoLinks {
79+ public init ( id: Identifiable . ID ) {
7680 self . init ( id: id, meta: . none, links: . none)
7781 }
7882}
@@ -138,13 +142,6 @@ public struct ToManyRelationship<Relatable: JSONAPI.Relatable, IdMetaType: JSONA
138142 public let meta : MetaType
139143 public let links : LinksType
140144
141-
142- public init ( ids: [ Relatable . ID ] , meta: MetaType , links: LinksType ) where IdMetaType == NoIdMetadata {
143- self . metaIds = ids. map { . init( id: $0, meta: . none) }
144- self . meta = meta
145- self . links = links
146- }
147-
148145 public init ( idsWithMetadata ids: [ ( Relatable . ID , IdMetaType ) ] , meta: MetaType , links: LinksType ) {
149146 self . metaIds = ids. map ( ID . init)
150147 self . meta = meta
@@ -170,11 +167,15 @@ public struct ToManyRelationship<Relatable: JSONAPI.Relatable, IdMetaType: JSONA
170167 }
171168}
172169
173- extension ToManyRelationship where MetaType == NoMetadata , LinksType == NoLinks {
174-
175- public init ( ids: [ Relatable . ID ] ) where IdMetaType == NoIdMetadata {
176- self . init ( ids: ids, meta: . none, links: . none)
170+ extension ToManyRelationship where IdMetaType == NoIdMetadata {
171+ public init ( ids: [ Relatable . ID ] , meta: MetaType , links: LinksType ) {
172+ self . metaIds = ids. map { . init( id: $0, meta: . none) }
173+ self . meta = meta
174+ self . links = links
177175 }
176+ }
177+
178+ extension ToManyRelationship where MetaType == NoMetadata , LinksType == NoLinks {
178179
179180 public init ( idsWithMetadata ids: [ ( Relatable . ID , IdMetaType ) ] ) {
180181 self . init ( idsWithMetadata: ids, meta: . none, links: . none)
@@ -193,6 +194,12 @@ extension ToManyRelationship where MetaType == NoMetadata, LinksType == NoLinks
193194 }
194195}
195196
197+ extension ToManyRelationship where IdMetaType == NoIdMetadata , MetaType == NoMetadata , LinksType == NoLinks {
198+ public init ( ids: [ Relatable . ID ] ) {
199+ self . init ( ids: ids, meta: . none, links: . none)
200+ }
201+ }
202+
196203public protocol JSONAPIIdentifiable : JSONTyped {
197204 associatedtype ID : Equatable
198205}
0 commit comments