Skip to content

Commit c8b4a0c

Browse files
authored
fix: swagger docs (#1283)
* fix: swagger docs * fix: swagger docs
1 parent 17e73df commit c8b4a0c

7 files changed

Lines changed: 9112 additions & 21 deletions

File tree

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,15 @@ e2e-test:
179179
# Run e2e test
180180
hack/run-e2e.sh $(OSTYPE)
181181

182-
.PHONY: test cover cover-html format lint lint-fix doc build-changelog upload clean build-all build-image build-local-linux build-local-windows build-local-linux-all build-local-windows-all e2e-test
182+
gen-api-spec: ## Generate API Specification with OpenAPI format
183+
@which swag > /dev/null || (echo "Installing swag@v1.16.3 ..."; go install github.com/swaggo/swag/cmd/swag@v1.16.3 && echo "Installation complete!\n")
184+
# Generate API documentation with OpenAPI format
185+
-swag init --parseDependency --parseInternal --parseDepth 1 -g ./kusion.go -o api/openapispec/ && echo "🎉 Done!" || (echo "💥 Fail!"; exit 1)
186+
# Format swagger comments
187+
-swag fmt -g pkg/**/*.go && echo "🎉 Done!" || (echo "💥 Failed!"; exit 1)
188+
189+
gen-api-doc: ## Generate API Documentation by API Specification
190+
@which swagger > /dev/null || (echo "Installing swagger@v0.30.5 ..."; go install github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 && echo "Installation complete!\n")
191+
-swagger generate markdown -f ./api/openapispec/swagger.json --output=docs/api.md && echo "🎉 Done!" || (echo "💥 Fail!"; exit 1)
192+
193+
.PHONY: test cover cover-html format lint lint-fix doc build-changelog upload clean build-all build-image build-local-linux build-local-windows build-local-linux-all build-local-windows-all e2e-test gen-api-spec gen-api-doc

0 commit comments

Comments
 (0)