if (shouldReturnField(fieldsToReturn, FIELD_DESCRIPTION_SECTIONS) && adHocDescription != null) {
ruleResponse.clearDescriptionSections();
- ruleResponse.addDescriptionSectionsBuilder()
+ ruleResponse.getDescriptionSectionsBuilder().addDescriptionSectionsBuilder()
.setKey(RuleDescriptionSectionDto.DEFAULT_KEY)
.setContent(macroInterpreter.interpret(adHocDescription));
}
if (shouldReturnField(fieldsToReturn, FIELD_DESCRIPTION_SECTIONS)) {
for (var section : ruleDto.getRuleDescriptionSectionDtos()) {
- ruleResponse.addDescriptionSectionsBuilder()
+ ruleResponse.getDescriptionSectionsBuilder().addDescriptionSectionsBuilder()
.setKey(section.getKey())
.setContent(retrieveDescriptionContent(ruleDto.getDescriptionFormat(), section))
.build();
.extracting(Rule::getName, Rule::getHtmlDesc, Rule::getSeverity, Rule::getType)
.containsExactlyInAnyOrder("adhoc name", "<div>desc2</div>", Severity.BLOCKER, VULNERABILITY);
- assertThat(resultRule.getDescriptionSectionsList()).hasSize(1);
- assertThat(resultRule.getDescriptionSectionsList().get(0))
- .extracting(r -> r.getKey(), r -> r.getContent())
- .containsExactly(DEFAULT_KEY, "<div>desc2</div>");
+ assertThat(resultRule.getDescriptionSections().getDescriptionSectionsList())
+ .extracting(Rule.DescriptionSection::getKey, Rule.DescriptionSection::getContent)
+ .containsExactly(tuple(DEFAULT_KEY, "<div>desc2</div>"));
}
@Test
+ "<h2>How can you fix it?</h2>"
+ "<div>I don't want to fix</div><br/>");
- assertThat(resultRule.getDescriptionSectionsList())
+ assertThat(resultRule.getDescriptionSections().getDescriptionSectionsList())
.extracting(Rule.DescriptionSection::getKey, Rule.DescriptionSection::getContent)
.containsExactlyInAnyOrder(
tuple(ROOT_CAUSE_SECTION_KEY, "<div>Root is Root</div>"),
assertThat(resultRule.getHtmlDesc()).contains("<strong>toto is toto</strong>");
assertThat(resultRule.getMdDesc()).contains("*toto is toto*");
- assertThat(resultRule.getDescriptionSectionsList())
+ assertThat(resultRule.getDescriptionSections().getDescriptionSectionsList())
.extracting(Rule.DescriptionSection::getKey, Rule.DescriptionSection::getContent)
.contains(tuple(DEFAULT_KEY, "<strong>toto is toto</strong>"));
}
optional sonarqube.ws.commons.RuleScope scope = 46;
optional bool isExternal = 47;
optional DeprecatedKeys deprecatedKeys = 48;
- repeated DescriptionSection descriptionSections = 49;
+ optional DescriptionSections descriptionSections = 49;
+
+ message DescriptionSections {
+ repeated DescriptionSection descriptionSections = 1;
+ }
message DescriptionSection {
required string key = 1;