Installation
- go get github.com/rakyll/statik
- go get -u github.com/go-swagger/go-swagger/cmd/swagger #For downloading the Go Swagger to create the spec using the swagger comments.
Steps to follow
- Add the Swagger Comments to the API added or updated using documention at https://goswagger.io/use/spec.html.
- Run GO111MODULE=off swagger generate spec -o ./swagger.yaml --scan-models from the root directory.
- cd maticnetwork/heimdall/server
- Replace the Swagger.yaml file inside swagger-ui directory with the swagger.yaml newly generated in root directly in step 2
- cd maticnetwork/heimdall/server && statik -src=./swagger-ui
- cd maticnetwork/heimdall && make build
- cd maticnetwork/heimdall && make run-server
Steps to follow for updated swagger-ui without using go-swagger
- Add the Swagger Comments to the API added or updated using documention at https://goswagger.io/use/spec.html.
- Run GO111MODULE=off swagger generate spec -o ./swagger.yaml --scan-models from the root directory.
- Copy zip file of source code from https://github.com/swagger-api/swagger-ui/releases
- Unzip the zip file. Copy the contents of dist/ from the zip to heimdall/server/swagger-ui/
- Convert the heimdall/server/swagger-ui/swagger.yaml to JSON format and place it in the same directory as the swagger.yaml file.
- In heimdall/server/swagger-ui/swagger-initializer.js change
url: "./swagger.json"
, - cd maticnetwork/heimdall/server && statik -src=./swagger-ui
Visit http://localhost:1317/swagger-ui/
Reference