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

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie setze ich die Standard -Pagable -Abfrageparameter auf der UI der Swagger ein?

by Anonymous » 12 Apr 2025, 18:42

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:

Top