Fix JAX-RS JRD output 38/113938/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 10 Oct 2024 13:53:23 +0000 (15:53 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 11 Oct 2024 12:45:09 +0000 (12:45 +0000)
'links' is an array, not a singleton -- correct that.

Change-Id: I10ef1929d1ec13a5a111e7063baeca62141892e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
protocol/restconf-server-jaxrs/src/main/java/org/opendaylight/restconf/server/jaxrs/JaxRsWebHostMetadata.java
protocol/restconf-server-jaxrs/src/test/java/org/opendaylight/restconf/server/jaxrs/JaxRsWebHostMetadataTest.java

index 051ae4e8a81c4e6b5d137885022d87183b415aa9..b75da1fbc0f09016a0ea11ebf3cec7b557007e98 100644 (file)
@@ -60,10 +60,12 @@ public final class JaxRsWebHostMetadata {
     public Response readJsonData() {
         return Response.status(Status.OK)
             .entity("{\n"
-                + "  \"links\" : {\n"
-                + "    \"rel\" : \"restconf\",\n"
-                + "    \"href\" : \"/" + restconfRoot + "\"\n"
-                + "  }\n"
+                + "  \"links\" : [\n"
+                + "    {\n"
+                + "      \"rel\" : \"restconf\",\n"
+                + "      \"href\" : \"/" + restconfRoot + "\"\n"
+                + "    }\n"
+                + "  ]\n"
                 + "}")
             .build();
     }
index ac6feb04472d3db26878cb550bd06b81b34791d8..72b82a2d676ef8cc972f3cb68014a59c5fd02583 100644 (file)
@@ -20,10 +20,12 @@ class JaxRsWebHostMetadataTest {
         assertEquals(200, response.getStatus());
         assertEquals("""
             {
-              "links" : {
-                "rel" : "restconf",
-                "href" : "/fooBarBaz"
-              }
+              "links" : [
+                {
+                  "rel" : "restconf",
+                  "href" : "/fooBarBaz"
+                }
+              ]
             }""", response.getEntity());
     }