Skip to content

Releases: lode/jsonapi

v1.5.0: better link objects

30 Jun 14:37
e75477b

Choose a tag to compare

This has some much needed improvements on how jsonapi handles link objects.

Mainly, it makes it way easier to follow the spec for adding links, see #10 for the structure change. Basically you can now:

  1. Use add_link('search', 'https://google.com') and get:
{
	"links": {
		"search": "https://google.com"
	}
}
  1. Or use add_link('search', 'https://google.com', $meta=['label'=>'Look it up']) and get:
{
	"links": {
		"search": {
			"href": "https://google.com",
			"meta": {
				"label": "Look it up"
			}
		},
	}
}

Before, you had to create this switch and structure manually.

You can still pass an array or object as second argument and skip the metadata to use your own structure for the link object.

Other changes

  • a self link can also have metadata by using add_self_link_meta() or set_self_link()
  • an error object's about link can also contain metadata
  • links can be added to errors and collection documents (both now also have add_link() and fill_links()
  • custom links can be added to a resource document's root-level

v1.4.1: fix to-many relationships to follow the spec

23 Mar 13:21
b94cfae

Choose a tag to compare

A fix for to-many relationships to follow the spec.

v1.4.0: improve nesting and to-many relationships

23 Mar 13:21
5cfae1a

Choose a tag to compare

A bunch of small but important improvements to relationships:

  • Relationships now can also be of the to-many type, thanks @Pierozi! (#17, see example)
  • Nesting relationships; when adding a relationship which has a relationship on itself, the latter is also added to the included set of the parent (#27, see example)
  • Nesting meta-data; root-level meta of a resource is passed to a collection's root-level meta, and root-level meta of a relationship is passed to its parent (#28)

Another unrelated change:

  • Allowing responses with only meta data and no primary data, thanks @tstrijdhorst! (#26)

v1.3.1: fixes exceptions

09 Aug 14:03
d7dc6c3

Choose a tag to compare

  • exceptions threw an exception since jsonp support was added
  • exceptions out of direct control which used non-400/500 error codes couldn't be added to the errors collection

v1.3.0: adds jsonp support

15 Jun 06:03

Choose a tag to compare

This makes it possible to send the jsonapi response in a jsonp callback container.
Thanks @lthh89vt for adding this!

v1.2.1: fixes exception during exception handling

23 Jan 13:43

Choose a tag to compare

v1.2.0: improve http status handling and ease exception-to-jsonapi rendering

19 Jul 15:56

Choose a tag to compare

This is the second part of v1.1.0, adding:

  • throwing jsonapi\exception which can be used to output jsonapi errors responses directly (#11)
  • easily set http status on non-error responses (created, no content, redirects, etc) (#19)
  • set redirect locations (#19)

Minor ones:

  • manually sent http status headers, instead of jsonapi doing it automatically for you (#19)
  • fixes/syncs declaration errors->send_response() with its parent (#19)

v1.1.2: fixes exceptions without file reference

09 Jul 19:22

Choose a tag to compare

Merge branch 'fix-undefined-trace-file'

v1.1.1: fixes meta objects on error responses

17 Jun 19:48

Choose a tag to compare

v1.1.0: better error handling

15 Jun 20:33

Choose a tag to compare

This release improves errors handling and processing a bit:

  • error messages and exception meta data is automatically hidden on production environments, using display_errors (#6)
  • exception meta data has improved display in errors responses (#7)
  • content type is always send out as utf-8 (#13)
  • easy constants are available for error documents, i.e. using jsonapi\base::STATUS_METHOD_NOT_ALLOWED instead of 405 (https://github.com/lode/jsonapi/pull/12/files)

Next up is an easy way to go from thrown exceptions directly to an error response. See #11.