Skip to content

Commit 85f3305

Browse files
committed
Document properties that were removed without a deprecation period
This commit documents properties that are removed without being deprecated first. Previously those properties were undocumented. Closes gh-47762
1 parent d8be5ca commit 85f3305

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

configuration-metadata/spring-boot-configuration-metadata-changelog-generator/src/main/java/org/springframework/boot/configurationmetadata/changelog/Difference.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ static Difference compute(ConfigurationMetadataProperty oldProperty, Configurati
4040
return null;
4141
}
4242
if (newProperty.isDeprecated() && !oldProperty.isDeprecated()) {
43-
return new Difference(DifferenceType.DEPRECATED, oldProperty, newProperty);
43+
Level level = newProperty.getDeprecation().getLevel();
44+
DifferenceType differenceType = (level == Level.WARNING) ? DifferenceType.DEPRECATED
45+
: DifferenceType.DELETED;
46+
return new Difference(differenceType, oldProperty, newProperty);
4447
}
4548
if (oldProperty.isDeprecated() && oldProperty.getDeprecation().getLevel() == Level.WARNING
4649
&& newProperty.isDeprecated() && newProperty.getDeprecation().getLevel() == Level.ERROR) {

configuration-metadata/spring-boot-configuration-metadata-changelog-generator/src/test/java/org/springframework/boot/configurationmetadata/changelog/ChangelogTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void diffContainsDifferencesBetweenLeftAndRightInputs() {
3939
assertThat(differences).isNotNull();
4040
assertThat(differences.oldVersionNumber()).isEqualTo("1.0");
4141
assertThat(differences.newVersionNumber()).isEqualTo("2.0");
42-
assertThat(differences.differences()).hasSize(6);
42+
assertThat(differences.differences()).hasSize(7);
4343
List<Difference> added = differences.differences()
4444
.stream()
4545
.filter((difference) -> difference.type() == DifferenceType.ADDED)
@@ -51,7 +51,8 @@ void diffContainsDifferencesBetweenLeftAndRightInputs() {
5151
.stream()
5252
.filter((difference) -> difference.type() == DifferenceType.DELETED)
5353
.toList();
54-
assertThat(deleted).hasSize(3)
54+
assertThat(deleted).hasSize(4)
55+
.anySatisfy((entry) -> assertProperty(entry.oldProperty(), "test.replace", String.class, "replace"))
5556
.anySatisfy((entry) -> assertProperty(entry.oldProperty(), "test.delete", String.class, "delete"))
5657
.anySatisfy(
5758
(entry) -> assertProperty(entry.newProperty(), "test.delete.deprecated", String.class, "delete"))

configuration-metadata/spring-boot-configuration-metadata-changelog-generator/src/test/resources/sample-1.0.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
"description": "Test equality.",
77
"defaultValue": "test"
88
},
9+
{
10+
"name": "test.replace",
11+
"type": "java.lang.String",
12+
"description": "Test Replace.",
13+
"defaultValue": "replace"
14+
},
915
{
1016
"name": "test.deprecate",
1117
"type": "java.lang.String",

configuration-metadata/spring-boot-configuration-metadata-changelog-generator/src/test/resources/sample-2.0.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
"description": "Test add.",
77
"defaultValue": "new"
88
},
9+
{
10+
"name": "test.replace",
11+
"type": "java.lang.String",
12+
"deprecation": {
13+
"level": "error",
14+
"replacement": "test.add"
15+
}
16+
},
917
{
1018
"name": "test.add.deprecated",
1119
"type": "java.lang.String",
@@ -28,7 +36,7 @@
2836
"description": "Test deprecate.",
2937
"defaultValue": "wrong",
3038
"deprecation": {
31-
"level": "error"
39+
"level": "warn"
3240
}
3341
},
3442
{

configuration-metadata/spring-boot-configuration-metadata-changelog-generator/src/test/resources/sample.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ Configuration property changes between `1.0` and `2.0`
44

55
== Deprecated in 2.0
66

7-
_None_.
7+
|======================
8+
| Key | Replacement | Reason
9+
10+
| `test.deprecate`
11+
|
12+
|
13+
|======================
814

915

1016

@@ -40,4 +46,8 @@ _None_.
4046
| `test.removed.directly`
4147
| `test.new.property`
4248
| removed in third-party library without deprecation
49+
50+
| `test.replace`
51+
| `test.add`
52+
|
4353
|======================

0 commit comments

Comments
 (0)