From fcc1796731bf1c94ac6fa90064fbd2e34a112788 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Tue, 27 Nov 2018 18:58:48 -0800 Subject: [PATCH] Expose Entity properties on EntityType protocol. --- Sources/JSONAPI/Resource/Entity.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/JSONAPI/Resource/Entity.swift b/Sources/JSONAPI/Resource/Entity.swift index 0110979..b7a3031 100644 --- a/Sources/JSONAPI/Resource/Entity.swift +++ b/Sources/JSONAPI/Resource/Entity.swift @@ -43,6 +43,18 @@ public protocol EntityType: PrimaryResource { typealias Attributes = Description.Attributes typealias Relationships = Description.Relationships + + /// The `Entity`'s Id. This can be of type `Unidentified` if + /// the entity is being created clientside and the + /// server is being asked to create a unique Id. Otherwise, + /// this should be of a type conforming to `IdType`. + var id: Identifier { get } + + /// The JSON API compliant attributes of this `Entity`. + var attributes: Attributes { get } + + /// The JSON API compliant relationships of this `Entity`. + var relationships: Relationships { get } } /// An `Entity` is a single model type that can be