当我打开它时所有操作都显示为折叠状态,我希望它默认展开。
我需要更改任何属性来实现它吗?
这是我的 Swagger bean :
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket restApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.paths(regex("/api/.*"))
.build()
.directModelSubstitute(XMLGregorianCalendar.class, Date.class)
.apiInfo(apiInfo())
.useDefaultResponseMessages(false);
}
}
最佳答案
相信你可以在创建swagger-ui的时候设置docExpansion:"full"
。
见 https://github.com/swagger-api/swagger-ui#parameters了解详情。
docExpansion: Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing). The default is 'list'.
关于spring - Swagger UI - 默认情况下如何扩展所有操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33948742/