30
30
import java .util .stream .Stream ;
31
31
32
32
import io .swagger .v3 .oas .models .OpenAPI ;
33
+ import org .springdoc .api .AbstractOpenApiResource ;
33
34
import org .springdoc .core .RepositoryRestResourceProvider ;
34
35
import org .springdoc .core .fn .RouterOperation ;
35
36
import org .springdoc .data .rest .core .DataRestRouterOperationBuilder ;
51
52
52
53
public class SpringRepositoryRestResourceProvider implements RepositoryRestResourceProvider {
53
54
54
- private static final String REPOSITORY_ENTITY_CONTROLLER = "org.springframework.data.rest.webmvc.RepositoryEntityController" ;
55
+ public static final String REPOSITORY_ENTITY_CONTROLLER = "org.springframework.data.rest.webmvc.RepositoryEntityController" ;
55
56
56
- private static final String REPOSITORY_SERACH_CONTROLLER = "org.springframework.data.rest.webmvc.RepositorySearchController" ;
57
+ public static final String REPOSITORY_SERACH_CONTROLLER = "org.springframework.data.rest.webmvc.RepositorySearchController" ;
57
58
58
- private static final String REPOSITORY_SCHEMA_CONTROLLER = "org.springframework.data.rest.webmvc.RepositorySchemaController" ;
59
+ public static final String REPOSITORY_SCHEMA_CONTROLLER = "org.springframework.data.rest.webmvc.RepositorySchemaController" ;
59
60
60
- private static final String REPOSITORY_PROPERTY_CONTROLLER = "org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController" ;
61
+ public static final String REPOSITORY_PROPERTY_CONTROLLER = "org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController" ;
61
62
62
63
private ResourceMappings mappings ;
63
64
@@ -93,6 +94,7 @@ public List<RouterOperation> getRouterOperations(OpenAPI openAPI) {
93
94
.filter (requestMappingInfoHandlerMethodEntry -> REPOSITORY_ENTITY_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
94
95
.getValue ().getBeanType ().getName ()) || REPOSITORY_PROPERTY_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
95
96
.getValue ().getBeanType ().getName ()))
97
+ .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getBeanType ()))
96
98
.collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
97
99
findControllers (routerOperationList , handlerMethodMapFiltered , resourceMetadata , domainType , openAPI );
98
100
}
@@ -102,6 +104,7 @@ else if (handlerMapping instanceof BasePathAwareHandlerMapping) {
102
104
Map <RequestMappingInfo , HandlerMethod > handlerMethodMapFiltered = handlerMethodMap .entrySet ().stream ()
103
105
.filter (requestMappingInfoHandlerMethodEntry -> REPOSITORY_SCHEMA_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
104
106
.getValue ().getBeanType ().getName ()))
107
+ .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getBeanType ()))
105
108
.collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
106
109
107
110
findControllers (routerOperationList , handlerMethodMapFiltered , resourceMetadata , domainType , openAPI );
@@ -124,6 +127,7 @@ else if (handlerMapping instanceof BasePathAwareHandlerMapping) {
124
127
Map <RequestMappingInfo , HandlerMethod > handlerMethodMapFiltered = handlerMethodMap .entrySet ().stream ()
125
128
.filter (requestMappingInfoHandlerMethodEntry -> REPOSITORY_SERACH_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
126
129
.getValue ().getBeanType ().getName ()))
130
+ .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getBeanType ()))
127
131
.collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
128
132
ResourceMetadata metadata = associations .getMetadataFor (domainType );
129
133
SearchResourceMappings searchResourceMappings = metadata .getSearchResourceMappings ();
0 commit comments