Skip to content

Commit fcc1796

Browse files
committed
Expose Entity properties on EntityType protocol.
1 parent 921bcef commit fcc1796

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Sources/JSONAPI/Resource/Entity.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ public protocol EntityType: PrimaryResource {
4343

4444
typealias Attributes = Description.Attributes
4545
typealias Relationships = Description.Relationships
46+
47+
/// The `Entity`'s Id. This can be of type `Unidentified` if
48+
/// the entity is being created clientside and the
49+
/// server is being asked to create a unique Id. Otherwise,
50+
/// this should be of a type conforming to `IdType`.
51+
var id: Identifier { get }
52+
53+
/// The JSON API compliant attributes of this `Entity`.
54+
var attributes: Attributes { get }
55+
56+
/// The JSON API compliant relationships of this `Entity`.
57+
var relationships: Relationships { get }
4658
}
4759

4860
/// An `Entity` is a single model type that can be

0 commit comments

Comments
 (0)