Files
Marc Carré ded7717c94 Switch from emicklei/go-restful-openapi to marccarre/go-restful-openapi
In order to remove dependencies on `Sirupsen/logrus` while emicklei/go-restful-openapi/pull/49 is getting reviewed and, hopefully, merged:
```
$ gvt delete github.com/emicklei/go-restful-openapi
$ gvt fetch --branch lowercase-sirupsen --revision 129557de7d9f2d2ca4a90cd31c379db90a561ad8 github.com/marccarre/go-restful-openapi
2018/07/23 15:50:36 Fetching: github.com/marccarre/go-restful-openapi
2018/07/23 15:50:38 · Skipping (existing): github.com/emicklei/go-restful
2018/07/23 15:50:38 · Skipping (existing): github.com/sirupsen/logrus
2018/07/23 15:50:38 · Skipping (existing): github.com/go-openapi/spec
2018/07/23 15:50:38 · Fetching recursive dependency: github.com/emicklei/go-restful-openapi
2018/07/23 15:50:40 ·· Skipping (existing): github.com/emicklei/go-restful
2018/07/23 15:50:40 ·· Fetching recursive dependency: github.com/Sirupsen/logrus
2018/07/23 15:50:43 ··· Skipping (existing): golang.org/x/sys/unix
2018/07/23 15:50:43 ··· Skipping (existing): golang.org/x/crypto/ssh/terminal
2018/07/23 15:50:43 ··· Skipping (existing): github.com/sirupsen/logrus
2018/07/23 15:50:43 ·· Skipping (existing): github.com/go-openapi/spec
```
2018-07-23 20:10:15 +02:00

21 lines
494 B
Go

package main
import (
"encoding/json"
"os"
restful "github.com/emicklei/go-restful"
restfulspec "github.com/emicklei/go-restful-openapi"
)
func main() {
config := restfulspec.Config{
WebServices: restful.RegisteredWebServices(), // you control what services are visible
APIPath: "/apidocs.json",
PostBuildSwaggerObjectHandler: enrichSwaggerObject}
swagger := restfulspec.BuildSwagger(config)
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", "\t")
enc.Encode(swagger)
}