"Requires the 'Administer' permission on the project")
.setSince("8.1")
.setResponseExample(getClass().getResource("example-get_binding.json"))
- .setChangelog(new Change("8.6", "Azure binding now contains the project and repository names"))
- .setChangelog(new Change("8.7", "Azure binding now contains a monorepo flag for monorepo feature in Enterprise Edition and above"))
+ .setChangelog(
+ new Change("8.6", "Azure binding now contains the project and repository names"),
+ new Change("8.7", "Azure binding now contains a monorepo flag for monorepo feature in Enterprise Edition and above"))
.setHandler(this);
action
.setDescription("Return project repository")
.setResponseExample(getClass().getResource("project-example.json"))
.setSince("4.5")
- .setChangelog(new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_KEY)))
- .setChangelog(new Change("7.6", "Stop returning settings"))
- .setChangelog(new Change("7.7", "Stop supporting preview mode, removed timestamp and last analysis date"))
+ .setChangelog(
+ new Change("7.6", String.format("The use of module keys in parameter '%s' is deprecated", PARAM_KEY)),
+ new Change("7.6", "Stop returning settings"),
+ new Change("7.7", "Stop supporting preview mode, removed timestamp and last analysis date"))
.setInternal(true)
.setHandler(this);
.setDescription("Key of the component (project) to filter on")
.setExampleValue(KeyExamples.KEY_PROJECT_EXAMPLE_001);
- action.setChangelog(new Change("6.6", "New field 'inProgress' in response"));
- action.setChangelog(new Change("7.8", "New field 'pendingTime' in response, only included when there are pending tasks"));
- action.setChangelog(new Change("8.8", "Parameter 'componentId' is now deprecated."));
- action.setChangelog(new Change("8.8", "Parameter 'componentKey' is now removed. Please use parameter 'component' instead."));
+ action.setChangelog(
+ new Change("6.6", "New field 'inProgress' in response"),
+ new Change("7.8", "New field 'pendingTime' in response, only included when there are pending tasks"),
+ new Change("8.8", "Parameter 'componentId' is now deprecated."),
+ new Change("8.8", "Parameter 'componentKey' is now removed. Please use parameter 'component' instead."));
}
@Override
parameterRequiredMessage)
.setSince("5.2")
.setHandler(this)
- .setChangelog(new Change("7.8", parameterRequiredMessage))
- .setChangelog(new Change("9.1", "The parameter '" + PARAM_ANALYZED_BEFORE + "' "
+ .setChangelog(
+ new Change("7.8", parameterRequiredMessage),
+ new Change("9.1", "The parameter '" + PARAM_ANALYZED_BEFORE + "' "
+ "takes into account the analysis of all branches and pull requests, not only the main branch."));
action
WebService.NewAction action = controller.createAction(ACTION)
.addPagingParams(100, MAX_PAGE_SIZE)
.setHandler(this)
- .setChangelog(new Change("7.1", "The field 'scope' has been added to the response"))
- .setChangelog(new Change("7.1", "The field 'scope' has been added to the 'f' parameter"))
- .setChangelog(new Change("7.2", "The field 'isExternal' has been added to the response"))
- .setChangelog(new Change("7.2", "The field 'includeExternal' has been added to the 'f' parameter"))
- .setChangelog(new Change("7.5", "The field 'updatedAt' has been added to the 'f' parameter"));
+ .setChangelog(new Change("7.1", "The field 'scope' has been added to the response"),
+ new Change("7.1", "The field 'scope' has been added to the 'f' parameter"),
+ new Change("7.2", "The field 'isExternal' has been added to the response"),
+ new Change("7.2", "The field 'includeExternal' has been added to the 'f' parameter"),
+ new Change("7.5", "The field 'updatedAt' has been added to the 'f' parameter"));
action.createParam(FACETS)
.setDescription("Comma-separated list of the facets to be computed. No facet is computed by default.")
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
/**
* List of changes made to the contract or valuable insight. Example: changes to the response format.
+ * Calling this method multiple times will not override previously set changes - all changes will be added.
*
* @since 6.4
*/
public NewAction setChangelog(Change... changes) {
- this.changelog = stream(requireNonNull(changes))
+ requireNonNull(changes);
+ Arrays.stream(changes)
.filter(Objects::nonNull)
- .collect(Collectors.toList());
-
+ .forEach(this.changelog::add);
return this;
}
tuple("6.4", "Last event"), tuple("6.0", "Old event"), tuple("4.5.6", "Very old event"));
}
+ @Test
+ public void add_changelog_if_called_twice() {
+ WebService webService = context -> {
+ NewController newController = context.createController("api/rule");
+ newDefaultAction(newController, "list")
+ .setDescription("desc")
+ .setChangelog(new Change("1.0", "change1"))
+ .setChangelog(new Change("2.0", "change2"));
+ newController.done();
+ };
+
+ webService.define(context);
+ assertThat(context.controller("api/rule").action("list").changelog())
+ .extracting(Change::getVersion, Change::getDescription)
+ .containsOnly(
+ tuple("1.0", "change1"),
+ tuple("2.0", "change2"));
+ }
+
@Test
public void fail_if_duplicated_ws_keys() {
MetricWs metricWs = new MetricWs();