Skip to content

Commit

Permalink
use openapi codegen for paastaapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksym Melnychok committed Aug 25, 2020
1 parent d6df1b7 commit 290a117
Show file tree
Hide file tree
Showing 134 changed files with 14,123 additions and 10,622 deletions.
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ itest_%: deb_%
gen-paasta-api:
rm -rf pkg/paastaapi
mkdir -p pkg/paastaapi
rm swagger.json
curl -o swagger.json https://raw.githubusercontent.com/Yelp/paasta/master/paasta_tools/api/api_docs/swagger.json
docker run \
--rm -it \
--user "$$(id -u):$$(id -g)" \
-e GOPATH=$$HOME/go:/go \
-v $$HOME:$$HOME \
-w $$(pwd) quay.io/goswagger/swagger \
generate client -f ./swagger.json -t pkg/paastaapi
rm -f oapi.yaml
curl -o oapi.yaml https://raw.githubusercontent.com/Yelp/paasta/oapi/paasta_tools/api/api_docs/oapi.yaml
docker run --rm -i --user `id -u`:`id -g` -v `pwd`:/src \
openapitools/openapi-generator-cli:v4.3.0 generate \
-i /src/oapi.yaml \
-g go-experimental \
--package-name paastaapi \
--additional-properties=apiDocs=false,modelDocs=false,modelTests=false \
-o /src/pkg/paastaapi
find pkg/paastaapi -type f ! -name *.go -delete
@echo "Due to bug in goswagger you may need to add an import for paastaapi/client/operations"
@echo "in pkg/paastaapi/client/paasta_client.go, run 'go build ./...' to check."
@echo
Expand Down
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
module github.com/Yelp/paasta-tools-go

require (
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
github.com/dlespiau/kube-test-harness v0.0.0-20190930170435-ec3f93e1a754
github.com/fatih/structs v1.1.0
github.com/go-logr/zapr v0.1.1 // indirect
github.com/go-openapi/errors v0.19.4
github.com/go-openapi/runtime v0.19.15
github.com/go-openapi/strfmt v0.19.5
github.com/go-openapi/swag v0.19.5
github.com/go-openapi/validate v0.19.8
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
Expand Down
Loading

0 comments on commit 290a117

Please sign in to comment.