Univention Bugzilla – Bug 52725
Wrong status code sent for "move object" by UDM REST API
Last modified: 2021-02-11 12:08:26 CET
The UDM REST API replies with HTTP 201 to a PUT request with a previously retrieved object where only the position was changed: a move operation. 200 GET /udm/users/user/uid=paul.pineda,cn=users,dc=uni,dc=dtr (0.0.0.0) 14.87ms 201 PUT /udm/users/user/uid=paul.pineda,cn=users,dc=uni,dc=dtr (0.0.0.0) 7.12ms This breaks the autogenerated REST client for the UDM REST API client, as the OpenAPI schema says it would reply with HTTP 200.
My guess is line 2567: ObjectsMove.post(): .. self.set_status(201)
Ah no. It is line 2945 in Object.move(). 3700 lines of undocumented code is really hard to maintain.
201 is correct here. We need to make the schema conditionally then.
Patch: diff --git management/univention-directory-manager-rest/src/univention/admin/rest/module.py management/univention-directory-manager-rest/src/univention/admin/rest/module.py index 1820787793..0a04d1fefa 100755 --- management/univention-directory-manager-rest/src/univention/admin/rest/module.py +++ management/univention-directory-manager-rest/src/univention/admin/rest/module.py @@ -1389,6 +1389,11 @@ class OpenAPI(Resource): "content": content_schema(), "headers": global_response_headers(), }, + "201": { + "description": "Success (on move and rename)", + "content": content_schema(), + "headers": global_response_headers(), + }, "404": { "description": "Object not found", "headers": global_response_headers(),
(In reply to Florian Best from comment #4) > Patch: Works for me. The OpenAPI client is now generated expecting for PUT for example: response_types_map = { 201: "UsersUser", # <-- was missing before 200: "UsersUser", 404: None, }
the patch was applied and the package build: [4.4-7 1153b61d9f] Bug #52725: add HTTP 201 as possible response code for modify operation to OpenAPI schema (when moving) [4.4-7 004abb2adf] Bug #52725: advisory univention-directory-manager-rest (9.0.16-11)
Merge request to 5.0-0: https://git.knut.univention.de/univention/ucs/-/merge_requests/65
OK: merge to UCS 5.0 OK: status code is correctly set in schema
<https://errata.software-univention.de/#/?erratum=4.4x892>