Releases: mattpolzin/JSONAPI
Bugfix for ResourceObjectProxy
Attempt to fix a bug that only shows up in edge cases where ResourceObjectProxy.ID
is used directly and must be equal to ResourceObject.ID
.
Adds Swift `Identifiable` conformance to `ResourceObject`
In order to reduce the burden of conflict on users of the library, JSONAPI.Identifiable
has been renamed to JSONAPIIdentifiable
and (for all platforms that support it) conformance to Swift.Identifiable
has been added to ResourceObject
.
Sorry to introduce a breaking change during the release candidates. Conformance to Swift.Identifiable
is really beneficial, especially if you ever pull a model into SwiftUI.
- Renamed
Identifiable
->JSONAPIIdentifiable
- Renamed
JSONAPIIdentifiable
'sIdentifier
associated type toID
to match that of the SwiftIdentifiable
type. RemovedResourceObject.Id
(i.e. consolidated so that the same type alias as is used byJSONAPIIdentifiable
andSwift.Identifiable
is just namedResourceObject.ID
). Otherwise there is a confusing co-existence of bothResourceObject.ID
andResourceObject.Id
.- [EDIT] As of the soon-to-be-released 4.0.0-rc.3.2, I will have re-introduced
ResourceObject.Id
which means thatResourceObject.ID
andResourceObject.Id
will be equally valid. Not crazy about it, but no easy and satisfactory way to deal with it before the release of 4.0.0.
Suggested approach to updating code:
- Anywhere you are using
JSONAPI.Identifiable
, findJSONAPI.Identifiable
orIdentifiable
(careful not to pick up on SwiftIdentifiable
in your codebase) and replace withJSONAPIIdentifiable
. - Anywhere you are using
Identifier()
orin the context of aId()
ResourceObject
to construct its ID, replace withID()
. [EDIT] As of 4.0.0-rc.3.2ResourceObject.ID
andResourceObject.Id
will both be equally valid.
Add relatives filtering to CompoundResource
Adds filtering of related resources to CompoundResource
.
4.0 Release Candidate 1
Changes since Alpha 3:
- Add
CompoundResource
- Add
SucceedableJSONAPIDocument
andFailableJSONAPIDocument
protocols - Make
ResourceObject
Hashable
when itsId
isHashable
. - Make
Id
'sHashable
conformance take its type into consideration since theId
type's primary motivation is to retain differentiation based on the type of thing being identified.
Additional abstraction points around resource body
Expose abstraction points around single and many resource bodies that allow generic extensions to access the primary resource value(s).
Adds a couple of convenience initializers on Document types.
Merge pull request #65 from mattpolzin/feature/add-initializers Add some convenience initializers
Fix inability to represent Relationship Objects with no `data` property.
Fixes #56.
This is a niche issue, but now a MetaRelationship
can be used in place of a ToOneRelationship
or ToManyRelationship
when a Relationship Object with only links
and/or meta
is needed.
First 4.0 Alpha Release
- Bump minimum Swift version to 5.2
- Remove deprecated subscript access to
ResourceObject
attributes. - Fix/Improve errors during decoding caused by malformed
ResourceObject
relationships. - Modify
Document.SuccessDocument
to guarantee non-optional properties where the fact that it is a success document is able to provide such guarantees. For example,.primaryResource
and.includes
are now non-optional onSuccessDocument
.
New testing feature and _much_ better errors
- Adds
JSONAPITesting
frameworkcompare(to:)
functions that deliver concise comparisons of two documents or resource objects. Just print theString(describing:)
a comparison to get a human readable description of the differences. - Adds
ResourceObjectDecodingError
andDocumentDecodingError
which represent more JSON:API-specific errors and come with good string descriptions for many common reasons why JSON:API resources or documents could fail to decode. Just catch the error from decoding aResourceObject
orDocument
and save or printString(describing: error)
.
📛 Renames JSONAPIDocument
to CodableJSONAPIDocument
.
📛 Renames OptionalPrimaryResource
to OptionalCodablePrimaryResource
.
📛 Renames PrimaryResource
to CodablePrimaryResource
.
📛 Renames ResourceBody
to CodableResourceBody
.
📛 Renames PolyWrapped
to CodablePolyWrapped
.
📛 Renames SingleResourceBody.Entity
to SingleResourceBody.PrimaryResource
📛 Renames ManyResourceBody.Entity
to ManyResourceBody.PrimaryResource
📛 Renames JSONAPIEncodingError
to JSONAPICodingError
⛔️ Deprecates subscript
access of ResourceObject
attributes in favor of key path dynamic member lookup.
🗑 Removes key path dynamic member lookup of Document
properties on Document.SuccessDocument
and Document.ErrorDocument
in favor of directly providing relevant accessors (see SuccessDocument
/ErrorDocument
for details).
Bug fixes for JSONAPITesting compare(to:)
Various bug fixes for compare(to:)
along with improved test coverage.