Bug 55555 - [UDM REST API]: support application/json-patch+json documents
[UDM REST API]: support application/json-patch+json documents
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - REST API
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-6-errata
Assigned To: Florian Best
Marius Meschter
https://datatracker.ietf.org/doc/html...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-01-10 17:17 CET by Florian Best
Modified: 2024-03-07 13:07 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2023-01-10 17:17:19 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.
Comment 2 Florian Best univentionstaff 2024-03-01 14:09:42 CET
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
Comment 3 Marius Meschter univentionstaff 2024-03-05 12:24:31 CET
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