Add support for property deprecation

Previously, an item could only have a 'deprecated' boolean flag to
indicate that the property is deprecated. It is desirable to provide an
additional description for the deprecation as well as the name of the
property to use instead.

The `deprecated` boolean flag is now supported. Instead, a `deprecated`
object can be specified with two optional attributes: `reason` to provide
an explanation for the deprecation and `replacement` to refer to the
property that should be used instead. If none of them is present, an
empty deprecation object should be set.

For backward compatibility, the `deprecated` field is still set.

Deprecation information can only set via manual meta-data.

Closes gh-3449
This commit is contained in:
Stephane Nicoll
2015-07-15 15:41:52 +02:00
parent b1e9139efe
commit f2d32d3e98
15 changed files with 370 additions and 78 deletions

View File

@@ -188,12 +188,36 @@ The JSON object contained in the `properties` array can contain the following at
array of value(s) if the type of the property is an array. May be omitted if the default
value is not known.
|`deprecated`
| boolean
|`deprecation`
| Deprecation
| Specify if the property is deprecated. May be omitted if the field is not deprecated
or if that information is not known.
or if that information is not known. See below for more details.
|===
The JSON object contained in the `deprecation` attribute of each `properties` element can
contain the following attributes:
[cols="1,1,4"]
|===
|Name | Type |Purpose
|`reason`
| String
| A short description of the reason why the property was deprecated. May be omitted if no
reason is available. It is recommended that descriptions are a short paragraphs,
with the first line providing a concise summary. The last line in the description should
end with a period (`.`).
|`replacement`
| String
| The full name of the property that is _replacing_ this deprecated property. May be omitted
if there is no replacement for this property.
|===
NOTE: Prior to Spring Boot 1.3, a single `deprecated` boolean attribute can be used instead of
the `deprecation` element. This is still supported in a deprecated fashion and should no longer
be used. If no reason and replacement are available, an empty `deprecation` object should be
set.
[[configuration-metadata-hints-attributes]]