From e85fdb561078042342ce58515acea2f6ad3bb570 Mon Sep 17 00:00:00 2001 From: Antoine Rey Date: Wed, 29 Dec 2021 17:46:49 +0100 Subject: [PATCH] Add ownerId property to Pet --- .../samples/petclinic/mapper/PetMapper.java | 3 +++ src/main/resources/openapi.yml | 8 ++++++++ 2 files changed, 11 insertions(+) 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.