diff --git a/src/main/java/org/springframework/samples/petclinic/rest/controller/SpecialtyRestController.java b/src/main/java/org/springframework/samples/petclinic/rest/controller/SpecialtyRestController.java index 1dbbd64ef22acc10f45d3201b4557f9f531d96db..723fd327e2c71d2318e44385bb24d683b89b5733 100644 --- a/src/main/java/org/springframework/samples/petclinic/rest/controller/SpecialtyRestController.java +++ b/src/main/java/org/springframework/samples/petclinic/rest/controller/SpecialtyRestController.java @@ -53,7 +53,7 @@ public class SpecialtyRestController implements SpecialtiesApi { @PreAuthorize("hasRole(@roles.VET_ADMIN)") @Override public ResponseEntity<List<SpecialtyDto>> listSpecialties() { - List<SpecialtyDto> specialties = new ArrayList<SpecialtyDto>(); + List<SpecialtyDto> specialties = new ArrayList<>(); specialties.addAll(specialtyMapper.toSpecialtyDtos(this.clinicService.findAllSpecialties())); if (specialties.isEmpty()) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); @@ -66,9 +66,9 @@ public class SpecialtyRestController implements SpecialtiesApi { public ResponseEntity<SpecialtyDto> getSpecialty(Integer specialtyId) { Specialty specialty = this.clinicService.findSpecialtyById(specialtyId); if (specialty == null) { - return new ResponseEntity<SpecialtyDto>(HttpStatus.NOT_FOUND); + return new ResponseEntity<>(HttpStatus.NOT_FOUND); } - return new ResponseEntity<SpecialtyDto>(specialtyMapper.toSpecialtyDto(specialty), HttpStatus.OK); + return new ResponseEntity<>(specialtyMapper.toSpecialtyDto(specialty), HttpStatus.OK); } @PreAuthorize("hasRole(@roles.VET_ADMIN)") @@ -77,8 +77,8 @@ public class SpecialtyRestController implements SpecialtiesApi { HttpHeaders headers = new HttpHeaders(); Specialty specialty = specialtyMapper.toSpecialty(specialtyDto); this.clinicService.saveSpecialty(specialty); - headers.setLocation(UriComponentsBuilder.newInstance().path("/api/specialtys/{id}").buildAndExpand(specialty.getId()).toUri()); - return new ResponseEntity<SpecialtyDto>(specialtyMapper.toSpecialtyDto(specialty), headers, HttpStatus.CREATED); + headers.setLocation(UriComponentsBuilder.newInstance().path("/api/specialties/{id}").buildAndExpand(specialty.getId()).toUri()); + return new ResponseEntity<>(specialtyMapper.toSpecialtyDto(specialty), headers, HttpStatus.CREATED); } @PreAuthorize("hasRole(@roles.VET_ADMIN)") diff --git a/src/main/resources/openapi.yml b/src/main/resources/openapi.yml index 9bac1e38c2e0affdb4f0d7999ff7693910111c8e..d630daf51f8d8b365ce2f54f018c29bebfdbc181 100755 --- a/src/main/resources/openapi.yml +++ b/src/main/resources/openapi.yml @@ -1356,7 +1356,7 @@ paths: parameters: - name: specialtyId in: path - description: The ID of the pet. + description: The ID of the speciality. required: true schema: type: integer