From dbae20fb5e29d67aeecce972531889872d01fcdd Mon Sep 17 00:00:00 2001 From: Pichinov-Jose Date: Mon, 18 May 2026 01:14:03 +0200 Subject: [PATCH] Fix: ToolCrudObjects header inputSchema JSON Schema compliance (#38299) create_customer_invoice and create_other_document declare a 'header' object whose schema has 'required: [socid]' but no 'properties' entry. This is technically allowed by JSON Schema but stricter validators flag it as suspicious: the 'required' array references a property that is not declared in 'properties'. Beyond compliance, the omission means LLMs (and human reviewers) have no machine-readable description of which fields are actually accepted in the 'header' object. The Dolibarr backend already accepts socid, date, duree_validite, note_public, note_private and others -- this patch documents the most useful ones explicitly so consumer tools can produce richer payloads. Tested with: create_other_document object_type=proposal accepting a 'header' that contains all of socid + date + duree_validite + note_public -> all four fields are correctly mapped to the Propal object (Dolibarr already accepts unknown properties via dynamic property assignment, so this is purely a schema-documentation change). --- htdocs/ai/tools/crud_objects.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/ai/tools/crud_objects.class.php b/htdocs/ai/tools/crud_objects.class.php index 7c57d92a11f..c8634bd3735 100644 --- a/htdocs/ai/tools/crud_objects.class.php +++ b/htdocs/ai/tools/crud_objects.class.php @@ -196,6 +196,12 @@ If user says 'order' without any qualifier, they mean a SALES ORDER - use this t "header" => [ "type" => "object", "description" => "Invoice header data. Must include 'socid' (Customer ID).", + "properties" => [ + "socid" => ["type" => "integer", "description" => "Customer ID (Thirdparty ID)"], + "date" => ["type" => "string", "description" => "Invoice date (YYYY-MM-DD)"], + "note_public" => ["type" => "string", "description" => "Public note"], + "note_private" => ["type" => "string", "description" => "Private note"] + ], "required" => ["socid"] ], "lines" => [ @@ -233,6 +239,13 @@ If user says 'order' without any qualifier, they mean a SALES ORDER - use this t "header" => [ "type" => "object", "description" => "Header data. Must include 'socid'.", + "properties" => [ + "socid" => ["type" => "integer", "description" => "Thirdparty ID (Customer for proposal, Supplier for supplier_*)"], + "date" => ["type" => "string", "description" => "Document date (YYYY-MM-DD)"], + "duree_validite" => ["type" => "integer", "description" => "Validity in days (proposal only)"], + "note_public" => ["type" => "string", "description" => "Public note"], + "note_private" => ["type" => "string", "description" => "Private note"] + ], "required" => ["socid"] ], "lines" => [