Can't get Swagger UI to provide interface for arbitrary query params
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- clojure, openapi
- 領域
- api, documentation
調査の方向性
GET "/find" ルートとその :query 宣言から始め、次に compojure-api が任意のクエリマップを OpenAPI/Swagger の説明に変換する仕組みを調べます。Swagger UI が requester の選択したキーに対して ?a=1\u0026b=2 を出力でき、既存の handler がマップを受け取ることを確認できれば完了です。curl の例で検証してください。
索引モデルが issue の本文から書いたものです。
説明
Library Version(s)
2.0.0-alpha31
Problem
Swagger can display a UI for setting dynamic query parameters, but I can't figure out how to do it with compojure-api.
I have a /find endpoint which needs to receive arbitrary query parameters.
E.g., Given /api/find?x=1&y=2&z=3 I want to receive a map {:x 1, :y 2, :3} somewhere in my handler. The keys are chosen by the requester.
(ns myns (:require [schema.core :as scm]))
(def myapp
(api ...
(GET "/find" [& fields]
:return scm/Any
(ok fields))
This works:
curl 'localhost:8080/api/runs/find?a=1&b=2'
{"a":"1","b":"2"}%
But the Swagger UI does not provide a way to set the query parameters:

I've tried variants of the route, providing
:query [fields scm/Any]
And many other things. I can't seem to find documentation for the arguments to :query. (Also, does anyone understand what :- is for?)
If I use a schema that starts with schema.core/maybe...
(scm/defschema QueryArgs (scm/maybe (scm/cond-pre scm/Num scm/Str scm/Bool scm/Keyword scm/Uuid)))
and provide this to :query...
(GET "/find" [& fields]
:return scm/Any
:query [fields QueryArgs]
(ok))
Swagger at least shows a box that allows me to assign several values inside another parameter, but it's not the one I want:

It produces a URL like this:
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/api/runs/find?schemas=a%3D1&schemas=b%3D2'
But I want
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/api/runs/find?a=1&b=2'
- 主要言語
- Clojure
- スター
- 1.1k
- フォーク
- 145
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
metosin/compojure-api のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
metosin/compojure-api#489 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
metosin/compojure-api#468 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
metosin/compojure-api#467 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
metosin/compojure-api#464 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
metosin/compojure-api#463 · コメント 3 件 ·
metosin/compojure-api の issue をすべて見る
似ている issue
-
Permissioned transactions fetch each entity once per tx-step, producing huge permission-check queries対応中かも @verveguy が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 84/100
clojure-lsp/clojure-lsp#2502 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信