Commit Graph

25 Commits

Author SHA1 Message Date
Aren Patel 3ea9ec4904 Testing and Documentation for UnmarshalManyPayload (#66)
* Added a test for UnmarshalManyPayload

* Document UnmarshalManyPayload in the Readme

* Update the example app to have a UnmarshalManyPayload usage.

* DRY the UnmarshalManyPayload implementation.

* Add a test for grabbing the Links out of a ManyPayload
2017-01-26 15:25:13 -08:00
Aren Patel 15abc3066a Use constants for status codes, HTTP methods and JSON API media types in comments and readme 2017-01-20 18:06:44 -08:00
Kyle Truscott 46a5b96356 Add support for 'links' via optional interfaces (#57)
* Implement `links` via optional interfaces

* Updating example app to include links

* Update readme with links information

* Exclude a slice relationship only if the slice is empty AND there are no defined links

* Remove `Link` in favor of vanilla `map[string]interface{}`. More flexible for different allowed links spec implementations.

* Update app.go with correct Links methods

* Use LinksObject and LinkObject types along with type assertion to provide errors when marshaling an invalid links JSON API object.

* Renamed LinksObject Links and LinkObject Link

* Added back the relationship link post merge.

* Renamed the JSON* Linkable functions JSONAPI* such that when a library user implements the interface it is clear the functions are used for JSON API as opposed to JSON

* Example cleanup.

* Refactor the example to use constants from jsonapi and http.
2017-01-20 17:55:59 -08:00
Aren Patel 2cb19b89ed Skimata's null relationships + fixes (#62)
* Add support to nullify relationship; http://jsonapi.org/format/#document-resource-object-linkage

* Fixed: [null] is not valid as an empty relationship.

* add support for 'omitempty' on relationships; default behavior of marshalling empty/nil relations (i.e. w/o 'omitempty' tag) marshals with null data relation

* cleanup whitespace

* Added go 1.7 to test versions; fixed the marshaling of empty relations to return an empty array rather than a null/nil. Added a more robust test case for the marshaling of non omitted relations.

* Cleanup.

* Added a comment to UnmarshalMany

* Document the ‘omitempty’ annotation on a relation.

* Add common JSON API values as exported jsonapi pkg constants.
2017-01-20 16:13:04 -08:00
Aren Patel dd46e31eb5 Updated: build status badge, the go get installation instruction to account for the repo move, readme examples use ID instead of Id (so that they would be linter compliant if copy/pasted). shwoodard/jsonapi => google/jsonapi (#41) 2016-07-22 18:31:33 -07:00
Aren Patel de4994e265 Feature/omitempty (#35)
* Implemented a failing test demonstrating the intended behaviour of the omitempty annotation.

* Updated the failing test to ensure that unset field without the "omitempty" annotation are not inadvertently omitted.

* Working implementation of the "omitempty" annotation for fields that are of any type.

* Update the readme to include a brief description of how to use the `omitempty` in a attr field.

* Update the json example also using a uint for type variety.
2016-07-16 08:24:21 -07:00
Sean W. Richardson 0f0ccecbdb Fix typo in example app go get text. 2015-08-24 19:53:05 -05:00
Dennis Faust 0af952c6c4 Small edits to readme. Standardize on JSON API. 2015-08-18 14:22:19 -07:00
Sam Woodard 789321ddea fix readme subtree install url 2015-07-31 21:48:48 -07:00
Aren Patel 6522035828 Updated GitHub url - fixes #4 2015-07-24 22:06:38 -07:00
Sam Woodard 853b80c07a add alternative installation with subtress docs 2015-07-19 10:55:51 -07:00
Sam Woodard 0554b45f81 proof read, fixes, clarifications, add installation 2015-07-19 10:32:22 -07:00
Sam Woodard b8389265b6 typo fix 2015-07-13 14:51:26 -07:00
Sam Woodard 48a0031e3a typo fix 2015-07-13 14:49:36 -07:00
Sam Woodard dde4d75da4 fix link 2015-07-13 14:04:08 -07:00
Sam Woodard 3574efbd33 link to godoc 2015-07-13 14:02:26 -07:00
Sam Woodard bc547ac735 more docs including package desc for godoc 2015-07-13 11:59:11 -07:00
Sam Woodard 9333e9b531 add build status badge to readme md 2015-07-13 11:34:03 -07:00
Sam Woodard 6fb6757b35 lots more docs 2015-07-13 11:23:03 -07:00
Sam Woodard e7bd3d1fbc more docs for MarshalMany 2015-07-13 10:44:47 -07:00
Sam Woodard d9a31fb056 add more docs 2015-07-13 10:10:11 -07:00
Sam Woodard c5ab82d971 fix link 2015-07-13 10:07:55 -07:00
Sam Woodard 1514449cab work on README 2015-07-13 10:07:12 -07:00
Sam Woodard ffcbb660c3 readme work and an example app 2015-07-10 13:50:51 -07:00
Sam Woodard fcfbda00d2 licence and begin readme 2015-07-08 16:48:13 -07:00