Skip to content

UserController incorrectly implements specification #36404

@jwulf

Description

@jwulf

Description

The UserController implements PUT, but the spec specifies PATCH:

Implementation:

  @CamundaPutMapping(path = "/{username}")
  public CompletableFuture<ResponseEntity<Object>> updateUser(
      @PathVariable final String username, @RequestBody final UserUpdateRequest userUpdateRequest) {
    return RequestMapper.toUserUpdateRequest(userUpdateRequest, username)
        .fold(RestErrorMapper::mapProblemToCompletedResponse, this::updateUser);
  }

Specification:

/users/{username}:
  ...
  patch:
      tags:
        - User
      operationId: updateUser
      summary: Update user
      description: |
        Updates a user.

Steps to reproduce

  1. Examine the specification
  2. Examine the implementation

Current behavior

The controller implementation does not match the specification.

Expected behavior

The controller implementation matches the specification.

Environment

SM

Version

This is on main.

Rootcause

No response

Solution ideas

Change the controller, or change the spec. Since the method name is updateUser, probably the controller should implement PATCH.

However, the current implementation seems to be a complete replacement, which is a PUT. The Java client and test also implement PUT.

If we allow users to update just an email address for a user (that sounds like a valid scenario), then we should change this to PATCH and allow partial Request Dtos.

Dev -> QA handover

  • Resources:
  • Versions to validate:
  • Release version (in which version this feature will be released):

Links

Metadata

Metadata

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions