From 3a33d15939bb6d23898a477509f1658031198fec Mon Sep 17 00:00:00 2001 From: Luke Sikina Date: Tue, 24 Sep 2024 09:18:40 -0400 Subject: [PATCH] [CHORE] Correct info json schema --- .../dbmi/avillach/dictionary/info/InfoController.java | 5 ++++- .../dbmi/avillach/dictionary/info/InfoResponse.java | 7 +++++-- .../dbmi/avillach/dictionary/info/InfoControllerTest.java | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java index c60677c..e328ee2 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java @@ -5,11 +5,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; +import java.util.UUID; + @Controller public class InfoController { @PostMapping("/info") public ResponseEntity getInfo(@RequestBody Object ignored) { - return ResponseEntity.ok(new InfoResponse(":)")); + return ResponseEntity.ok(new InfoResponse(UUID.nameUUIDFromBytes(":)".getBytes()), ":)", List.of())); } } diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java index 5810c02..1e26313 100644 --- a/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java @@ -1,4 +1,7 @@ package edu.harvard.dbmi.avillach.dictionary.info; -public record InfoResponse(String response) { -} +import java.util.List; +import java.util.UUID; + +public record InfoResponse(UUID id, String name, List queryFormats) { +} \ No newline at end of file diff --git a/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java b/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java index ccf8e0d..0e39cdb 100644 --- a/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java +++ b/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java @@ -7,6 +7,9 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import java.util.List; +import java.util.UUID; + @SpringBootTest class InfoControllerTest { @@ -19,6 +22,6 @@ void shouldGetInfo() { ResponseEntity actual = infoController.getInfo(new Object()); Assertions.assertEquals(HttpStatus.OK, actual.getStatusCode()); - Assertions.assertEquals(new InfoResponse(":)"), actual.getBody()); + Assertions.assertEquals(new InfoResponse(UUID.nameUUIDFromBytes(":)".getBytes()), ":)", List.of()), actual.getBody()); } } \ No newline at end of file