imbajin commented on code in PR #685:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/685#discussion_r2467769668


##########
hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java:
##########
@@ -198,51 +207,85 @@ public Map<String, String> reload() {
     }
 
     public void mode(String graph, GraphMode mode) {
-        // NOTE: Must provide id for PUT. If you use "graph/mode", "/" will
-        // be encoded to "%2F". So use "mode" here, although inaccurate.
-        this.client.put(joinPath(this.path(), graph, MODE), null, mode);
+        mode(null, graph, mode);
     }
 
-    public GraphMode mode(String graph) {
-        RestResult result = this.client.get(joinPath(this.path(), graph), 
MODE);
-        @SuppressWarnings("unchecked")
-        Map<String, String> mode = result.readObject(Map.class);
-        String value = mode.get(MODE);
-        if (value == null) {
-            throw new InvalidResponseException("Invalid response, expect 
'mode' in response");
-        }
-        try {
-            return GraphMode.valueOf(value);
-        } catch (IllegalArgumentException e) {
-            throw new InvalidResponseException("Invalid GraphMode value '%s'", 
value);
+    public void mode(String graphSpace, String graph, GraphMode mode) {

Review Comment:
   ‼️ **Critical**:  和  方法缺少版本检查一致性
   
   在  方法中缺少对 graphSpace 功能的版本检查,而  方法有 ,但也没有检查 graphSpace 支持。
   
   两个方法应该都包含:
   ```java
   public void mode(String graphSpace, String graph, GraphMode mode) {
       if (graphSpace != null) {
           this.client.checkApiVersion("1.7", "graph space");
       }
       // ...
   }
   
   public void readMode(String graphSpace, String graph, GraphReadMode 
readMode) {
       this.client.checkApiVersion("0.59", "graph read mode");
       if (graphSpace != null) {
           this.client.checkApiVersion("1.7", "graph space");
       }
       // ...
   }
   ```



-- 
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