Commit Graph

32 Commits

Author SHA1 Message Date
Geoff Garside b6c6609ff2 Add support for iso8601 struct tag argument (#47)
* Add support for iso8601 struct tag.

Currently only unix timestamps are supported for serialising time.Time objects. The JSON.API specification doesn't make a specific requirement on time serialisation format, though it does make a recommendation for using ISO8601.

This adds support for an additional struct tag `iso8601` which controls serialisation and deserialisation using the ISO8601 timestamp format.

* Update doc.go with information regarding iso8601 and omitempty tag arguments.
2016-09-22 13:58:07 -07:00
Aren Patel a1fa2c84a0 Feature/marshal many interface (#42)
* add support for direct use of slice of struct pointers for MarshalMany

* Added a test to ensure that whether MarshalManyPayload is called with a []interface{} or []*Struct it will produce the same desired result.

* Added a test to show how the new error type may be returned.

* Ensure the outside accessible Errs have comments.

* Page char width cleanup. Addressed warnings about duplicated "client-id" definition; using the const.
2016-09-12 22:12:42 -07:00
Aren Patel a70d58d3c8 Support pointers as attrs (#40)
* add support to unmarshal attributes to struct field that are ptr types

* Spacing, addressed all the linter warnings, comments to describe errors, cleanup, left a TODO note to resolve the Error messaging.
2016-07-22 18:34:38 -07: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
Luke Young 57819f3b34 Follow Golang naming specifications 2016-07-05 20:32:15 -05:00
Brandon Bloom 5b0e148a11 Improve ErrTypeMismatch error message 2016-04-08 17:34:02 -07:00
Sam Woodard e1b87012d8 add support for more numeric types and pointers to 2016-01-12 10:00:18 -08:00
Sam Woodard d4c1f40f1d optimizations, refactors 2016-01-05 13:13:24 -08:00
Sam Woodard d336c1b556 fix with included and handle string array value 2015-10-28 10:08:50 -07:00
Sam Woodard 04da7d3cac Add UnmarshalManyPayload 2015-10-27 09:29:56 -07:00
Sam Woodard 438e9b0626 add support for pointers to time and if nil put null in json response 2015-10-13 09:10:10 -07:00
Sam Woodard 57cb7c9f3f Merge remote-tracking branch 'origin/master' into client-ids
* origin/master:
  Fix issue #10 to avoid panics with invalid JSON
2015-10-12 11:08:23 -07:00
Sam Woodard d9645f7f7e major code simplification while making client ids work 2015-09-17 15:55:53 -07:00
Sam Woodard 10e0987b5d start supporting client ids 2015-09-10 15:55:51 -07:00
Christian Klotz b11e9985b4 Fix issue #10 to avoid panics with invalid JSON 2015-08-29 18:29:58 +01:00
Sam Woodard 23302de79c paniced before when added Blog field to Post 2015-07-20 16:10:52 -07:00
Sam Woodard 8bd36714e8 fix code doc indentation 2015-07-13 15:04:21 -07:00
Sam Woodard 6fb6757b35 lots more docs 2015-07-13 11:23:03 -07:00
Sam Woodard c82586a2bb godocs for UnmarshalPayload 2015-07-13 09:50:57 -07:00
Sam Woodard b112561a72 support unmarshal sideloaded records for two-way function 2015-07-10 11:41:54 -07:00
Sam Woodard 0becfab81d remove 'JsonApi' everywhere, since we're already in a pkg 2015-07-10 09:07:12 -07:00
Sam Woodard d8d9d87573 simplification, whitespace 2015-07-10 08:30:59 -07:00
Sam Woodard 84eed2060a remove arg len check since we already do it above 2015-07-10 08:20:49 -07:00
Sam Woodard a228611aa0 skip field if attr is not in the hash 2015-07-09 12:27:03 -07:00
Sam Woodard beb1f77731 explicitly check for float64 2015-07-08 13:14:14 -07:00
Sam Woodard 7430fd0b0c dry off, error if tag does not contain two arguments 2015-07-08 11:49:36 -07:00
Sam Woodard 8de6c952ef test request relationships, nested relationships 2015-07-08 09:35:20 -07:00
Sam Woodard fdc14b7be4 handle embedded records for requests 2015-07-07 15:46:20 -07:00
Sam Woodard 81bf23f93f support marshalling a list of models 2015-07-07 09:52:38 -07:00
Sam Woodard f4c5ee491c switch to using unix timestamps in payloads 2015-07-06 14:35:17 -07:00
Sam Woodard 3fbd60ec33 reorg 2015-07-06 13:41:38 -07:00
Sam Woodard 8be7afb2fe deserialize request id and attrs, including parsing time 2015-07-06 13:40:43 -07:00