Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace codegenerated swagger api with openapi #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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