]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6019 Change format of "characteristics" in api/rules/app WS
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 19 Jan 2015 16:50:54 +0000 (17:50 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 19 Jan 2015 16:51:00 +0000 (17:51 +0100)
server/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
server/sonar-server/src/test/resources/org/sonar/server/rule/ws/AppActionTest/app.json

index 1e5dd3561efaf85409ad152ed2aa47278090c0f6..7ca17abfd905393899fa7306a642fcd217c9d71b 100644 (file)
@@ -135,11 +135,17 @@ public class AppAction implements RequestHandler {
       DefaultDebtCharacteristic fullCarac = (DefaultDebtCharacteristic) carac;
       caracById.put(fullCarac.id(), fullCarac);
     }
-    json.name("characteristics").beginObject();
+    json.name("characteristics").beginArray();
     for (DefaultDebtCharacteristic carac : caracById.values()) {
-      json.prop(carac.key(), carac.isSub() ? caracById.get(carac.parentId()).name() + ": " + carac.name() : carac.name());
+      json.beginObject()
+        .prop("key", carac.key())
+        .prop("name", carac.name());
+      if (carac.isSub()) {
+        json.prop("parent", caracById.get(carac.parentId()).key());
+      }
+      json.endObject();
     }
-    json.endObject();
+    json.endArray();
   }
 
   void define(WebService.NewController controller) {
index c438dc3f2e5bd1e43057010e74d8e7078859f7b2..2fd983ef78c5063a71b060e51d368b9a1d64140e 100644 (file)
@@ -34,8 +34,8 @@
     "DEPRECATED": "rules.status.deprecated",
     "READY": "rules.status.ready"
   },
-  "characteristics": {
-    "REUSABILITY": "Reusability",
-    "MODULARITY": "Reusability: Modularity"
-  }}
+  "characteristics": [
+    {"key": "REUSABILITY", "name": "Reusability"},
+    {"key": "MODULARITY", "name": "Modularity", "parent": "REUSABILITY"}
+  ]}