Require explicit approver_ids when publishing a document major version
The publish flow ignored a document's stored default approvers and only requested approval when approver_ids were passed in the call, so a major publish with no approver_ids silently published directly without routing through the approval flow — there was no way to tell "caller forgot approvers" (null) from "caller wants no approval" (empty). Make approver_ids an explicit choice, enforced once in the service so it covers every caller (console, MCP, n8n): - major publish: approver_ids must be set; an empty list publishes directly, a non-empty list requests approval. - minor publish: approver_ids must be omitted (approvers are ignored). Validate this in PublishDocumentRequest.Validate(), update the console publish dialog and the n8n publish node to honour the contract, document it in the MCP tool spec, and cover it with e2e tests. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -6305,12 +6305,12 @@ components:
|
||||
description: Document ID
|
||||
minor:
|
||||
type: boolean
|
||||
description: When true, publish the draft as a minor version and ignore approver_ids. When false, publish as a new major version; if approver_ids are provided, an approval is requested instead.
|
||||
description: When true, publish the draft as a minor version; approver_ids must be omitted. When false, publish as a new major version; approver_ids is required (a non-empty list requests approval, an empty list publishes directly without approval).
|
||||
approver_ids:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: Approver profile IDs (ignored when minor is true)
|
||||
description: "Approver profile IDs. Required when minor is false: pass a non-empty list to request approval (approvers receive an email notification), or an empty list to publish directly without approval. Must be omitted when minor is true."
|
||||
changelog:
|
||||
type: string
|
||||
description: Changelog for this version
|
||||
|
||||
Reference in New Issue
Block a user