Commit Graph

226 Commits

Author SHA1 Message Date
Aren Patel 1e07b10d47
go mod init (#205) 2021-04-05 11:13:49 -07:00
Aren Patel f3b4acfd23
RFC 3339 support for both Marshal and Unmarshal. (#204)
* RFC 3339 support for both Marshal and Unmarshal.

* Post merge cleanup

* Update request_test.go

Co-authored-by: Quetzy Garcia <quetzy.garcia@integrate.com>

* Spelling

* Update request.go

Co-authored-by: Quetzy Garcia <quetzy.garcia@integrate.com>

* Simplify the ISO 8601 logic. No need for the const rfc3339TimeFormat use time.RFC3339 directly.

Co-authored-by: Quetzy Garcia <quetzy.garcia@integrate.com>
2021-04-05 11:13:02 -07:00
Aren Patel 58702143d4
Revert "Add RFC3339 timestamp (#201)" (#203)
This reverts commit c0ee6d2554.
2021-04-03 09:11:22 -07:00
Omar Ismail c0ee6d2554
Add RFC3339 timestamp (#201)
@omarismail LGTM.

I'm curious what you think about perhaps documenting these `iso8601` and `rfc3339` in the `Readme.md`? How did you find that this tag option/value existed? How can we make this better for others vs having to search the library implementation?
2021-04-02 17:10:43 -07:00
Quetzy Garcia b10ff4bf78
[FIX] Issue 176 (#199)
* fix(request): change the order of the resource data check to prioritise the type when unmarshalling
- fixes #176

* tests(request): update the TestUnmarshalPayload_ptrsAllNil test that broke

* Using %v instead of %s

* Added a test case to demonstrate that this library follows the spec: covered the case where the incoming request payload is missing the `type` field, an error is expected.

Co-authored-by: Aren Patel <git@arenpatel.com>
2021-03-06 12:33:18 -08:00
Aren Patel 471426f0d9
Update .travis.yml 2021-02-17 13:33:41 -08:00
Matti Andreas Nielsen 4fcdb6314a
doc.go: Fix gramma 'deserialzied' -> 'deserialized' (#167) 2021-02-17 13:33:12 -08:00
Aren Patel f822737867
Update .travis.yml 2020-10-22 15:56:00 -07:00
ujjwalsh b862aa6e32
added support for linux on power (#195) 2020-10-22 15:54:02 -07:00
Aren Patel 3e3da1210d
Update README.md 2020-08-25 11:36:04 -07:00
Aren Patel c8283f632f
Update .travis.yml 2020-02-25 16:29:10 -08:00
Sam Woodard d0428f63eb
Merge pull request #165 from shwoodard/fix-lint
Fix golint
2018-10-16 08:00:55 -07:00
Sam Woodard 4a0c98e9d4 add docs for runtime.go 2018-10-16 07:34:22 -07:00
Sam Woodard e9f117e24a fix logic error, break needs to be for loop not switch 2018-10-16 07:33:57 -07:00
Sam Woodard 6bf44faa3c return function return value when is only err 2018-10-16 07:33:23 -07:00
Sam Woodard 9246c912f5
Merge pull request #159 from shwoodard/shwoodard-defined-type-attributes
Add support for attributes of custom defined types
2018-10-15 16:24:20 -07:00
Sam Woodard e22856db88 add documentation for primative custom types only 2018-10-11 09:08:03 -07:00
Sam Woodard 1947fea11f wrote failing test for example so removing from docs 2018-10-11 09:04:55 -07:00
Sam Woodard 906357051e run gofmt on package 2018-10-11 04:47:50 -07:00
Sam Woodard d9a610774a
Merge pull request #160 from google/fix-readme-typos
Fix typos
2018-10-05 12:57:15 -07:00
Sam Woodard 941c167d93
Fix typo "the the" 2018-10-05 12:52:00 -07:00
Sam Woodard 43592a3ebe
Fix typos 2018-10-05 12:50:13 -07:00
Sam Woodard ed08d4f02a refactor, consistency, add test to ensure we don't need additional type check 2018-10-05 08:57:33 -07:00
Sam Woodard d05fcd97df one line method removed 2018-10-05 08:56:32 -07:00
Sam Woodard ab24913148 adjust test so values are like from a json payload 2018-10-05 07:29:18 -07:00
CrushedPixel 87c6b8e5b5 Fixed format types 2018-10-05 07:29:06 -07:00
CrushedPixel ccac636b4b Add support for attributes of custom defined types 2018-10-05 07:10:00 -07:00
Sam Woodard 5307399ec1 add new go version to travis and remove oldest (#158) 2018-10-04 13:56:12 -07:00
Sam Woodard bdc73a22a3
Merge pull request #99 from Slemgrim/master
Unmarshalling of nested structs
2018-10-04 12:04:27 -07:00
Markus Ritberger 417d4eb8fb
Merge pull request #6 from shwoodard/shwoodard-slemgrim-pull-99
Use jsonapi struct tags for nested attrs
2018-10-04 18:04:16 +02:00
Sam Woodard 3c8221b373 use jsonapi tags for nested attrs 2018-10-03 13:51:04 -07:00
Stuart Auld 3b9f84a311 Added README to explain how to support custom types (#149) (#150)
* Added README to explain how to support custom types (#149)

* Fix incorrect docstring
2018-08-21 14:31:52 -07:00
Ilya Baturin 5d047c6bc6 fixes issue with slice of nil pointers (#144)
fixes panic in case of marshaling of slice of nils like `[]*<SomeType>{nil, nil}`
2018-06-17 19:19:26 -07:00
Markus Ritberger 8b7e0bc2c0
Merge pull request #5 from Slemgrim/refactor-ptr-error
Refactor ptr error and cleanup
2018-03-14 21:47:34 +01:00
Markus Ritberger d490a0f637 remove whitespaces and stick to 80chars 2018-03-14 21:43:51 +01:00
Markus Ritberger 72f7bad5b3 check for ptr error type in tests 2018-03-14 21:43:24 +01:00
Markus Ritberger 9bc94d8c70 replace public function with custom error type 2018-03-14 20:52:27 +01:00
Sam Woodard 2dcc18f436
Merge pull request #133 from google/u/aren55555/remove-scripts-dir
Remove the script dir, the readme documents a way to run the example …
2018-03-12 18:38:58 -07:00
Aren Patel 8127e1640e
Remove the script dir, the readme documents a way to run the example without using script/example. 2018-03-12 18:24:05 -07:00
Igor Zibarev 103c21c224 Fix omitempty for attributes (#119)
* Fix omitempty for attributes

Fix panic on omitempty field for attribute that is not of
a primitive type.

Fixes #103

* Add more types for omitempty test
2018-03-12 18:15:16 -07:00
Sam Woodard 6600c8fdc1 Remove funky go structure paths and add examples bin (#132) 2018-03-12 18:01:40 -07:00
Sam Woodard 1ac83a4625 Add go 1.10 to .travis.yml (#131) 2018-03-12 17:55:56 -07:00
Stratos Neiros bf4e01db8d Use go build instead of go run for example app (#127)
Using go run $GOPATH/src/github.com/google/jsonapi/examples/app.go as
shown in the Readme, leads to errors (#126) since go run requires all
the .go files of a program.

This commit changes the Readme to show how to run the example app using
go build to avoid this issue.
2018-03-12 17:54:39 -07:00
Markus Ritberger e428b86c25
Merge pull request #4 from msabramo/fix-test-failures
Fix test failures
2018-01-25 16:51:16 +01:00
Marc Abramowitz 7c2ceac7c5 Fix test failures 2018-01-25 07:28:20 -08:00
Markus Ritberger 21b4945ad6
Merge pull request #3 from msabramo/pr-99-make-nested-struct-ptr-work
Make nested struct pointers work
2018-01-22 12:11:07 +01:00
Markus Ritberger bb266b4483
Merge pull request #2 from msabramo/pr-99-show-type-for-ErrUnsupportedPtrType
Show type for ErrUnsupportedPtrType
2018-01-22 08:33:37 +01:00
Markus Ritberger 339909da0d
Merge pull request #1 from msabramo/msabramo-pr-99
Test more things in TestUnmarshalNestedStruct
2018-01-22 08:10:08 +01:00
Marc Abramowitz a3b3bb2cb5 Show type for ErrUnsupportedPtrType
to aid in troubleshooting.

Before:

```
Pointer type in struct is not supported
```

After:

```
jsonapi: Can't unmarshal true (bool) to struct field `Name`, which is a pointer to `string`
```
2018-01-17 13:38:32 -08:00
Marc Abramowitz 16e19ab9f9 Make nested struct pointers work 2018-01-17 13:02:30 -08:00