Generating realistic example values
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- clojure, openapi
- 領域
- api, documentation
調査の方向性
まず、Prismatic Schema の定義がどのように Swagger UI のサンプル値になるかを追跡し、次にその経路を test.check を使用して説明されているカスタムジェネレーターと比較します。スキーマが制約を満たす現実的な値を提供でき、それらの値が生成された Swagger UI の例に表示されれば、issue は完了です。
索引モデルが issue の本文から書いたものです。
説明
Library Version(s)
1.1.11
Problem
I'm experimenting with compojure-api for documenting a new set of APIs with Prismatic Schema. It;s working well so far, though I have one issue which is not obvious how to resolve - how to generate realistic example values for an input / output schema.
Currently I get Example Values in the swagger UI like this:
{
"name": "string",
"description": "string",
"type": "assetClass1",
"ownerID": "string"
"dateCreated": "2018-11-19T01:25:04.282Z",
}
In this case, I need ownerID to be a 64 character hex string which satisfies a custom valid-user-id? predicate, which defined in Schema as something like:
(s/defschema UserID
(s/constrained s/Str valid-user-id? "Valid User ID"))
However it's not clear how to get compojure-api to generate valid values which satisfy the constraint (The value "string" doesn't....) and display these to the user in the Swagger UI.
Is there a way to do this? Ideally I would like to be able to specify a custom generator for the schema, which I build easily enough with test.check but how do I get that to be reflected in the Swagger UI?
Any help much appreciated!
- 主要言語
- 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
.Needs Triage .Run Repro Bot .Team/UXWest Priority:P3 Type:Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
metabase/metabase#84325 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NoahTheDuke/splint#56 ·
-
Permissioned transactions fetch each entity once per tx-step, producing huge permission-check queries対応中かも @verveguy が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 84/100
clojure-lsp/clojure-lsp#2502 ·
メンテナーはふだん 1 日以内に返信