Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ protected void calculatePath(HandlerMethod handlerMethod, RouterOperation router
buildCallbacks(openAPI, methodAttributes, operation, apiCallbacks);

// allow for customisation
customiseOperation(operation, handlerMethod);
operation = customiseOperation(operation, handlerMethod);
if (operation == null)
continue;

PathItem pathItemObject = buildPathItem(requestMethod, operation, operationPath, paths);
paths.addPathItem(operationPath, pathItemObject);
Expand Down Expand Up @@ -703,8 +705,15 @@ protected Set<RequestMethod> getDefaultAllowedHttpMethods() {
* @return the operation
*/
protected Operation customiseOperation(Operation operation, HandlerMethod handlerMethod) {
operationCustomizers.ifPresent(customizers -> customizers.forEach(customizer -> customizer.customize(operation, handlerMethod)));
return operation;
if (!operationCustomizers.isPresent())
return operation;
Operation customizedOperation = operation;
for (OperationCustomizer customizer : operationCustomizers.get()) {
customizedOperation = customizer.customize(customizedOperation, handlerMethod);
if (customizedOperation == null)
return null;
}
return customizedOperation;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public interface OperationCustomizer {
*
* @param operation input operation
* @param handlerMethod original handler method
* @return customized operation
* @return customized operation or null to hide operation
*/
Operation customize(Operation operation, HandlerMethod handlerMethod);
}