diff --git a/docs/changelog.rst b/docs/changelog.rst index a5976fa..b7cebad 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -15,6 +15,7 @@ Changelog applied. Uninstalling from the same panel removes the PAS plugin and the per-user JWT signing secrets. +- #105 Assemble worksheets (layout + QC analyses) through the API - #104 Fix Analyses field ignoring a plain list of analysis service UIDs - #103 Allow updating the setup configuration objects - #102 Support DX Duration (Timedelta) fields via a field manager diff --git a/src/senaite/jsonapi/api/mutation.py b/src/senaite/jsonapi/api/mutation.py index 9dc7144..d17f6eb 100644 --- a/src/senaite/jsonapi/api/mutation.py +++ b/src/senaite/jsonapi/api/mutation.py @@ -325,9 +325,15 @@ def update_object_with_data(content, record): continue logger.debug("update_object_with_data::field %r updated", k) - invalid = bika_api.validate(content) - if invalid: - raise BadRequestError(u.to_json(invalid)) + # Validate the whole object only for the field-manager path, where + # the payload maps directly to schema fields. A custom IUpdate + # adapter assembles the object through domain operations (e.g. a + # worksheet's addAnalyses populates system-managed fields such as + # the layout that the generic schema validator cannot check) and + # is responsible for its own validity. + invalid = bika_api.validate(content) + if invalid: + raise BadRequestError(u.to_json(invalid)) if record.get("transition", None): t = record.get("transition") diff --git a/src/senaite/jsonapi/configure.zcml b/src/senaite/jsonapi/configure.zcml index cd6046e..d523003 100644 --- a/src/senaite/jsonapi/configure.zcml +++ b/src/senaite/jsonapi/configure.zcml @@ -141,6 +141,19 @@ factory=".datamanagers.DexterityDataManager" /> + + + + +