You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public ResponseEntity<String> getResourceById(Long id) { // Noncompliant - The 'id' parameter will not be automatically populated with the path variable value
14
16
return ResponseEntity.ok("Fetching resource with ID: " + id);
15
17
}
18
+
19
+
@GetMapping("/api/asset/")
20
+
public ResponseEntity<String> getAssetById(@PathVariable Long id) { // Noncompliant - The 'id' parameter does not have a corresponding placeholder
21
+
return ResponseEntity.ok("Fetching asset with ID: " + id);
22
+
}
16
23
</pre>
17
24
<h4>Compliant solution</h4>
18
25
<predata-diff-id="1" data-diff-type="compliant">
19
26
@GetMapping("/api/resource/{id}")
20
27
public ResponseEntity<String> getResourceById(@PathVariable Long id) { // Compliant
21
28
return ResponseEntity.ok("Fetching resource with ID: " + id);
22
29
}
30
+
31
+
@GetMapping("/api/asset/{id}")
32
+
public ResponseEntity<String> getAssetById(@PathVariable Long id) {
33
+
return ResponseEntity.ok("Fetching asset with ID: " + id);
0 commit comments