Copilot commented on code in PR #780:
URL: https://github.com/apache/incubator-graphar/pull/780#discussion_r2558464972


##########
maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java:
##########
@@ -124,12 +129,14 @@ public URI getVerticesNumFileUri() {
     }
 
     public void dump(Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         VertexYaml vertexYaml = new VertexYaml(this);
         yaml.dump(vertexYaml, output);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid VertexInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("VertexInfo object is not valid 
and cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           VertexYaml vertexYaml = new VertexYaml(this);
           yaml.dump(vertexYaml, output);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("VertexInfo object is not valid 
and cannot be dumped.");
           }
   ```



##########
maven-projects/info/src/test/java/org/apache/graphar/info/MultiPropertyTest.java:
##########
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.graphar.info.loader.GraphInfoLoader;
+import 
org.apache.graphar.info.loader.impl.LocalFileSystemStringGraphInfoLoader;
+import org.apache.graphar.info.saver.GraphInfoSaver;
+import org.apache.graphar.info.saver.impl.LocalFileSystemYamlGraphSaver;
+import org.apache.graphar.info.type.AdjListType;
+import org.apache.graphar.info.type.Cardinality;
+import org.apache.graphar.info.type.DataType;
+import org.apache.graphar.info.type.FileType;
+import org.apache.graphar.info.yaml.PropertyYaml;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class MultiPropertyTest extends BaseFileSystemTest {
+
+    private String testSaveDirectory;
+    private GraphInfoLoader graphInfoLoader;
+    private GraphInfoSaver graphInfoSaver;
+    private Property singleProperty;
+    private Property listProperty;
+    private Property setProperty;
+
+    @Before
+    public void setUp() {
+        testSaveDirectory = 
createCleanTestDirectory("ldbc_multi_property_sample/");
+        graphInfoLoader = new LocalFileSystemStringGraphInfoLoader();
+        graphInfoSaver = new LocalFileSystemYamlGraphSaver();
+        singleProperty =
+                TestDataFactory.createProperty("single_email", 
DataType.STRING, false, true);
+        listProperty =
+                TestDataFactory.createProperty(
+                        "list_email", DataType.STRING, Cardinality.LIST, 
false, true);
+        setProperty =
+                TestDataFactory.createProperty(
+                        "set_email", DataType.STRING, Cardinality.SET, false, 
true);
+    }
+
+    @After
+    public void tearDown() {
+        // Test data will be preserved for debugging - cleanup happens before 
next test run
+        System.out.println("Test data saved in: " + testSaveDirectory);
+    }
+
+    @Test
+    public void testPropertyWithCardinality() {
+        // Test single cardinality property
+        Assert.assertEquals("single_email", singleProperty.getName());
+        Assert.assertEquals(DataType.STRING, singleProperty.getDataType());
+        Assert.assertFalse(singleProperty.isPrimary());
+        Assert.assertTrue(singleProperty.isNullable());
+        Assert.assertEquals(Cardinality.SINGLE, 
singleProperty.getCardinality());
+
+        // Test list cardinality property
+        Assert.assertEquals("list_email", listProperty.getName());
+        Assert.assertEquals(DataType.STRING, listProperty.getDataType());
+        Assert.assertFalse(listProperty.isPrimary());
+        Assert.assertTrue(listProperty.isNullable());
+        Assert.assertEquals(Cardinality.LIST, listProperty.getCardinality());
+
+        // Test set cardinality property
+        Assert.assertEquals("set_email", setProperty.getName());
+        Assert.assertEquals(DataType.STRING, setProperty.getDataType());
+        Assert.assertFalse(setProperty.isPrimary());
+        Assert.assertTrue(setProperty.isNullable());
+        Assert.assertEquals(Cardinality.SET, setProperty.getCardinality());
+    }
+
+    @Test
+    public void testPropertyGroupWithMultiProperties() {
+        // Create property group with different cardinality properties
+        PropertyGroup propertyGroup =
+                TestDataFactory.createPropertyGroup(
+                        Arrays.asList(singleProperty, listProperty, 
setProperty),
+                        FileType.PARQUET,
+                        "emails/");
+
+        Assert.assertEquals(3, propertyGroup.size());
+        Assert.assertEquals(FileType.PARQUET, propertyGroup.getFileType());
+        Assert.assertEquals("emails/", propertyGroup.getPrefix());
+
+        // Test iteration over properties
+        int count = 0;
+        for (Property property : propertyGroup) {
+            count++;
+            if ("single_email".equals(property.getName())) {
+                Assert.assertEquals(Cardinality.SINGLE, 
property.getCardinality());
+            } else if ("list_email".equals(property.getName())) {
+                Assert.assertEquals(Cardinality.LIST, 
property.getCardinality());
+            } else if ("set_email".equals(property.getName())) {
+                Assert.assertEquals(Cardinality.SET, 
property.getCardinality());
+            }
+        }
+        Assert.assertEquals(3, count);
+    }
+
+    @Test
+    public void testPropertyYamlWithCardinality() {
+        // Test converting Property to PropertyYaml and back
+        PropertyYaml singleYaml = new PropertyYaml(singleProperty);
+        PropertyYaml listYaml = new PropertyYaml(listProperty);
+        PropertyYaml setYaml = new PropertyYaml(setProperty);
+
+        // Check YAML representations
+        Assert.assertEquals("single_email", singleYaml.getName());
+        Assert.assertNull(singleYaml.getCardinality());
+
+        Assert.assertEquals("list_email", listYaml.getName());
+        Assert.assertEquals("list", listYaml.getCardinality());
+
+        Assert.assertEquals("set_email", setYaml.getName());
+        Assert.assertEquals("set", setYaml.getCardinality());
+
+        // Convert back to Property objects
+        Property singlePropFromYaml = new Property(singleYaml);
+        Property listPropFromYaml = new Property(listYaml);
+        Property setPropFromYaml = new Property(setYaml);
+
+        // Verify properties are correctly restored
+        Assert.assertEquals(singleProperty.getName(), 
singlePropFromYaml.getName());
+        Assert.assertEquals(singleProperty.getDataType(), 
singlePropFromYaml.getDataType());
+        Assert.assertEquals(singleProperty.getCardinality(), 
singlePropFromYaml.getCardinality());
+
+        Assert.assertEquals(listProperty.getName(), 
listPropFromYaml.getName());
+        Assert.assertEquals(listProperty.getDataType(), 
listPropFromYaml.getDataType());
+        Assert.assertEquals(listProperty.getCardinality(), 
listPropFromYaml.getCardinality());
+
+        Assert.assertEquals(setProperty.getName(), setPropFromYaml.getName());
+        Assert.assertEquals(setProperty.getDataType(), 
setPropFromYaml.getDataType());
+        Assert.assertEquals(setProperty.getCardinality(), 
setPropFromYaml.getCardinality());
+    }
+
+    @Test
+    public void testDefaultCardinality() {
+        // Test that properties created without specifying cardinality default 
to SINGLE
+        Property defaultProperty =
+                TestDataFactory.createProperty("default_prop", 
DataType.STRING, false, true);
+        Assert.assertEquals(Cardinality.SINGLE, 
defaultProperty.getCardinality());
+
+        // Test YAML conversion with default cardinality
+        PropertyYaml defaultYaml = new PropertyYaml(defaultProperty);
+        Assert.assertNull(defaultYaml.getCardinality());
+
+        Property defaultPropFromYaml = new Property(defaultYaml);
+        Assert.assertEquals(Cardinality.SINGLE, 
defaultPropFromYaml.getCardinality());
+    }
+
+    @Test
+    public void testInvalidCardinalityHandling() {
+        // Test handling of invalid cardinality in YAML
+        PropertyYaml invalidYaml = new PropertyYaml();
+        invalidYaml.setName("invalid_prop");
+        invalidYaml.setData_type("string");
+        invalidYaml.setCardinality("INVALID"); // This should default to SINGLE

Review Comment:
   The comment states "This should default to SINGLE" but the test correctly 
expects an `IllegalArgumentException` to be thrown. The comment is misleading 
and should be updated to reflect that invalid cardinality values should throw 
an exception rather than defaulting to SINGLE.
   ```suggestion
           invalidYaml.setCardinality("INVALID"); // This should throw an 
IllegalArgumentException
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyYaml.java:
##########
@@ -21,34 +21,33 @@
 
 import java.util.Optional;
 import org.apache.graphar.info.Property;
-import org.apache.graphar.info.type.DataType;
+import org.apache.graphar.info.type.Cardinality;
 
 public class PropertyYaml {
     private String name;
     private String data_type;
     private boolean is_primary;
     private Optional<Boolean> is_nullable;
+    private String cardinality;
 
     public PropertyYaml() {
         this.name = "";
         this.data_type = "";
         this.is_primary = false;
         this.is_nullable = Optional.empty();
+        this.cardinality = "single"; // Default to single

Review Comment:
   Setting a default value of "single" for the cardinality field in the no-arg 
constructor is problematic. When YAML deserialization occurs and no cardinality 
field is present, the field will remain as the default "single". However, the 
`getCardinality()` method (line 89) returns `null` for "single" cardinality to 
avoid serializing it. This creates an inconsistency. Consider initializing 
`cardinality` to `null` instead, and handle the default in the `Property` 
constructor that takes `PropertyYaml`.
   ```suggestion
           this.cardinality = null; // No default; handle in Property 
constructor
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/saver/BaseGraphInfoSaver.java:
##########
@@ -32,6 +32,11 @@ public abstract class BaseGraphInfoSaver implements 
GraphInfoSaver {
 
     @Override
     public void save(URI graphInfoUri, GraphInfo graphInfo) throws IOException 
{
+        // if graphInfoUri is a directory then save to 
${graphInfo.name}.graph.yml

Review Comment:
   The comment mentions `.graph.yml` but the code uses `.graph.yaml` on line 
38. Update the comment to match the actual file extension used in the code.
   ```suggestion
           // if graphInfoUri is a directory then save to 
${graphInfo.name}.graph.yaml
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/saver/BaseGraphInfoSaver.java:
##########
@@ -48,13 +53,22 @@ public void save(URI graphInfoUri, GraphInfo graphInfo) 
throws IOException {
 
     @Override
     public void save(URI vertexInfoUri, VertexInfo vertexInfo) throws 
IOException {
+        // if vertexInfoUri is a directory then save to 
${vertexInfo.type}.vertex.yml

Review Comment:
   The comment mentions `.vertex.yml` but the code uses `.vertex.yaml` on line 
59. Update the comment to match the actual file extension used in the code.
   ```suggestion
           // if vertexInfoUri is a directory then save to 
${vertexInfo.type}.vertex.yaml
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java:
##########
@@ -496,12 +497,14 @@ public URI getEdgesNumFileUri(AdjListType adjListType, 
long vertexChunkIndex) {
     }
 
     public void dump(Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         EdgeYaml edgeYaml = new EdgeYaml(this);
         yaml.dump(edgeYaml, output);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid EdgeInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("EdgeInfo object is not valid 
and cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           EdgeYaml edgeYaml = new EdgeYaml(this);
           yaml.dump(edgeYaml, output);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("EdgeInfo object is not valid 
and cannot be dumped.");
           }
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/saver/BaseGraphInfoSaver.java:
##########
@@ -48,13 +53,22 @@ public void save(URI graphInfoUri, GraphInfo graphInfo) 
throws IOException {
 
     @Override
     public void save(URI vertexInfoUri, VertexInfo vertexInfo) throws 
IOException {
+        // if vertexInfoUri is a directory then save to 
${vertexInfo.type}.vertex.yml
+        if (vertexInfoUri.getPath().endsWith("/")) {
+            vertexInfoUri =
+                    URI.create(vertexInfoUri.toString() + vertexInfo.getType() 
+ ".vertex.yaml");
+        }
         Writer vertexWriter = writeYaml(vertexInfoUri);
         vertexInfo.dump(vertexWriter);
         vertexWriter.close();
     }
 
     @Override
     public void save(URI edgeInfoUri, EdgeInfo edgeInfo) throws IOException {
+        // if edgeInfoUri is a directory then save to 
${edgeInfo.getConcat()}.edge.yml

Review Comment:
   The comment mentions `.edge.yml` but the code uses `.edge.yaml` on line 70. 
Update the comment to match the actual file extension used in the code.
   ```suggestion
           // if edgeInfoUri is a directory then save to 
${edgeInfo.getConcat()}.edge.yaml
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/VertexInfo.java:
##########
@@ -124,12 +129,14 @@ public URI getVerticesNumFileUri() {
     }
 
     public void dump(Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         VertexYaml vertexYaml = new VertexYaml(this);
         yaml.dump(vertexYaml, output);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid VertexInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("VertexInfo object is invalid 
and cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           VertexYaml vertexYaml = new VertexYaml(this);
           yaml.dump(vertexYaml, output);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("VertexInfo object is invalid 
and cannot be dumped.");
           }
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java:
##########
@@ -626,6 +629,10 @@ public boolean isValidated() {
             }
 
             for (Property p : pg.getPropertyList()) {
+                if (p.getCardinality() != Cardinality.SINGLE) {
+                    // edge property only supports single cardinality
+                    return false;
+                }

Review Comment:
   [nitpick] EdgeInfo doesn't expose a `getCardinality(String propertyName)` 
method like VertexInfo does (line 89 in VertexInfo.java). For API consistency, 
consider adding this method to EdgeInfo as well, which would always return 
`Cardinality.SINGLE` for valid edge properties. This would provide a uniform 
API across both VertexInfo and EdgeInfo.



##########
maven-projects/info/src/main/java/org/apache/graphar/info/EdgeInfo.java:
##########
@@ -496,12 +497,14 @@ public URI getEdgesNumFileUri(AdjListType adjListType, 
long vertexChunkIndex) {
     }
 
     public void dump(Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         EdgeYaml edgeYaml = new EdgeYaml(this);
         yaml.dump(edgeYaml, output);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid EdgeInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("EdgeInfo object is not valid 
and cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           EdgeYaml edgeYaml = new EdgeYaml(this);
           yaml.dump(edgeYaml, output);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("EdgeInfo object is not valid 
and cannot be dumped.");
           }
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/type/Cardinality.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.type;
+
+/** Defines how multiple values are handled for a given property key. */
+public enum Cardinality {
+    /** Single value property */
+    SINGLE,
+    /** List of values property */
+    LIST,
+    /** Set of values property (no duplicates) */
+    SET;
+

Review Comment:
   This method overrides [Enum<Cardinality>.toString](1); it is advisable to 
add an Override annotation.
   ```suggestion
   
       @Override
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java:
##########
@@ -128,18 +128,21 @@ private GraphInfo(
     }
 
     public void dump(URI storeUri, Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         GraphYaml graphYaml = new GraphYaml(storeUri, this);
         yaml.dump(graphYaml, output);
     }
 
     public String dump(URI storeUri) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         GraphYaml graphYaml = new GraphYaml(storeUri, this);
         return yaml.dump(graphYaml);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid GraphInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           GraphYaml graphYaml = new GraphYaml(storeUri, this);
           yaml.dump(graphYaml, output);
       }
   
       public String dump(URI storeUri) {
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           GraphYaml graphYaml = new GraphYaml(storeUri, this);
           return yaml.dump(graphYaml);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java:
##########
@@ -128,18 +128,21 @@ private GraphInfo(
     }
 
     public void dump(URI storeUri, Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         GraphYaml graphYaml = new GraphYaml(storeUri, this);
         yaml.dump(graphYaml, output);
     }
 
     public String dump(URI storeUri) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         GraphYaml graphYaml = new GraphYaml(storeUri, this);
         return yaml.dump(graphYaml);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid GraphInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           GraphYaml graphYaml = new GraphYaml(storeUri, this);
           yaml.dump(graphYaml, output);
       }
   
       public String dump(URI storeUri) {
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           GraphYaml graphYaml = new GraphYaml(storeUri, this);
           return yaml.dump(graphYaml);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
   ```



##########
maven-projects/info/src/main/java/org/apache/graphar/info/GraphInfo.java:
##########
@@ -128,18 +128,21 @@ private GraphInfo(
     }
 
     public void dump(URI storeUri, Writer output) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         GraphYaml graphYaml = new GraphYaml(storeUri, this);
         yaml.dump(graphYaml, output);
     }
 
     public String dump(URI storeUri) {
+        isValidated();
         Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
         GraphYaml graphYaml = new GraphYaml(storeUri, this);
         return yaml.dump(graphYaml);
     }
 
     public String dump() {
+        isValidated();

Review Comment:
   The call to `isValidated()` doesn't use its return value. If the intent is 
to validate before dumping, this should either throw an exception when 
validation fails, or check the return value and throw an appropriate exception. 
As written, invalid GraphInfo objects can still be dumped to YAML.
   ```suggestion
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           GraphYaml graphYaml = new GraphYaml(storeUri, this);
           yaml.dump(graphYaml, output);
       }
   
       public String dump(URI storeUri) {
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
           Yaml yaml = new Yaml(GraphYaml.getRepresenter(), 
GraphYaml.getDumperOptions());
           GraphYaml graphYaml = new GraphYaml(storeUri, this);
           return yaml.dump(graphYaml);
       }
   
       public String dump() {
           if (!isValidated()) {
               throw new IllegalStateException("GraphInfo is not valid and 
cannot be dumped.");
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to