Issue with enum query parameter with a default value
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
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ả
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:

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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của metosin/compojure-api
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
metosin/compojure-api#489 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
metosin/compojure-api#468 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
metosin/compojure-api#467 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
metosin/compojure-api#464 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
metosin/compojure-api#463 · 3 bình luận ·
Tất cả issue của metosin/compojure-api
Issue tương tự
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 84/100
clojure-lsp/clojure-lsp#2502 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Sessions are never closedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
category:tooling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày