Skip to content

Commit 0e17f74

Browse files
committed
Enhance Actuator + CHANGELOG.md update
1 parent d571b70 commit 0e17f74

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,30 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.6.0] - 2021-12-12
8+
### Added
9+
- #1356, #1360 - Add support for caching based on Locale
10+
- #1355 - Add support for @Tag description using i18n
11+
- #1376 - Add Support for Spring Native 0.11
12+
- #1365 - Make MediaType for "loginRequestBody" as "application/json"
13+
- #1375 - Support @JsonIgnore in @ParameterObject.
14+
- #1379 - Enable support for queryConfigEnabled. Disable reading config params from URL search params by default
15+
### Changed
16+
- Upgrade swagger-ui to 4.1.3
17+
- Upgrade to spring-boot 2.6.1
18+
- #1373 - Enhance Pageable config
19+
### Fixed
20+
- #1353 - Servers from cached OpenAPI are overwritten and customizer is skipped.
21+
- #1364 - Incorrect configUrl due to null path prefix
22+
- #1370 - NullPointerException on JavadocPropertyCustomizer.java:81 - Warning level
23+
724
## [1.5.13] - 2021-11-30
825
### Added
926
- #1317 - Add SpEL support for default values
1027
- #1324 - springdoc-openapi-javadoc doesn't work with @ParameterObject
1128
- #1334 - Allow customizing / disabling PolymorphicModelConverter
1229
- #1328 - Add support for spring-native 0.11-RC1. (remove property springdoc.enable-native-image-support and introduce new springdoc module)
13-
- #1348 - Treat java.nio.charset.Charset as string type by default.
30+
- #1348 - Treat java.nio.charset.Charset as string type by default
1431
### Changed
1532
- Upgrade swagger-ui to 4.1.2
1633
- Upgrade to spring-boot 2.6.0

springdoc-openapi-common/src/main/java/org/springdoc/core/customizers/ActuatorOpenApiCustomizer.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.regex.Matcher;
66
import java.util.regex.Pattern;
77

8+
import io.swagger.v3.core.filter.SpecFilter;
89
import io.swagger.v3.oas.models.OpenAPI;
910
import io.swagger.v3.oas.models.PathItem;
1011
import io.swagger.v3.oas.models.media.StringSchema;
@@ -14,13 +15,11 @@
1415
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
1516
import org.springframework.util.CollectionUtils;
1617

17-
import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
18-
1918
/**
2019
* The type Actuator open api customiser.
2120
* @author bnasslahsen
2221
*/
23-
public class ActuatorOpenApiCustomizer implements OpenApiCustomiser {
22+
public class ActuatorOpenApiCustomizer extends SpecFilter implements OpenApiCustomiser {
2423

2524
/**
2625
* The Path pathern.
@@ -35,8 +34,11 @@ public ActuatorOpenApiCustomizer(WebEndpointProperties webEndpointProperties) {
3534

3635
@Override
3736
public void customise(OpenAPI openApi) {
37+
openApi.getPaths().entrySet().removeIf(path -> !path.getKey().startsWith(webEndpointProperties.getBasePath()));
38+
openApi.getTags().removeIf(tag -> openApi.getPaths().entrySet().stream().anyMatch(pathItemEntry -> pathItemEntry.getValue().
39+
readOperations().stream().noneMatch(operation -> operation.getTags().contains(tag.getName()))));
40+
3841
openApi.getPaths().entrySet().stream()
39-
.filter(stringPathItemEntry -> stringPathItemEntry.getKey().startsWith(webEndpointProperties.getBasePath()+DEFAULT_PATH_SEPARATOR))
4042
.forEach(stringPathItemEntry -> {
4143
String path = stringPathItemEntry.getKey();
4244
Matcher matcher = pathPathern.matcher(path);
@@ -53,5 +55,7 @@ public void customise(OpenAPI openApi) {
5355
});
5456
}
5557
});
58+
59+
super.removeBrokenReferenceDefinitions(openApi);
5660
}
5761
}

springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app68/SpringDocApp68Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void testActuator() throws Exception {
8383
public void testActuatorDescription() throws Exception {
8484
mockMvc.perform(get(Constants.DEFAULT_API_DOCS_URL)).andExpect(status().isOk())
8585
.andExpect(jsonPath("$.openapi", is("3.0.1")))
86-
.andExpect(jsonPath("$.tags", hasSize(4)))
86+
.andExpect(jsonPath("$.tags", hasSize(1)))
8787
.andExpect(jsonPath("$.tags[?(@.name == '" + Constants.SPRINGDOC_ACTUATOR_TAG + "')].name", contains(Constants.SPRINGDOC_ACTUATOR_TAG)))
8888
.andExpect(jsonPath("$.tags[?(@.name == '" + Constants.SPRINGDOC_ACTUATOR_TAG + "')].description", contains(Constants.SPRINGDOC_ACTUATOR_DESCRIPTION)))
8989
.andExpect(jsonPath("$.tags[?(@.name == '" + Constants.SPRINGDOC_ACTUATOR_TAG + "')].externalDocs.description", contains(Constants.SPRINGDOC_ACTUATOR_DOC_DESCRIPTION)))

0 commit comments

Comments
 (0)