Add support for templatedRef in Reference Object
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 功能
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
研究方向
先查看 Reference Object 定義、JSON Reference 資料、RFC 6570,以及連結的 JSON Schema 詞彙討論。只有在 $templatedRef 的語意和範圍達成共識,並且規格清楚到足以支援 collection 和 style 範例時,工作才算完成。
由索引模型根據 Issue 內容生成。
描述
Proposing to add support for "$templatedRef" to Reference Objects supporting templated references, allowing referencing dynamic schemas that could be retrieved by substituting the template variables by the selected value for earlier path parameters
so that later path parameters can be defined differently based on earlier path parameters.
Example:
"parameters" :
{
"collection-styleId" :
{
"name" : "styleId",
"schema" :
{
"$templatedRef" : "./api/collections-styles/{collectionId}"`
}
}
}
As it was initially suggested that this would require to first extend JSON schema, an initial discussion took place in https://github.com/json-schema-org/json-schema-vocabularies/issues/36 . However reading on https://swagger.io/specification/ that the Reference Object is defined by the JSON Reference, rather than by JSON Schema, it seems that this could rather simply be extended with$templatedRef, following https://tools.ietf.org/html/rfc6570 (or a simpler subset of it).
The {collectionId} template would be replaced by a selected value like collection1.
(e.g. in this example, this "$templatedRef" is used to define the valid values for {styleId} in a path /collections/{collectionId}/styles/{styleId}).
The {collectionId} would have previously been validated against another potentially dynamic list like "$ref" : "./api/collections".
./api/collections would return something like:
{
"type" : "string",
"enum" : [
"collection1",
"collection2",
"collection3"
]
}
and ./api/collection-styles/collection1 would return something like
{
"type" : "string",
"enum" : [
"style234",
"style235",
"style236"
]
}
while ./api/collection-styles/collection2 would return something like
{
"type" : "string",
"enum" : [
"style454",
"style455",
"style456"
]
}
The context being that available/compatibles styles depend on the selected collection.
Such a capability would allow to define much more interoperable APIs, where the specifics of a particular instance / deployment would be left to the templated references. In turn this would allow to automatically generate clients from an API definition that will work with multiple instances of the same templatable API, therefore extending the usability of clients automatically generated from OpenAPI definitions beyond on-the-fly client generation, more suitable for compiled programming languages.
- 主要語言
- Markdown
- 星號
- 31.2k
- 分支
- 9.2k
- 平均合併
- 2 天 9 小時
- 30 天內合併 PR
- 17
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
OAI/OpenAPI-Specification 的其他 Issue
-
Housekeeping
難度 1/5 1 小時以內 新手友好度 45/100
OAI/OpenAPI-Specification#5566 · 2 則留言 ·
維護者通常 1 天內回覆
-
Housekeeping
難度 1/5 1 小時以內 新手友好度 35/100
OAI/OpenAPI-Specification#5562 · 4 則留言 ·
維護者通常 1 天內回覆
-
Housekeeping
難度 5/5 一週以上 新手友好度 10/100
OAI/OpenAPI-Specification#5556 · 3 則留言 ·
維護者通常 1 天內回覆
-
v3.2.1 release可能重新可做 @lornajane 於 34 天前認領,目前沒有進行中的 PR。 未關閉
OAI/OpenAPI-Specification#5460 · 11 則留言 · 1 個 reaction · 已指派 1 人 ·
維護者通常 1 天內回覆
-
param serialization
難度 5/5 一週以上 新手友好度 25/100
OAI/OpenAPI-Specification#5366 · 12 則留言 ·
維護者通常 1 天內回覆
查看 OAI/OpenAPI-Specification 的全部 Issue
相似的 Issue
-
afk-ok area:data-quality importer size:S
難度 2/5 1-3 小時 新手友好度 74/100
enorm-labs/event-junkie#3301 ·
維護者通常 1 天內回覆
-
Awaiting Maintainer Approval Bug
難度 2/5 1-3 小時 新手友好度 62/100
processing/p5.js-web-editor#4364 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
one-zero-eight/apply-bot#39 ·
-
UX
難度 1/5 1 小時以內 新手友好度 72/100
mediajunkie/piper-morgan-product#2008 · 2 則留言 ·
-
bug
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆