feat(api): improve codegen outputs (#41)

* Use `[]byte` for generated request bodies when the source schema has `format: byte`
* Gzip-compress request bodies when `Content-Encoding: gzip` is set
* Require that all models returned as error conditions in our API implement the `error` interface
* Move the implementation for `api.HealthCheck` out of `ping.go` and into `api/error.go`


Co-authored-by: William Baker <55118525+wbaker85@users.noreply.github.com>
This commit is contained in:
Daniel Moran
2021-04-26 10:10:45 -04:00
committed by GitHub
parent 5328b1fdc8
commit 73dc5ef63b
11 changed files with 147 additions and 40 deletions

View File

@ -70,7 +70,7 @@ func Test_PingFailedStatus(t *testing.T) {
e := "I broke"
client := &mock.HealthApi{
GetHealthExecuteFn: func(api.ApiGetHealthRequest) (api.HealthCheck, *http.Response, error) {
return api.HealthCheck{Status: api.HEALTHCHECKSTATUS_FAIL, Message: &e}, nil, nil
return api.HealthCheck{}, nil, &api.HealthCheck{Status: api.HEALTHCHECKSTATUS_FAIL, Message: &e}
},
}
@ -86,7 +86,7 @@ func Test_PingFailedStatusNoMessage(t *testing.T) {
name := "foo"
client := &mock.HealthApi{
GetHealthExecuteFn: func(api.ApiGetHealthRequest) (api.HealthCheck, *http.Response, error) {
return api.HealthCheck{Status: api.HEALTHCHECKSTATUS_FAIL, Name: name}, nil, nil
return api.HealthCheck{}, nil, &api.HealthCheck{Status: api.HEALTHCHECKSTATUS_FAIL, Name: name}
},
}