Eliminate server from Path class 95/107495/14
authorŠimon Ukuš <simon.ukus@pantheon.tech>
Fri, 25 Aug 2023 11:44:00 +0000 (13:44 +0200)
committerSamuel Schneider <samuel.schneider@pantheon.tech>
Fri, 22 Sep 2023 09:57:19 +0000 (11:57 +0200)
Remove server from Path. It is unused, and we want to
get rid of ObjectNode(s) and ArrayNode(s).

JIRA: NETCONF-938
Change-Id: I7b8141c38db18c49585a05e427ef64922db4bf6b
Signed-off-by: Šimon Ukuš <simon.ukus@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/Path.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/Server.java

index c6d7f80a88dc3a186faaccb6468294ca9e2e6d05..a952d6e1d6a90257c9b988dcd39835d6abc46262 100644 (file)
@@ -10,16 +10,25 @@ package org.opendaylight.restconf.openapi.model;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.node.ObjectNode;
 
 @JsonInclude(Include.NON_NULL)
-public record Path(@JsonProperty("$ref") String ref, String summary, String description, Operation get,
-        Operation put, Operation post, Operation delete, Operation options, Operation head, Operation patch,
-        Operation trace, ObjectNode servers) {
+public record Path(
+        @JsonProperty("$ref") String ref,
+        String summary,
+        String description,
+        Operation get,
+        Operation put,
+        Operation post,
+        Operation delete,
+        Operation options,
+        Operation head,
+        Operation patch,
+        Operation trace) {
+
 
     private Path(final Builder builder) {
         this(builder.ref, builder.summary, builder.description, builder.get, builder.put, builder.post,
-            builder.delete, builder.options, builder.head, builder.patch, builder.trace, builder.servers);
+            builder.delete, builder.options, builder.head, builder.patch, builder.trace);
     }
 
     @SuppressWarnings("checkstyle:hiddenField")
@@ -35,7 +44,6 @@ public record Path(@JsonProperty("$ref") String ref, String summary, String desc
         private Operation head;
         private Operation patch;
         private Operation trace;
-        private ObjectNode servers;
 
         public Builder ref(final String ref) {
             this.ref = ref;
@@ -92,13 +100,8 @@ public record Path(@JsonProperty("$ref") String ref, String summary, String desc
             return this;
         }
 
-        public Builder servers(final ObjectNode servers) {
-            this.servers = servers;
-            return this;
-        }
-
         public Path build() {
             return new Path(this);
         }
     }
-}
\ No newline at end of file
+}
index 46cb98a4db7751f90b77f1a88b6b6672b916e63a..5087b18f05b9012662798eef4f02506076ceecaf 100644 (file)
@@ -7,9 +7,25 @@
  */
 package org.opendaylight.restconf.openapi.model;
 
+import static java.util.Objects.requireNonNull;
+
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import org.eclipse.jdt.annotation.NonNull;
 
+/**
+ * Represents a Server. The target host is indicated by the {@link Server#url} field.
+ *
+ * <p>
+ * In the example URL: <b>http://localhost:8181/openapi/api/v3/mounts/{id}</b>,
+ *
+ * @param url <b>Required</b> {@link String} representing the URL to the target host.
+ */
 @JsonInclude(Include.NON_NULL)
-public record Server(String url) {
+public record Server(
+        @NonNull String url) {
+
+    public Server {
+        requireNonNull(url);
+    }
 }