Commit 29202593 authored by Andy Wilkinson's avatar Andy Wilkinson

Omit null properties from actuator endpoint API response examples

Closes gh-11757
parent 41bfe079
...@@ -56,7 +56,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit ...@@ -56,7 +56,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true", @TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true",
"management.endpoints.web.expose=*" }) "management.endpoints.web.expose=*",
"spring.jackson.default-property-inclusion=non_null" })
public class AbstractEndpointDocumentationTests { public class AbstractEndpointDocumentationTests {
protected String describeEnumValues(Class<? extends Enum<?>> enumType) { protected String describeEnumValues(Class<? extends Enum<?>> enumType) {
......
...@@ -31,6 +31,7 @@ import org.springframework.context.annotation.Configuration; ...@@ -31,6 +31,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation; import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
import org.springframework.restdocs.payload.FieldDescriptor; import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.restdocs.payload.JsonFieldType;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
...@@ -80,9 +81,11 @@ public class LiquibaseEndpointDocumentationTests ...@@ -80,9 +81,11 @@ public class LiquibaseEndpointDocumentationTests
fieldWithPath("labels") fieldWithPath("labels")
.description("Labels associated with the change set."), .description("Labels associated with the change set."),
fieldWithPath("checksum").description("Checksum of the change set."), fieldWithPath("checksum").description("Checksum of the change set."),
fieldWithPath("orderExecuted") fieldWithPath("orderExecuted").description(
.description("Order of the execution of the change set."), "Order of the execution of the change set."),
fieldWithPath("tag").description("Tag associated with the change set.")); fieldWithPath("tag")
.description("Tag associated with the change set, if any.")
.optional().type(JsonFieldType.STRING));
} }
@Configuration @Configuration
......
...@@ -36,8 +36,7 @@ import org.springframework.web.context.WebApplicationContext; ...@@ -36,8 +36,7 @@ import org.springframework.web.context.WebApplicationContext;
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(properties = { "spring.jackson.serialization.indent_output=true", @SpringBootTest
"management.endpoints.web.expose=*" })
public abstract class MockMvcEndpointDocumentationTests public abstract class MockMvcEndpointDocumentationTests
extends AbstractEndpointDocumentationTests { extends AbstractEndpointDocumentationTests {
......
...@@ -123,8 +123,8 @@ public class ThreadDumpEndpointDocumentationTests ...@@ -123,8 +123,8 @@ public class ThreadDumpEndpointDocumentationTests
fieldWithPath("threads.[].lockOwnerName") fieldWithPath("threads.[].lockOwnerName")
.description("Name of the thread that owns the " .description("Name of the thread that owns the "
+ "object on which the thread is " + "object on which the thread is "
+ "blocked.") + "blocked, if any.")
.optional(), .optional().type(JsonFieldType.STRING),
fieldWithPath("threads.[].priority") fieldWithPath("threads.[].priority")
.description("Priority of the thread. Only " .description("Priority of the thread. Only "
+ "available on Java 9 or later.") + "available on Java 9 or later.")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment