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

View File

@ -26,13 +26,8 @@ export GO_TEST=go test
GO_TEST_PATHS=./...
### Build / dependency management
internal/api/types.gen.go: internal/api/api.yml internal/api/gen.go
go generate ./api
internal/api/client.gen.go: internal/api/api.yml internal/api/gen.go
go generate ./api
openapi: internal/api/types.gen.go internal/api/client.gen.go
openapi:
./etc/generate-openapi.sh
fmt: $(SOURCES_NO_VENDOR)
gofmt -w -s $^
@ -41,17 +36,15 @@ fmt: $(SOURCES_NO_VENDOR)
bin/$(GOOS)/influx: $(SOURCES)
$(GO_BUILD) -o $@ ./cmd/$(shell basename "$@")
.DEFAULT_GOAL := influx
influx: bin/$(GOOS)/influx
vendor: go.mod go.sum
go mod vendor
build: openapi fmt influx
clean:
$(RM) -r bin
$(RM) -r vendor
$(RM) internal/api/types.gen.go internal/api/client.gen.go
### Linters
checkfmt:
@ -60,6 +53,9 @@ checkfmt:
checktidy:
./etc/checktidy.sh
checkopenapi:
./etc/checkopenapi.sh
staticcheck: $(SOURCES) vendor
go run honnef.co/go/tools/cmd/staticcheck -go $(GOVERSION) ./...