From 403803837a1483609ee19ace3766a7c4dc26b4b9 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 12 Oct 2022 11:29:59 +0100 Subject: [PATCH] Adapt to changes in REST Docs for documenting query parameters See gh-32623 --- .../src/docs/asciidoc/endpoints/auditevents.adoc | 2 +- .../src/docs/asciidoc/endpoints/caches.adoc | 4 ++-- .../src/docs/asciidoc/endpoints/metrics.adoc | 2 +- .../src/docs/asciidoc/endpoints/prometheus.adoc | 2 +- .../src/docs/asciidoc/endpoints/sessions.adoc | 2 +- .../AuditEventsEndpointDocumentationTests.java | 4 ++-- .../documentation/CachesEndpointDocumentationTests.java | 8 ++++---- .../documentation/MetricsEndpointDocumentationTests.java | 4 ++-- .../PrometheusScrapeEndpointDocumentationTests.java | 4 ++-- .../documentation/SessionsEndpointDocumentationTests.java | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/auditevents.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/auditevents.adoc index 2cba373c1d..1aad3ea958 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/auditevents.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/auditevents.adoc @@ -23,7 +23,7 @@ The endpoint uses query parameters to limit the events that it returns. The following table shows the supported query parameters: [cols="2,4"] -include::{snippets}/auditevents/filtered/request-parameters.adoc[] +include::{snippets}/auditevents/filtered/query-parameters.adoc[] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/caches.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/caches.adoc index f818b01f35..ebc2be7047 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/caches.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/caches.adoc @@ -46,7 +46,7 @@ Otherwise, the `cacheManager` must be specified. The following table shows the supported query parameters: [cols="2,4"] -include::{snippets}/caches/named/request-parameters.adoc[] +include::{snippets}/caches/named/query-parameters.adoc[] @@ -85,4 +85,4 @@ Otherwise, the `cacheManager` must be specified. The following table shows the supported query parameters: [cols="2,4"] -include::{snippets}/caches/evict-named/request-parameters.adoc[] +include::{snippets}/caches/evict-named/query-parameters.adoc[] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/metrics.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/metrics.adoc index 7f16cdd35a..a7313d1721 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/metrics.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/metrics.adoc @@ -45,7 +45,7 @@ The endpoint uses query parameters to <> into The following table shows the single supported query parameter: [cols="2,4"] -include::{snippets}/metrics/metric-with-tags/request-parameters.adoc[] +include::{snippets}/metrics/metric-with-tags/query-parameters.adoc[] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/prometheus.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/prometheus.adoc index a3fe04b63b..2fb9efba94 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/prometheus.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/prometheus.adoc @@ -31,7 +31,7 @@ The endpoint uses query parameters to limit the samples that it returns. The following table shows the supported query parameters: [cols="2,4"] -include::{snippets}/prometheus/names/request-parameters.adoc[] +include::{snippets}/prometheus/names/query-parameters.adoc[] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/sessions.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/sessions.adoc index 62b1ec9193..d921bcda8f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/sessions.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/asciidoc/endpoints/sessions.adoc @@ -23,7 +23,7 @@ The endpoint uses query parameters to limit the sessions that it returns. The following table shows the single required query parameter: [cols="2,4"] -include::{snippets}/sessions/username/request-parameters.adoc[] +include::{snippets}/sessions/username/query-parameters.adoc[] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/AuditEventsEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/AuditEventsEndpointDocumentationTests.java index d5c18d1735..9319578d51 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/AuditEventsEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/AuditEventsEndpointDocumentationTests.java @@ -38,7 +38,7 @@ import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.docu import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -76,7 +76,7 @@ class AuditEventsEndpointDocumentationTests extends MockMvcEndpointDocumentation .param("principal", "alice").param("after", queryTimestamp).param("type", "logout")) .andExpect(status().isOk()) .andDo(document("auditevents/filtered", - requestParameters( + queryParameters( parameterWithName("after").description( "Restricts the events to those that occurred after the given time. Optional."), parameterWithName("principal").description( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/CachesEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/CachesEndpointDocumentationTests.java index 9b9e0a408c..7f37258993 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/CachesEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/CachesEndpointDocumentationTests.java @@ -38,7 +38,7 @@ import org.springframework.restdocs.request.ParameterDescriptor; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -55,7 +55,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests fieldWithPath("cacheManager").description("Cache manager name."), fieldWithPath("target").description("Fully qualified name of the native cache.")); - private static final List requestParameters = Collections + private static final List queryParameters = Collections .singletonList(parameterWithName("cacheManager").description( "Name of the cacheManager to qualify the cache. May be omitted if the cache name is unique.") .optional()); @@ -74,7 +74,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests @Test void namedCache() throws Exception { this.mockMvc.perform(get("/actuator/caches/cities")).andExpect(status().isOk()).andDo(MockMvcRestDocumentation - .document("caches/named", requestParameters(requestParameters), responseFields(levelFields))); + .document("caches/named", queryParameters(queryParameters), responseFields(levelFields))); } @Test @@ -87,7 +87,7 @@ class CachesEndpointDocumentationTests extends MockMvcEndpointDocumentationTests void evictNamedCache() throws Exception { this.mockMvc.perform(delete("/actuator/caches/countries?cacheManager=anotherCacheManager")) .andExpect(status().isNoContent()) - .andDo(MockMvcRestDocumentation.document("caches/evict-named", requestParameters(requestParameters))); + .andDo(MockMvcRestDocumentation.document("caches/evict-named", queryParameters(queryParameters))); } @Configuration(proxyBeanMethods = false) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java index 6a179c3535..d0da4d4d23 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java @@ -30,7 +30,7 @@ import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.docu import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -69,7 +69,7 @@ class MetricsEndpointDocumentationTests extends MockMvcEndpointDocumentationTest .perform(get("/actuator/metrics/jvm.memory.max").param("tag", "area:nonheap").param("tag", "id:Compressed Class Space")) .andExpect(status().isOk()) - .andDo(document("metrics/metric-with-tags", requestParameters(parameterWithName("tag") + .andDo(document("metrics/metric-with-tags", queryParameters(parameterWithName("tag") .description("A tag to use for drill-down in the form `name:value`.")))); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java index 128ff6033f..3fa70f93db 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java @@ -30,7 +30,7 @@ import org.springframework.context.annotation.Import; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -62,7 +62,7 @@ class PrometheusScrapeEndpointDocumentationTests extends MockMvcEndpointDocument .perform(get("/actuator/prometheus").param("includedNames", "jvm_memory_used_bytes,jvm_memory_committed_bytes")) .andExpect(status().isOk()) - .andDo(document("prometheus/names", requestParameters(parameterWithName("includedNames") + .andDo(document("prometheus/names", queryParameters(parameterWithName("includedNames") .description("Restricts the samples to those that match the names. Optional.").optional()))); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SessionsEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SessionsEndpointDocumentationTests.java index d2282f986d..895bf63ccf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SessionsEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SessionsEndpointDocumentationTests.java @@ -43,7 +43,7 @@ import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.docu import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; -import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; +import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -88,7 +88,7 @@ class SessionsEndpointDocumentationTests extends MockMvcEndpointDocumentationTes .andDo(document("sessions/username", responseFields(fieldWithPath("sessions").description("Sessions for the given username.")) .andWithPrefix("sessions.[].", sessionFields), - requestParameters(parameterWithName("username").description("Name of the user.")))); + queryParameters(parameterWithName("username").description("Name of the user.")))); } @Test