refactor: switch to OpenAPITools's generator for our HTTP clients (#33)

* build: add CI job to check OpenAPI generation is clean
* feat: add hidden flag for HTTP debug
This commit is contained in:
Daniel Moran
2021-04-16 17:16:58 -04:00
committed by GitHub
parent ca8a5c5364
commit 4f62e469e9
32 changed files with 2213 additions and 603 deletions

22
internal/api/error.go Normal file
View File

@ -0,0 +1,22 @@
package api
import (
"fmt"
"strings"
)
// Extension to let our API error type be used as a "standard" error.
func (o *Error) Error() string {
if o.Message != "" && o.Err != nil {
var b strings.Builder
b.WriteString(o.Message)
b.WriteString(": ")
b.WriteString(*o.Err)
return b.String()
} else if o.Message != "" {
return o.Message
} else if o.Err != nil {
return *o.Err
}
return fmt.Sprintf("<%s>", o.Code)
}