feat(ui): configure default expansion depth for models (#158)
* feat(ui): configure default expansion depth for models This commit adds possibility to configure defaultModelsExpandDepth, which controls how models (at the bottom of the API doc) are displayed. Default value is 1, but it can be set to -1 completely hide the models. https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#display * doc: update README.md Added Configuration section describing available configuration options.
This commit is contained in:
@@ -126,4 +126,26 @@ Demo project tree, `swag init` is run at relative `.`
|
||||
├── go.mod
|
||||
├── go.sum
|
||||
└── main.go
|
||||
```
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure Swagger using different configuration options
|
||||
|
||||
```go
|
||||
func main() {
|
||||
r := gin.New()
|
||||
|
||||
ginSwagger.WrapHandler(swaggerFiles.Handler,
|
||||
ginSwagger.URL("http://localhost:8080/swagger/doc.json"),
|
||||
ginSwagger.DefaultModelsExpandDepth(-1)))
|
||||
|
||||
r.Run()
|
||||
}
|
||||
```
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------------------------|--------|------------|---------------------------------------------------------------------------|
|
||||
| URL | string | "doc.json" | URL pointing to API definition |
|
||||
| DeepLinking | bool | true | Swagger deeplinking configuration |
|
||||
| DefaultModelsExpandDepth | int | 1 | Default expansion depth for models (set to -1 completely hide the models) |
|
||||
|
||||
Reference in New Issue
Block a user