0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

swagger: rename 'docs/' to 'swagger/'

Use 'docs/' for zot-related documentation.

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
Ramkumar Chinchani 2021-10-20 21:01:06 +00:00 committed by Ramkumar Chinchani
parent 0d28feef3e
commit 8f3d7d3719
7 changed files with 14 additions and 14 deletions

View file

@ -8,18 +8,18 @@ TMPDIR := $(shell mktemp -d)
STACKER := $(shell which stacker) STACKER := $(shell which stacker)
.PHONY: all .PHONY: all
all: doc binary binary-minimal debug test test-clean check all: swagger binary binary-minimal debug test test-clean check
.PHONY: binary-minimal .PHONY: binary-minimal
binary-minimal: doc binary-minimal: swagger
go build -tags minimal,containers_image_openpgp -v -ldflags "-X github.com/anuvu/zot/pkg/api.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api.BinaryType=minimal" -o bin/zot-minimal ./cmd/zot go build -tags minimal,containers_image_openpgp -v -ldflags "-X github.com/anuvu/zot/pkg/api.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api.BinaryType=minimal" -o bin/zot-minimal ./cmd/zot
.PHONY: binary .PHONY: binary
binary: doc binary: swagger
go build -tags extended,containers_image_openpgp -v -ldflags "-X github.com/anuvu/zot/pkg/api.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api.BinaryType=extended" -o bin/zot ./cmd/zot go build -tags extended,containers_image_openpgp -v -ldflags "-X github.com/anuvu/zot/pkg/api.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api.BinaryType=extended" -o bin/zot ./cmd/zot
.PHONY: debug .PHONY: debug
debug: doc debug: swagger
go build -tags extended,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X github.com/anuvu/zot/pkg/api.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api.BinaryType=extended" -o bin/zot-debug ./cmd/zot go build -tags extended,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X github.com/anuvu/zot/pkg/api.Commit=${COMMIT} -X github.com/anuvu/zot/pkg/api.BinaryType=extended" -o bin/zot-debug ./cmd/zot
.PHONY: test .PHONY: test
@ -42,12 +42,12 @@ check: ./golangcilint.yaml
golangci-lint --version || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.26.0 golangci-lint --version || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.26.0
golangci-lint --config ./golangcilint.yaml run --enable-all --build-tags extended,containers_image_openpgp ./cmd/... ./pkg/... golangci-lint --config ./golangcilint.yaml run --enable-all --build-tags extended,containers_image_openpgp ./cmd/... ./pkg/...
docs/docs.go: swagger/docs.go:
swag -v || go install github.com/swaggo/swag/cmd/swag swag -v || go install github.com/swaggo/swag/cmd/swag
swag init -g pkg/api/routes.go swag init -o swagger -g pkg/api/routes.go
.PHONY: doc .PHONY: swagger
doc: docs/docs.go swagger: swagger/docs.go
.PHONY: update-licenses .PHONY: update-licenses
update-licenses: update-licenses:

0
docs/README.md Normal file
View file

View file

@ -21,11 +21,11 @@ import (
"strconv" "strconv"
"strings" "strings"
_ "github.com/anuvu/zot/docs" // as required by swaggo
"github.com/anuvu/zot/errors" "github.com/anuvu/zot/errors"
ext "github.com/anuvu/zot/pkg/extensions" ext "github.com/anuvu/zot/pkg/extensions"
"github.com/anuvu/zot/pkg/log" "github.com/anuvu/zot/pkg/log"
"github.com/anuvu/zot/pkg/storage" "github.com/anuvu/zot/pkg/storage"
_ "github.com/anuvu/zot/swagger" // as required by swaggo
"github.com/gorilla/mux" "github.com/gorilla/mux"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
ispec "github.com/opencontainers/image-spec/specs-go/v1" ispec "github.com/opencontainers/image-spec/specs-go/v1"
@ -93,7 +93,7 @@ func (rh *RouteHandler) SetupRoutes() {
g.HandleFunc("/", g.HandleFunc("/",
rh.CheckVersionSupport).Methods("GET") rh.CheckVersionSupport).Methods("GET")
} }
// swagger docs "/swagger/v2/index.html" // swagger swagger "/swagger/v2/index.html"
rh.c.Router.PathPrefix("/swagger/v2/").Methods("GET").Handler(httpSwagger.WrapHandler) rh.c.Router.PathPrefix("/swagger/v2/").Methods("GET").Handler(httpSwagger.WrapHandler)
// Setup Extensions Routes // Setup Extensions Routes
if rh.c.Config != nil && rh.c.Config.Extensions != nil { if rh.c.Config != nil && rh.c.Config.Extensions != nil {

View file

@ -2,7 +2,7 @@
// This file was generated by swaggo/swag at // This file was generated by swaggo/swag at
// 2019-12-11 12:03:05.055900322 -0800 PST m=+0.052058015 // 2019-12-11 12:03:05.055900322 -0800 PST m=+0.052058015
package docs package swagger
import ( import (
"bytes" "bytes"

View file

@ -1,15 +1,15 @@
package docs_test package swagger_test
import ( import (
"testing" "testing"
"github.com/anuvu/zot/docs" "github.com/anuvu/zot/swagger"
. "github.com/smartystreets/goconvey/convey" . "github.com/smartystreets/goconvey/convey"
) )
func TestDocs(t *testing.T) { func TestDocs(t *testing.T) {
Convey("Read docs", t, func() { Convey("Read docs", t, func() {
s := docs.New() s := swagger.New()
So(s.ReadDoc(), ShouldNotBeEmpty) So(s.ReadDoc(), ShouldNotBeEmpty)
}) })
} }