Skip to content

JSPWIKI-1310 Add the list of pages, the references of a page and its HTML to the REST API - #646

Draft
arturobernalg wants to merge 27 commits into
apache:masterfrom
arturobernalg:feature/JSPWIKI-1310-pages-list
Draft

arturobernalg wants to merge 27 commits into
apache:masterfrom
arturobernalg:feature/JSPWIKI-1310-pages-list

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Part of JSPWIKI-1310. This pull request builds on #589, #590 and #645, so it shows their commits until they are merged; the new commit is the last one.

Adds three more read-only endpoints to the REST API version 1, all described in openapi.yaml:

  • GET /api/v1/pages: the names of the pages the caller may view, sorted by name. The parameters max (default 20) and offset read a long list in chunks.
  • GET /api/v1/pages/{name}/references: the pages that link to the page (referredBy) and the pages it links to (refersTo). Pages the caller may not view are left out; a link to a page that is not written yet is kept.
  • GET /api/v1/pages/{name}/html: the page rendered to HTML as the wiki shows it to the caller, without the template. The optional parameter version works as in the endpoint that reads the markup.

The same rules as in the other endpoints apply: view permission is needed (401 for anonymous, 403 for a logged in caller), a page that does not exist is 404, and an offset that is not an integer of zero or more is 400.

Tested with ApiV1ServletTest, 40 tests, each answer compared with openapi.yaml, including that a page with an ACL is neither listed nor linked nor rendered for a caller who may not view it. Also run on a war in Tomcat 10.1: list, chunks, bad offset, references in both directions, HTML, a page with an ACL (401) and an unknown page (404). Not tried: a logged in caller on the running wiki (covered only by the test).

…n OpenAPI file that a test compares with the answers
…o feature/JSPWIKI-1310-plugins-suggestions

# Conflicts:
#	ChangeLog.md
…310-plugins-suggestions

# Conflicts:
#	ChangeLog.md
…o feature/JSPWIKI-1310-plugins-suggestions

# Conflicts:
#	ChangeLog.md
#	jspwiki-main/src/main/java/org/apache/wiki/search/DefaultSearchManager.java
…gestions' into feature/JSPWIKI-1310-pages-read
… into feature/JSPWIKI-1310-pages-list

# Conflicts:
#	jspwiki-main/src/test/java/org/apache/wiki/rest/ApiV1ServletTest.java
…gestions' into feature/JSPWIKI-1310-pages-read
…gestions' into feature/JSPWIKI-1310-pages-read

# Conflicts:
#	ChangeLog.md
… into feature/JSPWIKI-1310-pages-list

# Conflicts:
#	ChangeLog.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant