The `submit_permission` dependency causes duplicate validation errors

Đang mở
#1,812 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
fastapi, python
Lĩnh vực
backend

Hướng nghiên cứu

The duplicate errors come from the submit_permission dependency deserialising the request body separately from the main /api/v1/tasks endpoint. Start by finding that dependency and where it reads TaskRequest, then compare it with a test endpoint that has no dependency, which returns one error. Done means one validation error for an invalid TaskRequest on the tasks endpoint, with the existing tests still passing.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Found while looking into #1802, if an invalid TaskRequest is passed to the /api/v1/tasks endpoint, two validation errors are returned instead of the expected one.

$ curl -H "Authorization: Bearer ${TOKEN}" http://localhost:8000/api/v1/demo --json '{"name": "count", "params": [], "instrument_session": "cm12345-1"}' | jq
{
  "detail": [
    {
      "type": "dict_type",
      "loc": [
        "body",
        "params"
      ],
      "msg": "Input should be a valid dictionary",
      "input": []
    },
    {
      "type": "dict_type",
      "loc": [
        "body",
        "params"
      ],
      "msg": "Input should be a valid dictionary",
      "input": []
    }
  ]
}

This seems to be from deserialising the task for the main endpoint, as well as for the submit_permission. Passing the same JSON to a test endpoint without the dependency returns a single error.

Ngôn ngữ chính
Python
Star
14
Fork
15
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
35

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DiamondLightSource/blueapi

Tất cả issue của DiamondLightSource/blueapi

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.