diff --git a/src/main/java/com/dailyon/productservice/product/controller/ProductController.java b/src/main/java/com/dailyon/productservice/product/controller/ProductController.java index cab1bcf..ad564f3 100644 --- a/src/main/java/com/dailyon/productservice/product/controller/ProductController.java +++ b/src/main/java/com/dailyon/productservice/product/controller/ProductController.java @@ -10,6 +10,9 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; + @RestController @RequestMapping("/products") @RequiredArgsConstructor @@ -48,7 +51,7 @@ ResponseEntity readProductSlice( } @GetMapping("/search") - ResponseEntity searchProducts(@RequestParam String query) { + ResponseEntity searchProducts(@Valid @NotBlank @RequestParam String query) { return ResponseEntity.status(HttpStatus.OK).body(productFacade.searchProducts(query)); }