aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-02 10:55:37 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2015-04-02 10:55:37 +0200
commitc758df02ed6c84bdeaff46aa9fc4648fd296c945 (patch)
treecb8aad3874f48e789d493b69e535430049897bbb /server
parent62aa1093cac90e198376cb6968842d34adf870a3 (diff)
downloadsonarqube-c758df02ed6c84bdeaff46aa9fc4648fd296c945.tar.gz
sonarqube-c758df02ed6c84bdeaff46aa9fc4648fd296c945.zip
SONAR-6294 Update response example, only write active rule count when needed
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileSearchAction.java2
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-search.json23
2 files changed, 14 insertions, 11 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileSearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileSearchAction.java
index cb13f83630f..4c0653b01ee 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileSearchAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileSearchAction.java
@@ -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
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-search.json b/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-search.json
index edf8b8dae89..eeb62bd60e7 100644
--- a/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-search.json
+++ b/server/sonar-server/src/main/resources/org/sonar/server/qualityprofile/ws/example-search.json
@@ -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
+}