Skip to content

PATCH /api/auth/users/{user_id} 422 error payload changed after version 2.20.0 #3424

Description

@zonia3000

The 422 error response body of PATCH /api/auth/users/{user_id} changed in version 2.20.0:

In version 2.19.4:

{
  "detail": [
    {
      "type": "string_too_short",
      "loc": [
        "body",
        "project_dirs",
        1
      ],
      "msg": "String should have at least 1 character",
      "input": "",
      "ctx": {
        "min_length": 1
      }
    }
  ]
}

In version 2.20.0:

{
  "detail": [
    {
      "type": "string_too_short",
      "loc": [
        "body",
        "project_dirs",
        1,
        "function-after[val_os_path_normpath(), function-after[val_no_dotdot_in_path(), function-after[val_absolute_path(), constrained-str]]]"
      ],
      "msg": "String should have at least 1 character",
      "input": "",
      "ctx": {
        "min_length": 1
      }
    },
    {
      "type": "string_too_short",
      "loc": [
        "body",
        "project_dirs",
        1,
        "function-after[val_s3_url(), constrained-str]"
      ],
      "msg": "String should have at least 1 character",
      "input": "",
      "ctx": {
        "min_length": 1
      }
    }
  ]
}

Is this expected? I noticed this because it breaks the handling of the error message in fractal-web.

In the past the error was nicely displayed near the field:

Image

Now it fallbacks to:

Image

Questions:

  1. Should fractal-web adapt to this change?
  2. Is it possible to add some tests in fractal-server to detect this kind of changes in error response payloads?
  3. Could this affect also other endpoints?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions