2

I'm using this lib https://github.com/tkaczmarzyk/specification-arg-resolver to generate specifications in Spring Boot. The problem is this lib is generating them in run time whereas swagger works in compile time. Swagger detects only params used in paging. Any ideas how to solve this issue?

Code:

@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));
    }

SOLUTION: https://github.com/swagger-api/swagger-core/wiki/annotations#apiimplicitparam-apiimplicitparams

Shocter
  • 21
  • 2

0 Answers0