From d7f9c3a456b080cf58d8fc9b4039367d82b3f6fe Mon Sep 17 00:00:00 2001 From: nspadaccino Date: Wed, 21 May 2025 16:51:05 -0400 Subject: [PATCH] convert response message from json string to json --- .../main/scala/vinyldns/api/domain/zone/ZoneService.scala | 5 ++++- .../core/src/main/scala/vinyldns/core/domain/zone/Zone.scala | 2 +- .../scala/vinyldns/core/protobuf/ProtobufConversions.scala | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/api/src/main/scala/vinyldns/api/domain/zone/ZoneService.scala b/modules/api/src/main/scala/vinyldns/api/domain/zone/ZoneService.scala index 3877a530b..50854bb0f 100644 --- a/modules/api/src/main/scala/vinyldns/api/domain/zone/ZoneService.scala +++ b/modules/api/src/main/scala/vinyldns/api/domain/zone/ZoneService.scala @@ -214,12 +214,15 @@ class ZoneService( responseMessage: String = Source.fromInputStream(inputStream, "UTF-8").mkString _ <- isValidGenerateZoneConn(responseCode, responseMessage).toResult + // Parse response + responseJson = parse(responseMessage) + // Create response object zoneGenerateResponse = ZoneGenerationResponse( provider = request.provider, responseCode = responseCode, status = dnsConnResponse.getResponseMessage, - message = responseMessage + message = responseJson ) // Save to repository diff --git a/modules/core/src/main/scala/vinyldns/core/domain/zone/Zone.scala b/modules/core/src/main/scala/vinyldns/core/domain/zone/Zone.scala index 9cb33f9eb..34de13292 100644 --- a/modules/core/src/main/scala/vinyldns/core/domain/zone/Zone.scala +++ b/modules/core/src/main/scala/vinyldns/core/domain/zone/Zone.scala @@ -249,7 +249,7 @@ case class ZoneGenerationResponse( provider: String, responseCode: Int, status: String, - message: String + message: JValue ) case class ZoneGenerationInput( diff --git a/modules/core/src/main/scala/vinyldns/core/protobuf/ProtobufConversions.scala b/modules/core/src/main/scala/vinyldns/core/protobuf/ProtobufConversions.scala index 7e5975f41..7facfa3b5 100644 --- a/modules/core/src/main/scala/vinyldns/core/protobuf/ProtobufConversions.scala +++ b/modules/core/src/main/scala/vinyldns/core/protobuf/ProtobufConversions.scala @@ -224,7 +224,7 @@ trait ProtobufConversions { zgr.getProvider, zgr.getResponseCode.toInt, zgr.getStatus, - zgr.getMessage + parse(zgr.getMessage) ) def fromPB(rd: VinylDNSProto.RecordData, rt: RecordType): RecordData = @@ -533,7 +533,7 @@ trait ProtobufConversions { .setProvider(zgr.provider) .setResponseCode(zgr.responseCode.toLong) .setStatus(zgr.status) - .setMessage(zgr.message) + .setMessage(compact(render(zgr.message))) .build() def fromPB(data: VinylDNSProto.User): User =