From 88447bbbf82e77f4a3428259a668fb9f66c9cc13 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 7 Nov 2023 15:16:40 +0100 Subject: [PATCH] restructure json data --- .../Normalizer/NewsItemNormalizer.php | 10 ++++++---- .../ChillMainBundle/chill.api.specs.yaml | 20 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php index caad24bbc..9e0f443e6 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NewsItemNormalizer.php @@ -29,10 +29,12 @@ class NewsItemNormalizer implements NormalizerInterface return [ 'id' => $newsItem->getId(), 'type' => 'news', - 'title' => $newsItem->getTitle(), - 'content' => $newsItem->getContent(), - 'startdate' => $newsItem->getStartDate(), - 'enddate' => $newsItem->getEndDate() + 'metadata' => [ + 'title' => $newsItem->getTitle(), + 'content' => $newsItem->getContent(), + 'startdate' => $newsItem->getStartDate(), + 'enddate' => $newsItem->getEndDate() + ], ]; } diff --git a/src/Bundle/ChillMainBundle/chill.api.specs.yaml b/src/Bundle/ChillMainBundle/chill.api.specs.yaml index c50c12c69..8df409dfb 100644 --- a/src/Bundle/ChillMainBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillMainBundle/chill.api.specs.yaml @@ -144,14 +144,18 @@ components: type: integer type: type: string - title: - type: string - content: - type: string - startdate: - $ref: "#/components/schemas/Date" - enddate: - $ref: "#/components/schemas/Date" + metadata: + type: object + properties: + title: + type: string + content: + type: string + startdate: + $ref: "#/components/schemas/Date" + enddate: + $ref: "#/components/schemas/Date" + paths: /1.0/search.json: