Page 1 of 1

Wie setze ich die Standard -Pagable -Abfrageparameter auf der UI der Swagger ein?

Posted: 12 Apr 2025, 18:42
by Anonymous
Ich habe REST -API -Endpunkte mit Spring Boot entwickelt. Hier ist die Controller -Klasse: < /p>

Code: Select all

@RestController
@RequestMapping(
path = "/api/products",
produces = {MediaType.APPLICATION_JSON_VALUE})
@AllArgsConstructor
@Validated
public class ProductController {

private ProductService productService;

@GetMapping
public ResponseEntity
> getProducts(
@RequestParam(required = false) BigDecimal minPrice,
@RequestParam(required = false) BigDecimal maxPrice,
@PageableDefault(size = 100) Pageable pageable) {
PageDto products = productService.findProducts(minPrice, maxPrice, pageable);
return ResponseEntity.status(HttpStatus.OK).body(products);
}
// other functions here
}
Wenn ich http: // localhost: 8080/swagger-ui/index.html öffne, sehe ich hier: