Univention Bugzilla – Bug 55555
[UDM REST API]: support application/json-patch+json documents
Last modified: 2024-03-07 13:07:25 CET
The UDM REST API should support application/json-patch+json documents. This is especially useful for the current prototype CLI client which supports operations like `--append property=value` or `--remove property`. This would allow to not have logic in the client which knows about the specific properties and what to do with such operations (e.g. `--append groups="CN = Foo"` has to work if obj['groups'] is ['cn=foo']. And it is the only leftover thing needed to run all current UDM integration tests against the UDM REST API as it currently needs the above features.
MR: https://git.knut.univention.de/univention/ucs/-/merge_requests/611
The unsupported CLI demo client ("__udm") has been adjusted to send data in application/json-patch+json format, which the server now is capable of. This enables us to run all UDM tests against UDM REST API instead of local UDM CLI¹. We did that in a branch test, which revealed some errors which we fixed along with this. Any test which creates a extended attribute currently fails because UDM REST API doesn't reload extended attributes (See Bug #50253). Some other tests e.g. regarding printer URI fails because they are checking against the CLI output, which is different for some properties (e.g. those who are represented as dictionary in the UDM REST API). These tests could be adjusted to use the new univention.testing.udm.UDM.list_objects_json(). 1) patch needed to run udm-tests against UDM-REST-API: diff --git test/ucs-test/tests/conftest.py test/ucs-test/tests/conftest.py index c889d24c47b..5a32e14ebc1 100644 --- test/ucs-test/tests/conftest.py +++ test/ucs-test/tests/conftest.py @@ -73,7 +73,7 @@ def ldap_master(ucr_session) -> str: @pytest.fixture() def udm() -> Iterator[_udm.UCSTestUDM]: """Auto-reverting UDM wrapper.""" - with _udm.UCSTestUDM() as udm: + with _udm.UDM() as udm: yield udm univention-management-console-module-udm.yaml de6f5bceb298 | fix(udm-umc): fix error handling when superordinate object doesn't exists univention-management-console-module-udm (10.0.9-5) de6f5bceb298 | fix(udm-umc): fix error handling when superordinate object doesn't exists univention-directory-manager-rest.yaml 1c26ef9a9aae | feat(udm-rest): support application/json-patch+json documents univention-directory-manager-rest (10.0.7-11) f7f3a1de825f | refactor(udm-rest-client): move redirect handling into Session class 6c00cebbd43a | fix(udm-rest-cli): fix error handling in CLI client 1c26ef9a9aae | feat(udm-rest): support application/json-patch+json documents univention-directory-manager-modules.yaml e648ed7cd817 | fix(udm dns): fix object description when object doesn't exists univention-directory-manager-modules (15.0.25-13) e648ed7cd817 | fix(udm dns): fix object description when object doesn't exists ucs-test (10.0.20-45) e648ed7cd817 | fix(udm dns): fix object description when object doesn't exists 1c26ef9a9aae | feat(udm-rest): support application/json-patch+json documents
OK: changelog and YAML OK: code review OK: udm-rest jenkins tests passing OK: updating an object with the __udm cli client uses the json+patch content type and body OK: appending, removing and setting properties uses the json+patch format OK: small deviation from rfc6902 in the 'remove' operation
<https://errata.software-univention.de/#/?erratum=5.0x987> <https://errata.software-univention.de/#/?erratum=5.0x991> <https://errata.software-univention.de/#/?erratum=5.0x993>