Search code examples
springswagger-uiswagger-2.0springfox

How to avoid general Swagger Warnings?


i am going to validate my swagger (v2) documentation in http://editor.swagger.io/#/ but i got follow warning message.

{ "generalSwaggerWarnings": [ { "swaggerObject": "#/definitions/Future«object»", "message": "Definition is defined but is not used: #/definitions/Future«object»" } ] }


Solution

  • Your scenario is a slight bit different than the example links I posted in my comment since you are not using the nested ResponseEntity. So your implementation would be something more like this:

    import static springfox.documentation.schema.AlternateTypeRules.newRule;
    
    ...
    
        @Bean
        public Docket api() {
            return new Docket(DocumentationType.SWAGGER_2)
                    .alternateTypeRules(
                            newRule(typeResolver.resolve(Future.class),
                                    typeResolver.resolve(WildcardType.class)))
                    ;
        }