Repository navigation
JSPWIKI-1310 Add the page name suggestions and the list of plugins to the REST API version 1 - #590
Open
arturobernalg wants to merge 18 commits into
Open
arturobernalg wants to merge 18 commits into
arturobernalg wants to merge 18 commits into
Conversation
…n OpenAPI file that a test compares with the answers
… the REST API version 1
# Conflicts: # ChangeLog.md
…o feature/JSPWIKI-1310-plugins-suggestions # Conflicts: # ChangeLog.md
…310-plugins-suggestions
…310-search # Conflicts: # ChangeLog.md
…310-plugins-suggestions # Conflicts: # ChangeLog.md
…310-search # Conflicts: # ChangeLog.md
…o feature/JSPWIKI-1310-plugins-suggestions # Conflicts: # ChangeLog.md # jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java
…t do not wait for it
…o feature/JSPWIKI-1310-plugins-suggestions
…o feature/JSPWIKI-1310-plugins-suggestions
This was referenced Nov 20, 2026
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #589: until that one is merged, the first two commits are the ones of that pull request, and the one of this pull request is the last one.
Second step of https://issues.apache.org/jira/browse/JSPWIKI-1310. It adds GET /api/v1/search/suggestions, with the query parameters query and max, and GET /api/v1/plugins, to the contract openapi.yaml and to ApiV1Servlet. Both answer as the search does: 401 to an anonymous caller without permission, 403 to a logged in one, and 400 with a JSON body when query is missing or max is not a positive integer.
The suggestions leave out the pages the caller may not view. The suggestions of /ajax/search/suggestions do not do that, and the question was open on dev@, so I took the safe side for the new endpoint. For that, SearchManager has a new method, suggestPages(text, max, session). The algorithm moved from the Ajax service to a private method that both use, and the Ajax service calls it without a filter, so its behaviour does not change.
The plugins are sorted by display name for the locale of the request, as in /ajax/plugins/plugins, but on a copy of the list of the plugin manager, because the Ajax service sorts the list of the manager itself.
The test compares each answer with openapi.yaml, as for the search. Checked locally: jspwiki-main 1055 tests pass, 7 of them new; making the suggestions ignore the permission makes the test fail; and on a running war (Tomcat 10.1) with three pages, one of them with [{ALLOW view Admin}], the anonymous caller does not get that one, max works, and the plugins come sorted. Not tested: login, logout and /pages/{page}, which are not implemented yet, and the integration tests. The ChangeLog entry comes in a separate commit with the number of this pull request.