昂首阔步不承认api描述

loading...


0

我像这样安排 docket

@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select()
        .apis(RequestHandlerSelectors.basePackage("com.config.internal"))
        .paths(Predicates.or(PathSelectors.ant("/api**/**")))
        .build();
}

我创建了一组存根 endpoints ,模仿 /login/oauth 的真实 endpoints .

@Api("Authentication")
@RequestMapping("/api")
public interface LoginEndpointApi {

    @ApiOperation(value = "Github SSO endpoint", notes = "Endpoint for Github SSO authentication")
    @ApiResponses({
        @ApiResponse(code = 200, message = "HTML page of main application")
    })
    @GetMapping("/oauth/github")
    default void oauthGithub() {
        throw new UnsupportedOperationException();
    }

    @ApiOperation(value = "Get CSRF token", notes = "Returns current CSRF token")
    @ApiResponses({
        @ApiResponse(code = 200, message = "CSRF token response", response = String.class,
            examples = @Example({@ExampleProperty(value = "015275eb-293d-4ce9-ba07-ff5e1c348092")}))
    })
    @GetMapping("/csrf-token")
    default void csrfToken() {
        throw new UnsupportedOperationException();
    }

    @ApiOperation(value = "Login endpoint", notes = "Login endpoint for authorization")
    @ApiResponses({
        @ApiResponse(code = 200, message = "Successful authentication")
    })
    @PostMapping("/login")
    default void login(
            @ApiParam(required = true, name = "login", value = "login body")
            @RequestBody LoginRequest loginRequest) {
        throw new UnsupportedOperationException();
    }
}

但它不承认它 . 它位于我描述的相同的 com.config.internal 包中 .

但页面 swagger ui 为空并显示 No operations defined in spec!

问题是什么?

loading...

1回答
评论

暂时没有评论!