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 ffa0b90
Show file tree
Hide file tree
Showing 135 changed files with 14,022 additions and 10,624 deletions.
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ deb_%: clean docker_build_%
itest_%: deb_%
@echo "Built package for $*"

gen-paasta-api:
openapi-codegen:
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 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
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ require (
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 All @@ -25,7 +20,7 @@ require (
github.com/subosito/gotenv v1.2.0
go.uber.org/zap v1.13.0 // indirect
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 // indirect
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 // indirect
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // from openapi-codegen
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gopkg.in/yaml.v2 v2.2.4
k8s.io/api v0.0.0-20190409021203-6e4e0e4f393b
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 h1:pE8b58s1HRDMi8RDc79m0HISf9D4TzseP40cEA6IGfs=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
Loading

0 comments on commit ffa0b90

Please sign in to comment.