Remove unnecessary empty double lines. 43/110143/6
authorYaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
Mon, 5 Feb 2024 11:09:49 +0000 (13:09 +0200)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Fri, 9 Feb 2024 14:25:36 +0000 (14:25 +0000)
Reordered class fields, separated fields with different keywords, and removed empty double lines within the openapi package.

JIRA: NETCONF-938
Change-Id: Ia601693fa7f12db1984d9163649106c1c1d96e31
Signed-off-by: Yaroslav Lastivka <yaroslav.lastivka@pantheon.tech>
12 files changed:
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/BaseYangOpenApiGenerator.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/DefinitionNames.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/PathsStream.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/GetEntity.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/OperationEntity.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PatchEntity.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PostEntity.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PropertyEntity.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/PutEntity.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/model/TypeDef.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/mountpoints/MountPointOpenApi.java
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/util/RestDocgenUtil.java

index 184415af2fc3b443ead2aef1857227c9ac4aca2f..044bdb25a500573e5be00a990a1afaad84298e4c 100644 (file)
@@ -22,7 +22,6 @@ import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 
 public abstract class BaseYangOpenApiGenerator {
-
     private static final String CONTROLLER_RESOURCE_NAME = "Controller";
     public static final List<Map<String, List<String>>> SECURITY = List.of(Map.of("basicAuth", List.of()));
 
index 855c50dd753e2217093688110362b60afeb114e9..4423becc63a64314d44a6e8995436b36b5e9fd82 100644 (file)
@@ -14,7 +14,6 @@ import java.util.Set;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 
 public class DefinitionNames {
-
     private final HashMap<SchemaNode, String> discriminators;
     private final Set<String> names;
 
@@ -62,5 +61,4 @@ public class DefinitionNames {
     public String getDiscriminator(final SchemaNode node) {
         return discriminators.get(node);
     }
-
 }
index 2a54717c83f20c5b5bb92334a06afc3814e89199..8a07b30a15d7f368c648c497f3edbf9a15ef2ca7 100644 (file)
@@ -59,6 +59,9 @@ import org.opendaylight.yangtools.yang.model.api.type.Uint64TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.Uint8TypeDefinition;
 
 public final class PathsStream extends InputStream {
+    private static final String OPERATIONS = "operations";
+    private static final String DATA = "data";
+
     private final Iterator<? extends Module> iterator;
     private final OpenApiBodyWriter writer;
     private final EffectiveModelContext schemaContext;
@@ -70,8 +73,6 @@ public final class PathsStream extends InputStream {
     private final ByteArrayOutputStream stream;
     private final JsonGenerator generator;
 
-    private static final String OPERATIONS = "operations";
-    private static final String DATA = "data";
     private boolean hasRootPostLink;
     private boolean hasAddedDataStore;
     private Reader reader;
@@ -349,11 +350,9 @@ public final class PathsStream extends InputStream {
         if (keyType instanceof Uint64TypeDefinition) {
             return "integer";
         }
-
         if (keyType instanceof DecimalTypeDefinition) {
             return "number";
         }
-
         if (keyType instanceof BooleanTypeDefinition) {
             return "boolean";
         }
index 5c9060ac22c2939e6486f4b6f2dda72143abc760..d6b662753448440a4f1811d173ec21aba22480a5 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 
 public final class GetEntity extends OperationEntity {
-
     private final boolean isConfig;
 
     public GetEntity(final @Nullable SchemaNode schema, final @NonNull String deviceName,
index efc64503c1f6502bbc632a61e05301de1682a2ef..58a0cb406e08d5fb40c623870ff7c09a383c80af 100644 (file)
@@ -147,7 +147,6 @@ public abstract sealed class OperationEntity extends OpenApiEntity permits Delet
         generator.writeEndArray(); //end of params
     }
 
-
     protected static void generateMediaTypeSchemaRef(final @NonNull JsonGenerator generator,
             final @NonNull String mediaType, final @NonNull String ref) throws IOException {
         generator.writeObjectFieldStart(mediaType);
index 14f1c4763ca4e0828149b41824cac0ddd3799c13..b5c10fa54d7b0273859286e8b8e7eab1a44d57fc 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 
 public final class PatchEntity extends OperationEntity {
-
     private final @NonNull String fullName;
 
     public PatchEntity(final @NonNull SchemaNode schema, final @NonNull String deviceName,
index 1864793adef201326c28aabc2cfab39ac612bc6e..54afe2325c4e1610b01be4a911290760210978a8 100644 (file)
@@ -30,8 +30,6 @@ import org.opendaylight.yangtools.yang.model.api.OperationDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 
 public final class PostEntity extends OperationEntity {
-
-    private final @Nullable DocumentedNode parentNode;
     private static final String INPUT_SUFFIX = "_input";
     private static final String INPUT_KEY = "input";
     private static final String POST_DESCRIPTION = """
@@ -41,6 +39,8 @@ public final class PostEntity extends OperationEntity {
         guidelines of RFC 8040, which allows us to create only one resource in POST request.
         """;
 
+    private final @Nullable DocumentedNode parentNode;
+
     public PostEntity(final @NonNull SchemaNode schema, final @NonNull String deviceName,
             final @NonNull String moduleName, final @NonNull List<ParameterEntity> parameters,
             final @NonNull String refPath, final @Nullable DocumentedNode parentNode) {
@@ -188,7 +188,6 @@ public final class PostEntity extends OperationEntity {
         generator.writeEndObject();
     }
 
-
     @Override
     public void generateBasics(@NonNull JsonGenerator generator) throws IOException {
         final var description = description();
index bb9a21fc2981a4b48bd756452a7a9d5cba8f4d10..f973b1f9d73a97be197e5a20596bfb9a775e0743 100644 (file)
@@ -86,7 +86,6 @@ public class PropertyEntity {
     private static final String OBJECT_TYPE = "object";
     private static final String NUMBER_TYPE = "number";
     private static final String TYPE = "type";
-
     private static final Pattern AUTOMATON_SPECIAL_CHARACTERS = Pattern.compile("[@&\"<>#~]");
     // Adaptation from YANG regex to Automaton regex
     // See https://github.com/mifmif/Generex/blob/master/src/main/java/com/mifmif/common/regex/Generex.java
@@ -110,7 +109,6 @@ public class PropertyEntity {
         this.parentName = requireNonNull(parentName);
         this.definitionNames = requireNonNull(definitionNames);
         generate(stack, isParentConfig);
-
     }
 
     private void generate(final SchemaInferenceStack stack, final boolean isParentConfig) throws IOException {
@@ -181,7 +179,6 @@ public class PropertyEntity {
         final var localName = schemaNode.getQName().getLocalName();
         final var nodeName = parentName + "_" + localName;
 
-
         final String discriminator;
         if (!definitionNames.isListedNode(schemaNode)) {
             final var parentNameConfigLocalName = parentName + "_" + localName;
index 17a376fbfa1236923a91e9f350b476a51afe6158..72897819e123e275602ec95b453a97db4b0589fb 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 
 public final class PutEntity extends OperationEntity {
-
     private final @NonNull String fullName;
 
     public PutEntity(final @NonNull SchemaNode schema, final @NonNull String deviceName,
index 749c87f90d30abf9746151cf7c5bdeb64e93eef8..bf31972f2dc10859017f6398b1b5a0957725dc91 100644 (file)
@@ -31,7 +31,6 @@ public class TypeDef {
         return defaultValue != null;
     }
 
-
     public Object getExample() {
         return example;
     }
@@ -44,7 +43,6 @@ public class TypeDef {
         return example != null;
     }
 
-
     public String getFormat() {
         return format;
     }
@@ -57,7 +55,6 @@ public class TypeDef {
         return format != null;
     }
 
-
     public Integer getMinItems() {
         return minItems;
     }
@@ -70,7 +67,6 @@ public class TypeDef {
         return minItems != null;
     }
 
-
     public Boolean getUniqueItems() {
         return uniqueItems;
     }
@@ -83,7 +79,6 @@ public class TypeDef {
         return uniqueItems != null;
     }
 
-
     public List<String> getEnums() {
         return enums;
     }
@@ -96,7 +91,6 @@ public class TypeDef {
         return enums != null;
     }
 
-
     public Integer getMinLength() {
         return minLength;
     }
@@ -109,7 +103,6 @@ public class TypeDef {
         return minLength != null;
     }
 
-
     public Integer getMaxLength() {
         return maxLength;
     }
index 3c5b7ad5e0c9cc6cd70191035d33deae6175f487..2fc707693120b0a5b44fed795445bcd28d37e0ee 100644 (file)
@@ -43,9 +43,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class MountPointOpenApi implements DOMMountPointListener, AutoCloseable {
-
     private static final Logger LOG = LoggerFactory.getLogger(MountPointOpenApi.class);
-
     private static final String DATASTORES_REVISION = "-";
     private static final String DATASTORES_LABEL = "Datastores";
 
@@ -55,7 +53,6 @@ public class MountPointOpenApi implements DOMMountPointListener, AutoCloseable {
     private final Map<YangInstanceIdentifier, Long> instanceIdToLongId =
             new ConcurrentSkipListMap<>((o1, o2) -> o1.toString().compareToIgnoreCase(o2.toString()));
     private final Map<Long, YangInstanceIdentifier> longIdToInstanceId = new ConcurrentHashMap<>();
-
     private final AtomicLong idKey = new AtomicLong(0);
 
     private Registration registration;
index 81bac6194eafcec083a4260b737cd15ec8718640..92fc4a2792e69d131472db170d4fd784b6b22c44 100644 (file)
@@ -19,14 +19,13 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public final class RestDocgenUtil {
+    private static final Map<XMLNamespace, Map<Optional<Revision>, Module>> NAMESPACE_AND_REVISION_TO_MODULE =
+        new HashMap<>();
 
     private RestDocgenUtil() {
         // Hidden on purpose
     }
 
-    private static final Map<XMLNamespace, Map<Optional<Revision>, Module>> NAMESPACE_AND_REVISION_TO_MODULE =
-        new HashMap<>();
-
     /**
      * Resolve path argument name for {@code node}.
      *