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 c34ca224d97dce26cf3a01660b5f4b7a4eb84dc3..1a20bf4ac44551e33b9b3b96d1c4e2aadfb93cc6 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 @@ import java.util.Collection; */ @Mapper public interface PetMapper { + + @Mapping(source = "owner.id", target = "ownerId") PetDto toPetDto(Pet pet); Collection<PetDto> toPetsDto(Collection<Pet> pets); diff --git a/src/main/resources/openapi.yml b/src/main/resources/openapi.yml index 188415ec069307ee0d0d0d0a3b02977dcabcf28a..93d56b01a5d5dc629213031258260d25fd938375 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.