Skip to content

Commit

Permalink
Install latest go-swagger while generation of models (#1694)
Browse files Browse the repository at this point in the history
We will update to latest go-swagger before generation of
code from swagger.yml

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
  • Loading branch information
shtripat authored Jul 25, 2023
1 parent c482471 commit e0ab20e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Set up swagger
run: |
download_url="https://github.com/go-swagger/go-swagger/releases/download/v0.30.4/swagger_linux_amd64"
curl -o /usr/local/bin/swagger -L'#' "$download_url"
chmod +x /usr/local/bin/swagger
go install github.com/go-swagger/go-swagger/cmd/swagger@latest
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ clean-swagger:
@rm -rf models
@rm -rf api/operations

install-go-swagger:
@echo "installing latest go-swagger"
@go install github.com/go-swagger/go-swagger/cmd/swagger@latest

swagger-operator:
@echo "Generating swagger server code from yaml"
@swagger generate server -A operator --main-package=operator --server-package=api --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
@echo "Generating typescript api"
@npx swagger-typescript-api -p ./swagger.yml -o ./web-app/src/api -n operatorApi.ts
@(cd web-app && npm install -g prettier && prettier -w .)

swagger-gen: clean-swagger swagger-operator apply-gofmt
swagger-gen: install-go-swagger clean-swagger swagger-operator apply-gofmt
@echo "Done Generating swagger server code from yaml"

assets:
Expand Down Expand Up @@ -171,4 +175,4 @@ models-gen:
// along with this program. If not, see <http://www.gnu.org/licenses/>.\n\
//\n\
" ./models/{}
@rm -rf client
@rm -rf client

0 comments on commit e0ab20e

Please sign in to comment.