Skip to content

Releases: mattpolzin/JSONAPI

Breaking change - Rename `type` to `jsonType`

03 Jan 03:37
Compare
Choose a tag to compare

⚠️ Breaking change ⚠️
JSONTyped had a static var type: String that unnecessarily collided with Swift.type(of:). I renamed it to static var jsonType: String so to avoid the collision and save the minor headache. This is a breaking change.

Add `including()` methods to `Document`

03 Jan 01:23
Compare
Choose a tag to compare
Pre-release

Document gains including() method that allows you to easily add includes to the document (or more accurately create a new Document with the given includes added to it). There are actually two variants of this method:

  1. Take a Document with IncludeType of NoIncludes and map it to a Document with the given includes in whatever new type you would like.
  2. Take a Document with IncludeType other than NoIncludes and add more of the same type of includes to it.

Breaking change to split Attribute out into its own Type.

30 Dec 07:11
Compare
Choose a tag to compare

Realistically, this should not break very much code, but it technically has the potential to require some changes.

Attribute used to be a typealias to TransformedAttribute with an IdentityTransformer. Now, Attribute is its own Type. Although it is a bit sad to see a new Type created where a typealias used to suffice, the benefit of Attribute being its own Type is that the use of it is much more concise. Instead of Attribute offering initialization and containing Type information only relevant to TransformedAttribute, it will not have a cleaner interface.

Add ability to append/merge Includes, ManyResourceBody, and Document.Body.Data

29 Dec 03:13
Compare
Choose a tag to compare

You can now append two Includes values or ManyResourceBody values.
You can also merge two Document.Body.Data values.

Add `Include8` and `Include9` types

28 Dec 20:02
Compare
Choose a tag to compare
Pre-release

Support including up to 9 different types of entities in JSONAPI documents.

Add documentation around custom keys and encoding/decoding for Attributes

28 Dec 02:20
Compare
Choose a tag to compare
0.11.2

Add convenience method for default decoding of attributes. add tests …

Remove Codable constraint on proxies

24 Dec 15:09
Compare
Choose a tag to compare
Pre-release

This non-breaking change allows you to create EntityProxies that have Attributes or Relationships that are not Codable. The idea behind a proxy in this context is to be able to create a more convenient representation in code of something that does not need to be directly encoded or decoded.

Add convenient copy methods to Entity

22 Dec 21:47
Compare
Choose a tag to compare
Pre-release
  • [Breaking] Rename Document.Body.primaryData to Document.Body.primaryResource.
  • Add Entity.identified(by:) (create identified copy of unidentified Entity with the given Id).
  • Add Entity.Identified(byType:) (create identified copy of unidentified Entity with the given Id Type).
  • Add Entity.withNewIdentifier() (create a copy of an identified Entity with a new Id).

Remove cruft, add to TestLib

11 Dec 06:51
Compare
Choose a tag to compare
Pre-release

I Removed the many many convenience initializers on Entity and Document. They appeared to be causing the compiler strife and there was a confusing number of them available at any one time. The recommendation is to provide convenience initializers on a per-need basis instead if they offer a lot of utility to you; you can even copy the existing convenience accessors right out of the library (they are just commented out).

I also added the ability to initialize nullable attributes with literals when their wrapped type could also be initialized from that literal.

Important bug fixes and nice features

09 Dec 04:29
Compare
Choose a tag to compare
Pre-release
  • Added Pointer typealias for ToOneRelationship with no meta or links.
  • Added some missing Entity initializers.
  • Added Poly7/Include7.
  • Added relationship operator ~> support for optional relationships.
  • Added subscript access to attributes that are not AttributeType (so that computed properties do not need to be AttributeType.
  • Made it possible to add Relationships to values that are not EntityType.
  • Fixed encoding bug when Relationship is nullable (not optional, but nullable).