Skip to content
Snippets Groups Projects
Commit d2353ce9 authored by Andrej Šimurka's avatar Andrej Šimurka
Browse files

Set json example for rest endpoint

parent 1479c190
No related branches found
No related tags found
2 merge requests!60Docker,!3713 fixes by andrej
Pipeline #
No preview for this file type
......@@ -8,6 +8,7 @@ import cz.muni.pa165.common_library.dtos.DriverUpdateDto;
import cz.muni.pa165.driver.service.CarService;
import cz.muni.pa165.driver.service.DriverService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -44,7 +45,15 @@ public class DriverController {
@PostMapping(path = "/add", consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<DriverResponseDto> addDriver(
@Valid @RequestBody DriverAddDto driverAddDto) {
@Valid
@RequestBody
@Schema(example = "{\"name\":\"Fernando\", " +
"\"surname\": \"Alonso\", " +
"\"nationality\": \"Spanish\", " +
"\"characteristics\" : {\"Experience\" : 1," +
" \"Aggressiveness\" : 1," +
" \"Consistency\" : 1," +
" \"Racecraft\" : 1 }}") DriverAddDto driverAddDto) {
return ResponseEntity.ok(driverService.addDriver(driverAddDto));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment