Skip to content

Commit d488e7f

Browse files
author
Derek Dowling
committed
Merge remote-tracking branch 'origin/master'
2 parents 6c7c0db + 9f2715b commit d488e7f

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ Go JSON API Specification Handler
88
Built to handle both HTTP Client and Server needs for dealing with [JSON Specification](http://jsonapi.org/)
99
APIs. Great for Ember.js!
1010

11-
## Features
11+
# Packages
1212

13-
#### Packages
13+
### jsh - JSON Spec Handler
1414

15-
##### jsh - JSON Spec Handler - For Building Your OWN JSON Spec API
15+
```go
16+
import github.com/derekdowling/go-json-spec-handler
17+
```
18+
19+
For Building Your OWN JSON Spec API
1620

1721
Implemented:
1822

@@ -39,9 +43,11 @@ APIs. Great for Ember.js!
3943
- Pagination
4044
- Filtering
4145

42-
##### Subpackages:
46+
### jsc - JSON Spec Client - For Consuming JSON Spec APIs
4347

44-
###### -> jsc - JSON Spec Client - For Consuming JSON Spec APIs
48+
```go
49+
import github.com/derekdowling/go-json-spec-handler/jsc
50+
```
4551

4652
Implmented:
4753

@@ -54,12 +60,6 @@ APIs. Great for Ember.js!
5460
- GET Request
5561
- PATCH Request
5662

57-
## Installation
58-
59-
```
60-
$ go get github.com/derekdowling/go-json-spec-handler
61-
```
62-
6363
## Examples
6464

6565
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.

error.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func InputError(attribute string, detail string) *Error {
118118
}
119119

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

123123
return err
124124
}

error_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestError(t *testing.T) {
3535
testError.Status = 422
3636

3737
Convey("should accept a properly formatted 422 error", func() {
38-
testError.Source.Pointer = "data/attributes/test"
38+
testError.Source.Pointer = "/data/attributes/test"
3939
err := validateError(testError)
4040
So(err, ShouldBeNil)
4141
})

object_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestObject(t *testing.T) {
7878

7979
e, ok := unmarshalErr.(*Error)
8080
So(ok, ShouldBeTrue)
81-
So(e.Source.Pointer, ShouldEqual, "data/attributes/foo")
81+
So(e.Source.Pointer, ShouldEqual, "/data/attributes/foo")
8282
})
8383

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

100100
errorList, ok := unmarshalErr.(*ErrorList)
101101
So(ok, ShouldBeTrue)
102-
So(errorList.Errors[0].Source.Pointer, ShouldEqual, "data/attributes/foo")
103-
So(errorList.Errors[1].Source.Pointer, ShouldEqual, "data/attributes/baz")
102+
So(errorList.Errors[0].Source.Pointer, ShouldEqual, "/data/attributes/foo")
103+
So(errorList.Errors[1].Source.Pointer, ShouldEqual, "/data/attributes/baz")
104104
})
105105

106106
})

request_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestParsing(t *testing.T) {
6363
vErr, ok := err.(*Error)
6464
So(ok, ShouldBeTrue)
6565
So(vErr.Status, ShouldEqual, 422)
66-
So(vErr.Source.Pointer, ShouldEqual, "data/attributes/type")
66+
So(vErr.Source.Pointer, ShouldEqual, "/data/attributes/type")
6767
})
6868
})
6969

@@ -105,7 +105,7 @@ func TestParsing(t *testing.T) {
105105
vErr, ok := err.(*Error)
106106
So(ok, ShouldBeTrue)
107107
So(vErr.Status, ShouldEqual, 422)
108-
So(vErr.Source.Pointer, ShouldEqual, "data/attributes/id")
108+
So(vErr.Source.Pointer, ShouldEqual, "/data/attributes/id")
109109
})
110110
})
111111
})

0 commit comments

Comments
 (0)