File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ type Config struct {
2727 UIConfig map [template.JS ]template.JS
2828 DeepLinking bool
2929 PersistAuthorization bool
30+ Layout string
3031}
3132
3233// URL presents the url pointing to API definition (normally swagger.json or swagger.yaml).
@@ -110,6 +111,19 @@ func AfterScript(js string) func(*Config) {
110111 }
111112}
112113
114+ type Layouts string
115+ const (
116+ BaseLayout Layouts = "BaseLayout"
117+ StandaloneLayout Layouts = "StandaloneLayout"
118+ )
119+
120+ // Define Layout options are BaseLayout or StandaloneLayout
121+ func Layout (layout Layouts ) func (* Config ) {
122+ return func (c * Config ) {
123+ c .Layout = string (layout )
124+ }
125+ }
126+
113127func newConfig (configFns ... func (* Config )) * Config {
114128 config := Config {
115129 URL : "doc.json" ,
@@ -118,6 +132,7 @@ func newConfig(configFns ...func(*Config)) *Config {
118132 InstanceName : "swagger" ,
119133 DeepLinking : true ,
120134 PersistAuthorization : false ,
135+ Layout : string (StandaloneLayout ),
121136 }
122137
123138 for _ , fn := range configFns {
@@ -285,7 +300,7 @@ window.onload = function() {
285300 {{- range $k, $v := .UIConfig}}
286301 {{$k}}: {{$v}},
287302 {{- end}}
288- layout: "StandaloneLayout "
303+ layout: "{{$.Layout}} "
289304 })
290305
291306 window.ui = ui
You can’t perform that action at this time.
0 commit comments