]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6294 Update response example, only write active rule count when needed
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 2 Apr 2015 08:55:37 +0000 (10:55 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 2 Apr 2015 08:55:37 +0000 (10:55 +0200)
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileSearchAction.java
server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-search.json

index cb13f83630f4f0ad3d91b07b37f9c111ae23c230..4c0653b01ee83d34acd6fa458b11a3fa6e6bfcc0 100644 (file)
@@ -118,7 +118,7 @@ public class QProfileSearchAction implements BaseQProfileWsAction {
       json.beginObject()
         .prop(FIELD_KEY, nullUnlessNeeded(FIELD_KEY, key, fields))
         .prop(FIELD_NAME, nullUnlessNeeded(FIELD_NAME, profile.name(), fields))
-        .prop(FIELD_ACTIVE_RULE_COUNT, activeRuleCountByKey.get(key));
+        .prop(FIELD_ACTIVE_RULE_COUNT, nullUnlessNeeded(FIELD_ACTIVE_RULE_COUNT, activeRuleCountByKey.get(key), fields));
       writeLanguageFields(json, profile, fields);
       writeParentFields(json, profile, fields, profilesByKey);
       // Special case for booleans
index edf8b8dae89d39f4da0d82386dfdd4fec718053a..eeb62bd60e7f4fbd3894283f8e8759016b85d2f7 100644 (file)
@@ -4,31 +4,34 @@
       "key": "sonar-way-cs-12345",
       "name": "Sonar way",
       "language": "cs",
-      "isInherited": false
+      "languageName": "C#",
+      "isInherited": false,
+      "activeRuleCount": 37
     },
     {
       "key": "my-bu-profile-java-34567",
       "name": "My BU Profile",
       "language": "java",
+      "languageName": "Java",
       "isInherited": true,
-      "parentKey": "my-company-profile-java-23456"
+      "parentKey": "my-company-profile-java-23456",
+      "parentName": "My Company Profile",
+      "activeRuleCount": 72
     },
     {
       "key": "my-company-profile-java-23456",
       "name": "My Company Profile",
       "language": "java",
-      "isInherited": false
+      "isInherited": false,
+      "isDefault": true,
+      "activeRuleCount": 42
     },
     {
       "key": "sonar-way-python-01234",
       "name": "Sonar way",
       "language": "py",
-      "isInherited": false
+      "isInherited": false,
+      "activeRuleCount": 125
     }
-  ],
-  "languages": [
-    {"key": "cs", "name": "C#"},
-    {"key": "java", "name": "Java"},
-    {"key": "py", "name": "Python"}
   ]
-}
\ No newline at end of file
+}