3030import java .util .stream .Stream ;
3131
3232import io .swagger .v3 .oas .models .OpenAPI ;
33+ import org .springdoc .api .AbstractOpenApiResource ;
3334import org .springdoc .core .RepositoryRestResourceProvider ;
3435import org .springdoc .core .fn .RouterOperation ;
3536import org .springdoc .data .rest .core .DataRestRouterOperationBuilder ;
5152
5253public class SpringRepositoryRestResourceProvider implements RepositoryRestResourceProvider {
5354
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" ;
5556
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" ;
5758
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" ;
5960
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" ;
6162
6263 private ResourceMappings mappings ;
6364
@@ -93,6 +94,7 @@ public List<RouterOperation> getRouterOperations(OpenAPI openAPI) {
9394 .filter (requestMappingInfoHandlerMethodEntry -> REPOSITORY_ENTITY_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
9495 .getValue ().getBeanType ().getName ()) || REPOSITORY_PROPERTY_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
9596 .getValue ().getBeanType ().getName ()))
97+ .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getBeanType ()))
9698 .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
9799 findControllers (routerOperationList , handlerMethodMapFiltered , resourceMetadata , domainType , openAPI );
98100 }
@@ -102,6 +104,7 @@ else if (handlerMapping instanceof BasePathAwareHandlerMapping) {
102104 Map <RequestMappingInfo , HandlerMethod > handlerMethodMapFiltered = handlerMethodMap .entrySet ().stream ()
103105 .filter (requestMappingInfoHandlerMethodEntry -> REPOSITORY_SCHEMA_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
104106 .getValue ().getBeanType ().getName ()))
107+ .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getBeanType ()))
105108 .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
106109
107110 findControllers (routerOperationList , handlerMethodMapFiltered , resourceMetadata , domainType , openAPI );
@@ -124,6 +127,7 @@ else if (handlerMapping instanceof BasePathAwareHandlerMapping) {
124127 Map <RequestMappingInfo , HandlerMethod > handlerMethodMapFiltered = handlerMethodMap .entrySet ().stream ()
125128 .filter (requestMappingInfoHandlerMethodEntry -> REPOSITORY_SERACH_CONTROLLER .equals (requestMappingInfoHandlerMethodEntry
126129 .getValue ().getBeanType ().getName ()))
130+ .filter (controller -> !AbstractOpenApiResource .isHiddenRestControllers (controller .getValue ().getBeanType ()))
127131 .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue , (a1 , a2 ) -> a1 ));
128132 ResourceMetadata metadata = associations .getMetadataFor (domainType );
129133 SearchResourceMappings searchResourceMappings = metadata .getSearchResourceMappings ();
0 commit comments