diff --git a/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java b/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java index c34ca224d..1a20bf4ac 100755 --- a/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java +++ b/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java @@ -1,6 +1,7 @@ package org.springframework.samples.petclinic.mapper; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.springframework.samples.petclinic.rest.dto.PetDto; import org.springframework.samples.petclinic.rest.dto.PetFieldsDto; import org.springframework.samples.petclinic.rest.dto.PetTypeDto; @@ -14,6 +15,8 @@ */ @Mapper public interface PetMapper { + + @Mapping(source = "owner.id", target = "ownerId") PetDto toPetDto(Pet pet); Collection toPetsDto(Collection pets); diff --git a/src/main/resources/openapi.yml b/src/main/resources/openapi.yml index 188415ec0..93d56b01a 100755 --- a/src/main/resources/openapi.yml +++ b/src/main/resources/openapi.yml @@ -722,6 +722,14 @@ components: minimum: 0 example: 1 readOnly: true + ownerId: + title: Owner ID + description: The ID of the pet's owner. + type: integer + format: int32 + minimum: 0 + example: 1 + readOnly: true visits: title: Visits description: Vet visit bookings for this pet.