Skip to content

Commit 6d8ef78

Browse files
authored
Expose swagger.json (#420)
1 parent 8e04ca0 commit 6d8ef78

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

server/start.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io"
66
"net"
77

8+
"github.com/appscode/stash/apis/repositories/v1alpha1"
89
"github.com/appscode/stash/pkg/controller"
910
"github.com/appscode/stash/pkg/server"
1011
"github.com/spf13/pflag"
@@ -59,6 +60,19 @@ func (o StashOptions) Config() (*server.StashConfig, error) {
5960
if err := o.RecommendedOptions.ApplyTo(serverConfig); err != nil {
6061
return nil, err
6162
}
63+
serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(v1alpha1.GetOpenAPIDefinitions, server.Scheme)
64+
serverConfig.OpenAPIConfig.Info.Title = "stash-server"
65+
serverConfig.OpenAPIConfig.Info.Version = v1alpha1.SchemeGroupVersion.Version
66+
serverConfig.OpenAPIConfig.IgnorePrefixes = []string{
67+
"/swaggerapi",
68+
"/apis/admission.stash.appscode.com/v1alpha1/restics",
69+
"/apis/admission.stash.appscode.com/v1alpha1/recoveries",
70+
"/apis/admission.stash.appscode.com/v1alpha1/deployments",
71+
"/apis/admission.stash.appscode.com/v1alpha1/daemonsets",
72+
"/apis/admission.stash.appscode.com/v1alpha1/statefulsets",
73+
"/apis/admission.stash.appscode.com/v1alpha1/replicationcontrollers",
74+
"/apis/admission.stash.appscode.com/v1alpha1/replicasets",
75+
}
6276

6377
controllerConfig := controller.NewControllerConfig(serverConfig.ClientConfig)
6478
if err := o.ControllerOptions.ApplyTo(controllerConfig); err != nil {

0 commit comments

Comments
 (0)