Skip to content

Commit

Permalink
Add documents in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
whunmr committed Mar 22, 2020
1 parent ecf0baa commit 2107ee2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,32 @@ type Account struct {
Name string `json:"name" example:"account name"`
}
```

### Model composition in response
```go
@success 200 {object} jsonresult.JSONResult{data=proto.Order} "desc"
```

```go
type JSONResult struct {
Code int `json:"code" `
Message string `json:"message"`
Data interface{} `json:"data"`
}

type Order struct { //in `proto` package
...
}
```

- also support array of objects and primitive types as nested response
```go
@success 200 {object} jsonresult.JSONResult{data=[]proto.Order} "desc"
@success 200 {object} jsonresult.JSONResult{data=string} "desc"
@success 200 {object} jsonresult.JSONResult{data=[]string} "desc"
```


### Add a headers in response

```go
Expand Down

0 comments on commit 2107ee2

Please sign in to comment.