For some of my REST controllers, I'm using special processing logic for generating OAPI document. Therefore, all such controllers are marked as hidden and are processed with a special repositoryRestResourceProvider. The problem is that if I use Operation annotation for a method within such controller, this method is processed by the standard way as if the controller isn't hidden. This is caused by this condition.
Is it intentional and if yes, why? I would expect that hidden controllers won't expose any method even they are annotated with this swagger annotation.
Example
@RestController
public class AHiddenController {
@Operation(description = "I want here some custom config")
@GetMapping("/{entity}/{id}")
public ResponseEntity getEntity() {
throw new UnsupportedOperationException("the body is not relevant now");
}
}
public class MyRestResourceProvider extends RepositoryRestResourceProvider {
// here is some logic generating special paths (e.g. /entity1/{id}, /entity2/{id})
}
@Configuration
public class MySpringDocConfig {
@Bean
public MyRestResourceProvider myRestResourceProvider() {
return new MyRestResourceProvider();
}
@PostConstruct
public void init() {
SpringDocUtils.getConfig().addHiddenRestControllers(AHiddenController.class);
}
}
- Expected generated OAPI JSON:
{
"openapi": "3.0.1",
"info": { ... },
"paths": {
"/entity1/{id}": { ... },
"/entity2/{id}": { ... }
}
"components": { ... }
}
- Actual generated OAPI JSON:
{
"openapi": "3.0.1",
"info": { ... },
"paths": {
"/entity1/{id}": { ... },
"/entity2/{id}": { ... },
"/{entity}/{id}": { ... }
}
"components": { ... }
}
Library versions
- spring-boot version
2.5.3
- springdoc-openapi version
1.5.10
For some of my REST controllers, I'm using special processing logic for generating OAPI document. Therefore, all such controllers are marked as hidden and are processed with a special
repositoryRestResourceProvider. The problem is that if I useOperationannotation for a method within such controller, this method is processed by the standard way as if the controller isn't hidden. This is caused by this condition.Is it intentional and if yes, why? I would expect that hidden controllers won't expose any method even they are annotated with this swagger annotation.
Example
{ "openapi": "3.0.1", "info": { ... }, "paths": { "/entity1/{id}": { ... }, "/entity2/{id}": { ... } } "components": { ... } }{ "openapi": "3.0.1", "info": { ... }, "paths": { "/entity1/{id}": { ... }, "/entity2/{id}": { ... }, "/{entity}/{id}": { ... } } "components": { ... } }Library versions
2.5.31.5.10