This is a Spring boot application, where as I mentioned in subject
"appConfig" root element is missing from the response when I added Swagger.
Any Help on this forum will be appreciated.
Here is my response object class:
```
@JsonRootName(value = "appConfig")
public class AppConfig {
// Using lombok for getter setters
@Getter
@Setter
@JsonProperty("toggles")
private List<Toggle> toggles;
@Getter
@Setter
@JsonProperty("resources")
private List<Resource> resources;
```
This is my restController
```
@RequestMapping(value = "/appConfig", method = RequestMethod.GET, produces
= {MediaType.APPLICATION_JSON_VALUE })
@ResponseStatus(HttpStatus.OK)
public AppConfig appConfig() {
final AppConfig appConfig =delegate.getAppConfig();
return appConfig;
}
```
This is what I am getting in the response
```
//MISSING appConfig root element !!!!
{
"resources": [
{
"lastUpdateTimeStamp": "string",
"resourceName": "string"
}
],
"toggles": [
{
"name": "string",
"state": true
}
]
}
```
This is my POM dependency for Swagger:
```
<!-- Swagger dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
<scope>compile</scope>
</dependency>
```
This is my Swagger Configuration class:
```
@Configuration
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurationSupport {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
private ApiInfo apiInfo() {
return new ApiInfo(
"Blah",
"Blah",
"Blah",
"Terms of service",
new Contact("Blah Administrator", "URL", "Email"),
"License of API", "API license URL");
}
```
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.