Skip to content

JSPWIKI-1310 Add the difference between two versions of a page to the REST API - #654

Draft
arturobernalg wants to merge 31 commits into
apache:masterfrom
arturobernalg:feature/JSPWIKI-1310-page-diff
Draft

arturobernalg wants to merge 31 commits into
apache:masterfrom
arturobernalg:feature/JSPWIKI-1310-page-diff

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

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

It adds GET /api/v1/pages/{name}/diff, to read the difference between two versions of a page, as the wiki shows it. The parameter from is required, and to is the latest version when it is absent. The answer is JSON with the name, the two versions and the html of the difference, written by the difference provider of the wiki.

  • The permission to view is checked on the page before anything is read; a page that does not exist, or a version that does not exist, is 404; a missing or invalid version is 400; the errors are JSON like in the rest of the API.
  • A provider that keeps no old versions answers with the current page whatever version is asked for, so the servlet checks that the version it got is the one that was asked for. Without it, from=9 would have compared the page with itself and answered 200.
  • openapi.yaml describes it, and ApiV1ServletTest has nine new tests, among them the contract, the latest version by default, the two equal versions, 404 and 400, 401 without any text of the page, and a provider without versions.

I also ran it on a Tomcat 10.1 with the war of this branch, with the versioning provider and a page with two versions: from 1 to 2 marks the added line as the wiki does, to defaults to the latest version, the reverse difference works, and version 9 is 404.

ChangeLog.md is updated.

…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
…d a description that broke the JAX-RS generator
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