11# jsonapi
22
3- [ ![ Build Status] ( https://travis-ci.org/google/jsonapi.svg?branch=master )] ( https://travis-ci.org/google/jsonapi )
4- [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/google/jsonapi )] ( https://goreportcard.com/report/github.com/google/jsonapi )
5- [ ![ GoDoc] ( https://godoc.org/github.com/google/jsonapi?status.svg )] ( http://godoc.org/github.com/google/jsonapi )
6- [ ![ No Maintenance Intended] ( http://unmaintained.tech/badge.svg )] ( http://unmaintained.tech/ )
3+ ![ Build Status] ( https://github.com/hashicorp/jsonapi/actions/workflows/ci.yml/badge.svg?main )
4+ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/hashicorp/jsonapi )
5+ ![ GoDoc] ( https://godoc.org/github.com/hashicorp/jsonapi?status.svg )
76
87A serializer/deserializer for JSON payloads that comply to the
9- [ JSON API - jsonapi.org] ( http://jsonapi.org ) spec in go.
10-
8+ [ JSON API - jsonapi.org] ( http://jsonapi.org ) v1.1 spec in go.
119
10+ This package was forked from [ google/jsonapi] ( https://github.com/google/jsonapi ) and
11+ adds several enhancements such as [ links] ( #links ) and [ polymorphic relationships] ( #polyrelation ) .
1212
1313## Installation
1414
1515```
16- go get -u github.com/google /jsonapi
16+ go get -u github.com/hashicorp /jsonapi
1717```
1818
1919Or, see [ Alternative Installation] ( #alternative-installation ) .
@@ -91,9 +91,9 @@ To run,
9191* Make sure you have [ Go installed] ( https://golang.org/doc/install )
9292* Create the following directories or similar: ` ~/go `
9393* Set ` GOPATH ` to ` PWD ` in your shell session, ` export GOPATH=$PWD `
94- * ` go get github.com/google /jsonapi ` . (Append ` -u ` after ` get ` if you
94+ * ` go get github.com/hashicorp /jsonapi ` . (Append ` -u ` after ` get ` if you
9595 are updating.)
96- * ` cd $GOPATH/src/github.com/google /jsonapi/examples `
96+ * ` cd $GOPATH/src/github.com/hashicorp /jsonapi/examples `
9797* ` go build && ./examples `
9898
9999## ` jsonapi ` Tag Reference
@@ -234,9 +234,6 @@ struct. When accepting input values on this type of choice type, it would a good
234234and check that the value is set on only one field.
235235
236236#### ` links `
237-
238- * Note: This annotation is an added feature independent of the canonical google/jsonapi package*
239-
240237```
241238`jsonapi:"links,omitempty"`
242239```
@@ -256,7 +253,7 @@ about the rest?
256253### Create Record Example
257254
258255You can Unmarshal a JSON API payload using
259- [ jsonapi.UnmarshalPayload] ( http://godoc.org/github.com/google /jsonapi#UnmarshalPayload ) .
256+ [ jsonapi.UnmarshalPayload] ( http://godoc.org/github.com/hashicorp /jsonapi#UnmarshalPayload ) .
260257It reads from an [ io.Reader] ( https://golang.org/pkg/io/#Reader )
261258containing a JSON API payload for one record (but can have related
262259records). Then, it materializes a struct that you created and passed in
@@ -265,7 +262,7 @@ the top level, in request payloads at the moment. Bulk creates and
265262updates are not supported yet.
266263
267264After saving your record, you can use,
268- [ MarshalOnePayload] ( http://godoc.org/github.com/google /jsonapi#MarshalOnePayload ) ,
265+ [ MarshalOnePayload] ( http://godoc.org/github.com/hashicorp /jsonapi#MarshalOnePayload ) ,
269266to write the JSON API response to an
270267[ io.Writer] ( https://golang.org/pkg/io/#Writer ) .
271268
@@ -275,15 +272,15 @@ to write the JSON API response to an
275272UnmarshalPayload (in io.Reader , model interface {})
276273```
277274
278- Visit [ godoc] ( http://godoc.org/github.com/google /jsonapi#UnmarshalPayload )
275+ Visit [ godoc] ( http://godoc.org/github.com/hashicorp /jsonapi#UnmarshalPayload )
279276
280277#### ` MarshalPayload `
281278
282279``` go
283280MarshalPayload (w io.Writer , models interface {}) error
284281```
285282
286- Visit [ godoc] ( http://godoc.org/github.com/google /jsonapi#MarshalPayload )
283+ Visit [ godoc] ( http://godoc.org/github.com/hashicorp /jsonapi#MarshalPayload )
287284
288285Writes a JSON API response, with related records sideloaded, into an
289286` included ` array. This method encodes a response for either a single record or
@@ -319,7 +316,7 @@ func CreateBlog(w http.ResponseWriter, r *http.Request) {
319316UnmarshalManyPayload (in io.Reader , t reflect.Type ) ([]interface {}, error )
320317```
321318
322- Visit [ godoc] ( http://godoc.org/github.com/google /jsonapi#UnmarshalManyPayload )
319+ Visit [ godoc] ( http://godoc.org/github.com/hashicorp /jsonapi#UnmarshalManyPayload )
323320
324321Takes an ` io.Reader ` and a ` reflect.Type ` representing the uniform type
325322contained within the ` "data" ` JSON API member.
@@ -485,7 +482,7 @@ if err := validate(&myStructToValidate); err != nil {
485482MarshalOnePayloadEmbedded (w io.Writer , model interface {}) error
486483```
487484
488- Visit [ godoc] ( http://godoc.org/github.com/google /jsonapi#MarshalOnePayloadEmbedded )
485+ Visit [ godoc] ( http://godoc.org/github.com/hashicorp /jsonapi#MarshalOnePayloadEmbedded )
489486
490487This method is not strictly meant to for use in implementation code,
491488although feel free. It was mainly created for use in tests; in most cases,
0 commit comments