2

この lib https://github.com/tkaczmarzyk/specification-arg-resolverを使用して、Spring Boot で仕様を生成しています。問題は、このライブラリが実行時にそれらを生成しているのに対し、swagger はコンパイル時に動作することです。Swagger は、ページングで使用されるパラメーターのみを検出します。この問題を解決する方法はありますか?

コード:

@And({
        @Spec(path = "title", params = {"title"}, spec = LikeIgnoreCase.class),
        @Spec(path = "rented", params = {"isRented", "rented"}, spec = Equal.class),
        @Spec(path = "author.id", params = {"authorId"}, spec = Equal.class),
        @Spec(path = "author.firstName", params = {"firstName"}, spec = LikeIgnoreCase.class),
        @Spec(path = "author.lastName", params = {"lastName"}, spec = LikeIgnoreCase.class)
})
interface BookSpecification extends Specification<Book> {
}
@RestController
@CrossOrigin
@RequestMapping("/api/books")
public class BookController extends AbstractController<Book, BookDto> {

    private final BookService bookService;

    public BookController(BookService bookService) {
        super(bookService);
        this.bookService = bookService;
    }

    @GetMapping
    public ResponseEntity<Page<BookDto>> getAll(BookSpecification authorSpecification, Pageable pageable) {
        return ResponseEntity.ok(bookService.getAll(authorSpecification, pageable));
    }

解決策: https://github.com/swagger-api/swagger-core/wiki/annotations#apiimplicitparam-apiimplicitparams

4

0 に答える 0