Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Reject `limit=0` in paginated requests

Đang mở Phù hợp với người mới
#655 0 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 4 ngày

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với BaseWSGIApp._get_slice() trong server/app/interfaces/base.py và phần xử lý giới hạn âm hiện có. Thêm trường hợp limit=0 vào TestPagination trong server/test/interfaces/test_base.py, sau đó chạy bài kiểm thử đó. Hoàn thành khi giá trị 0 bị từ chối bằng 400 Bad Request và các bài kiểm thử phân trang đều đạt.

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

Mô tả

bug server Specification

Currently, BaseWSGIApp._get_slice() accepts limit=0, because it parses limit as a NonNegativeInteger. With limit=0, the server returns an empty page together with a cursor pointing to the same position as the request. For example, GET /shells?limit=0 on a non-empty repository returns:

{"paging_metadata":{"cursor":"1"},"result":[]}

A client that follows the cursor until it becomes None therefore loops forever.

The specification (IDTA-01002-3-1, v3.1.2) contradicts itself on whether limit=0 is valid:

To me, a page size of 0 is no meaningful behavior as it cannot make progress through a result set.
Rejecting it is the only sensible option, and it matches the OpenAPI definition.

_get_slice() should reject limit=0 with 400 Bad Request, the same way it already rejects negative values. A test for this case should be added to TestPagination in server/test/interfaces/test_base.py.

Ngôn ngữ chính
Python
Star
106
Fork
59
Merge trung bình
4 ngày 1 giờ
Pull request đã merge (30 ngày)
3

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

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 eclipse-basyx/basyx-python-sdk

Tất cả issue của eclipse-basyx/basyx-python-sdk

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.