Return latest form document version from the API - #3020
Draft
stephencdaly wants to merge 4 commits into
Draft
Conversation
Allow: - One form_document with the same language and version per form - One form_document with the same language and a null version per form to account for draft forms
Returns the live or archived form document for the given form ID and language with the highest version number.
We've made it possible for multiple form documents with the same language and tag to exist with different version numbers. Update the forms API to return the latest version of the form document with the given language, if the tag matches the requested tag. If the draft tag is requested, the only draft form document for the language will be returned. This means that the behaviour of the API remains unchanged externally once we are retaining form documents for previous versions.
stephencdaly
force-pushed
the
handle-form-versions-in-api
branch
from
August 13, 2026 11:25
e64afaa to
db12671
Compare
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-3020.admin.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
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.
What problem does this pull request solve?
Trello card: https://trello.com/c/dGv0TrD1
Change the indexes on the form_documents table to allow for multiple versions of a form to exist.
Make the forms API consumed by forms-runner handle a form having multiple form document versions. It works as follows:
It will return the latest form document for the requested language - even if there is a higher version number for another language. This should handle the situation where a Welsh form document has been archived and a new version of the English form has been created. Forms runner handles this by rendering a page saying the form was archived with a link to the English form.
Things to consider when reviewing