Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Dowling committed Dec 2, 2015
2 parents 6c7c0db + 9f2715b commit d488e7f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ Go JSON API Specification Handler
Built to handle both HTTP Client and Server needs for dealing with [JSON Specification](http://jsonapi.org/)
APIs. Great for Ember.js!

## Features
# Packages

#### Packages
### jsh - JSON Spec Handler

##### jsh - JSON Spec Handler - For Building Your OWN JSON Spec API
```go
import github.com/derekdowling/go-json-spec-handler
```

For Building Your OWN JSON Spec API

Implemented:

Expand All @@ -39,9 +43,11 @@ APIs. Great for Ember.js!
- Pagination
- Filtering

##### Subpackages:
### jsc - JSON Spec Client - For Consuming JSON Spec APIs

###### -> jsc - JSON Spec Client - For Consuming JSON Spec APIs
```go
import github.com/derekdowling/go-json-spec-handler/jsc
```

Implmented:

Expand All @@ -54,12 +60,6 @@ APIs. Great for Ember.js!
- GET Request
- PATCH Request

## Installation

```
$ go get github.com/derekdowling/go-json-spec-handler
```

## Examples

There are lots of great examples in the tests themselves that show exactly how it works, also check out the [godocs](https://godoc.org/github.com/derekdowling/go-json-spec-handler) as linked above.
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func InputError(attribute string, detail string) *Error {
}

// Assign this after the fact, easier to do
err.Source.Pointer = fmt.Sprintf("data/attributes/%s", strings.ToLower(attribute))
err.Source.Pointer = fmt.Sprintf("/data/attributes/%s", strings.ToLower(attribute))

return err
}
Expand Down
2 changes: 1 addition & 1 deletion error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestError(t *testing.T) {
testError.Status = 422

Convey("should accept a properly formatted 422 error", func() {
testError.Source.Pointer = "data/attributes/test"
testError.Source.Pointer = "/data/attributes/test"
err := validateError(testError)
So(err, ShouldBeNil)
})
Expand Down
6 changes: 3 additions & 3 deletions object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestObject(t *testing.T) {

e, ok := unmarshalErr.(*Error)
So(ok, ShouldBeTrue)
So(e.Source.Pointer, ShouldEqual, "data/attributes/foo")
So(e.Source.Pointer, ShouldEqual, "/data/attributes/foo")
})

Convey("should return a 422 Error correctly for multiple validation failures", func() {
Expand All @@ -99,8 +99,8 @@ func TestObject(t *testing.T) {

errorList, ok := unmarshalErr.(*ErrorList)
So(ok, ShouldBeTrue)
So(errorList.Errors[0].Source.Pointer, ShouldEqual, "data/attributes/foo")
So(errorList.Errors[1].Source.Pointer, ShouldEqual, "data/attributes/baz")
So(errorList.Errors[0].Source.Pointer, ShouldEqual, "/data/attributes/foo")
So(errorList.Errors[1].Source.Pointer, ShouldEqual, "/data/attributes/baz")
})

})
Expand Down
4 changes: 2 additions & 2 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestParsing(t *testing.T) {
vErr, ok := err.(*Error)
So(ok, ShouldBeTrue)
So(vErr.Status, ShouldEqual, 422)
So(vErr.Source.Pointer, ShouldEqual, "data/attributes/type")
So(vErr.Source.Pointer, ShouldEqual, "/data/attributes/type")
})
})

Expand Down Expand Up @@ -105,7 +105,7 @@ func TestParsing(t *testing.T) {
vErr, ok := err.(*Error)
So(ok, ShouldBeTrue)
So(vErr.Status, ShouldEqual, 422)
So(vErr.Source.Pointer, ShouldEqual, "data/attributes/id")
So(vErr.Source.Pointer, ShouldEqual, "/data/attributes/id")
})
})
})
Expand Down

0 comments on commit d488e7f

Please sign in to comment.