]> source.dussan.org Git - sonarqube.git/commitdiff
Fix 'q' parameter documentation for WS api/components/search and api/projects/search
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 30 Aug 2017 15:45:03 +0000 (17:45 +0200)
committerStas Vilchik <stas.vilchik@sonarsource.com>
Mon, 11 Sep 2017 09:28:29 +0000 (11:28 +0200)
server/sonar-server/src/main/java/org/sonar/server/component/ws/SearchAction.java
server/sonar-server/src/main/java/org/sonar/server/project/ws/SearchAction.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchActionTest.java

index 33e706ee1ba3d3b145d33d5da9e651ac649aa033..c8c8ef5f1fba07f985b8edd34cb50963b3a3e460 100644 (file)
@@ -82,9 +82,16 @@ public class SearchAction implements ComponentsWsAction {
       .setSince("6.3")
       .setDescription("Search for components")
       .addPagingParams(100)
-      .addSearchQuery("sona", "component names", "component keys")
       .setResponseExample(getClass().getResource("search-components-example.json"))
       .setHandler(this);
+
+    action.createParam(Param.TEXT_QUERY)
+      .setDescription("Limit search to: <ul>" +
+        "<li>component names that contain the supplied string</li>" +
+        "<li>component keys that are exactly the same as the supplied string</li>" +
+        "</ul>")
+      .setExampleValue("sonar");
+
     action
       .createParam(PARAM_ORGANIZATION)
       .setDescription("Organization key")
@@ -92,6 +99,7 @@ public class SearchAction implements ComponentsWsAction {
       .setInternal(true)
       .setExampleValue("my-org")
       .setSince("6.3");
+
     action
       .createParam(PARAM_LANGUAGE)
       .setDescription("Language key. If provided, only components for the given language are returned.")
index 9aed6b6e00f57351f734fe3ae841c99bfe11591b..015bf3740b7f32f630a10663b4c49e035e00379a 100644 (file)
@@ -84,12 +84,18 @@ public class SearchAction implements ProjectsWsAction {
         "Requires 'System Administrator' permission")
       .setInternal(true)
       .addPagingParams(100, MAX_PAGE_SIZE)
-      .addSearchQuery("sona", "component names", "component keys")
       .setResponseExample(getClass().getResource("search-example.json"))
       .setHandler(this);
 
     action.setChangelog(new Change("6.4", "The 'uuid' field is deprecated in the response"));
 
+    action.createParam(Param.TEXT_QUERY)
+      .setDescription("Limit search to: <ul>" +
+        "<li>component names that contain the supplied string</li>" +
+        "<li>component keys that are exactly the same as the supplied string</li>" +
+        "</ul>")
+      .setExampleValue("sonar");
+
     action.createParam(PARAM_QUALIFIERS)
       .setDescription("Comma-separated list of component qualifiers. Filter the results with the specified qualifiers")
       .setPossibleValues(PROJECT, VIEW, APP)
index c6739877a71634ff2e73ae08cc28076a9d37e623..439d4d10f2f23e39f0bd946def228e6545817a6d 100644 (file)
@@ -285,7 +285,11 @@ public class SearchActionTest {
 
     WebService.Param qParam = action.param("q");
     assertThat(qParam.isRequired()).isFalse();
-    assertThat(qParam.description()).isEqualTo("Limit search to component names or component keys that contain the supplied string.");
+    assertThat(qParam.description()).isEqualTo("Limit search to: " +
+      "<ul>" +
+      "<li>component names that contain the supplied string</li>" +
+      "<li>component keys that are exactly the same as the supplied string</li>" +
+      "</ul>");
 
     WebService.Param qualifierParam = action.param("qualifiers");
     assertThat(qualifierParam.isRequired()).isFalse();