Commit Graph

201 Commits

Author SHA1 Message Date
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 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
Marc Abramowitz b28beab7f3 Add TestUnmarshalNestedStructPtr 2018-01-17 13:02:30 -08:00
Marc Abramowitz e3c0871f34 Test more things in TestUnmarshalNestedStruct 2018-01-17 08:12:59 -08:00
Slemgrim 0400041771 fix wrong type for formatting 2017-11-21 19:15:24 +08:00
Slemgrim a6577dfae8 Add more speaking tests
tests should have an expected outcome vs. an actual outcome to make them easier to debug
2017-11-21 19:05:50 +08:00
Slemgrim 7e5c9014d9 Merge remote-tracking branch 'upstream/master' 2017-11-21 18:42:48 +08:00
Sam Woodard e0fc4eed33
Merge pull request #118 from themccallister/patch-1
Add tests for mismatching accept headers
2017-11-08 09:49:09 -08:00
Jason McCallister 081fb8a5c2 Add additional test for method not found 2017-10-23 22:46:32 -04:00
Jason McCallister c036316c9d Add tests for mismatching accept headers 2017-10-23 22:41:44 -04:00
Aren Patel a06052dd83
Run gofmt -s to simplifiy. 2017-09-13 12:59:59 -07:00
Aren Patel 8d89a9020f
Fix comment. 2017-09-13 12:56:47 -07:00
Aren Patel 2ce5c379b0
Address go lint comments for the examples. 2017-09-13 12:56:01 -07:00
Aren Patel 5e0c586099
Corrected spelling mistakes. 2017-09-13 12:52:31 -07:00
Aren Patel 3b01bb5fe6
Added go report card. 2017-09-13 12:49:52 -07:00
Aren Patel 3e6ead0f9d
Test against 1.9 2017-09-05 11:11:09 -04:00
Markus Ritberger fc6968dfe7 change nested structs to json annotation instead of json:api. It never made sense to use json:api annotation in nested structs 2017-08-14 20:41:26 +02:00
Markus Ritberger b391a84b75 remove duplicated code 2017-08-14 20:39:14 +02:00
Aren Patel c045c87aa1
Ignore Gogland files. 2017-08-01 11:45:13 -07:00
Slemgrim af21dba1b2 handle nested struct slices 2017-07-15 15:22:03 +02:00
Slemgrim 0c97f0cf8d extract attribute handling into custom method for recursive usage later on 2017-07-11 21:43:12 +02:00
Slemgrim ab915ccbc1 unify type handler 2017-07-10 22:50:43 +02:00
Slemgrim f0b268e046 Merge remote-tracking branch 'upstream/master' 2017-07-10 22:16:45 +02:00
Slemgrim ec077ed283 Merge branch 'master' of https://github.com/Slemgrim/jsonapi 2017-07-10 22:12:10 +02:00
Slemgrim e13a19922d extract type handling 2017-07-10 22:09:01 +02:00
Aren Patel 46d3ced043 Added support for implementing the Linkable and Metable interface on collections (slices) being Marshalled. (#94) 2017-07-07 17:58:51 -07:00
Aren Patel cf83b97b3d Public Marshal API Simplification (#90)
* Used to have 6 functions: MarshalOnePayload, MarshalOnePayloadWithoutIncluded, MarshalOne, MarshalManyPayload, MarshalManyPayloadWithoutIncluded, MarshalMany - now there are only 3: MarshalPayload, MarshalPayloadWithoutIncluded, Marshal. This simplifies the public API; will be easier to explain and document while still providing the existing support for struct ptrs (&Blog{}) and slices of struct ptrs ([]*Blog{}).

* Correcting all code occurrences leftover.

* Updating README to reflect Marshal API changes.

* Omit the mention of One vs Many
2017-06-28 17:30:09 -07:00