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

Issue with enum query parameter with a default value

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

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 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
Đình trệ
Công nghệ
clojure
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu bằng cách truy vết quá trình tạo tham số Swagger cho tham số truy vấn enum được hiển thị trong issue. Kiểm tra cách giá trị mặc định và cờ required được suy ra, sau đó xác minh rằng JSON được tạo có giá trị mặc định "published_at" và required true, không có tùy chọn nil nào trong UI.

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

Mô tả

bug upstream-problem

If a query parameter is of type enum and has a default value, the swagger parameter for default should be appropriately set and required should be set to true.

Here is an example below.

what's happening
(GET "/all/" request
     :description "Return a list of articles."
     :return [(dissoc t/Article :is_html :text)]
     :responses default-responses
     :query-params [{sort :- (describe (s/enum :published_at :last_processed_at) "The sort type. Defaults to published_at.") "published_at"}]
     (return (domain/get-all-articles db (org request) :days 1)))

The sort parameter above can be either published_at or last_processed_at where it defaults to the former.

The JSON output for the route above is:

"parameters": [
  {
    "in": "query",
    "name": "sort",
    "description": "The sort type. Defaults to published_at.",
    "required": false,
    "type": "string",
    "enum": [
      "last_processed_at",
      "published_at"
    ]
  }
]

And the UI renders like this:

screen shot 2017-03-18 at 9 59 34 pm

expectation

I would expect the select box in the UI to start off with the published_at pre-selected and not allow a nil option.
I would expect the json output to have required set to true and a default value set to published_at.

Thanks for your time!

Ngôn ngữ chính
Clojure
Star
1.1k
Fork
145
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 metosin/compojure-api

Tất cả issue của metosin/compojure-api

Issue tương tự

Thêm issue về Clojure

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.