unsupported use case for dynamic node creation
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 28/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- javascript
- 領域
- api
調査の方向性
要件、YAML の例、およびこの issue でリンクされている Overlay Specification の議論から始めてください。ソースファイル、テスト、エントリポイントは指定されていません。動的なターゲットノード、nodelist の位置、選択的なコピー、文字列補間がどのように機能すべきかを定義し、期待される出力と元のユースケースに照らして動作を検証してください。
索引モデルが issue の本文から書いたものです。
説明
re: #150
It seems the copy action only allows copying from known target locations. If more than one nodes exist, there is no way to discriminate which node shall be updated. They are all modified. I believe that's expected behavior.
The copy function fails to support one of the original use cases of copying existing content to a new, dynamic target node.
This can be seen here https://github.com/OAI/Overlay-Specification/issues/121#issuecomment-2887330220
Outlining another use case:
The requirements:
- find all GET operations
- create a duplicate of each node with a new suffix '/meta'
- copy the entire contents of the original node
- modify the schema node value to point to a new schema for '/meta' responses
- add new parameters to '/meta' endpoints
Input
openapi: 3.2.0
info:
title: no meta apis defined
version: v1
paths:
/things:
get:
responses:
'200':
$ref: '#/components/responses/things_response'
components:
responses:
things_response:
description: OK
content:
'application/json':
schema:
$ref: '#/components/schemas/things'
schemas:
things: {}
Couple things to consider for this copy functionality:
- the
targetreturns results of the node values but, the spec recommends implementations return the nodelist of result paths(normalized paths) along with the node values. This is implementation defined behavior. - there's no way to copy a node value to a new, dynamic node
- there is also no way to reuse the existing
targetresults to extract the location(s) from the nodelist to create new nodes. The ability to extract the location would be a really nice upgrade - there's no way to define which of the nodes from a nodelist are to be copied
- string interpolation is a touchy subject but, no mechanism exists to modify a string of an existing node value
overlay: 1.1.0
info:
title: add meta apis
version: v1
actions:
- target: $.paths[[email protected]]
description: find any api with a get operation and create new endpoint(s) with a /meta suffix
update:
${target}.location + '/meta'
- target: $.paths[?match(@, '/meta')]
description: copy the contents of the original get operation to the new meta api.
copy : $.paths[[email protected]]
- target: $.paths[?match(@, 'meta')].get.responses['200']
description: fix up the schema reference for meta endpoints
update:
$ref: '#/components/responses/${target}_meta'
- target: $.components.parameters
description: add $filter to components
update:
query_filter:
name: $filter
description: OData v4 $filter query parameter
in: query
required: false
schema:
type: string
- target: $.paths[?match(@, 'meta')].get.parameters
description: add Odata $filter to all /meta endpoints
update:
- $ref: '#/components/parameters/query_filter'
Expected output
openapi: 3.2.0
info:
title: New meta apis defined
version: v1
paths:
/things:
get:
responses:
'200':
$ref: '#/components/responses/things_response'
/things/meta:
get:
parameters:
- $ref: '#/components/parameters/query_filter'
responses:
'200':
$ref: '#/components/responses/things_response_meta'
components:
responses:
things_response:
description: OK
content:
'application/json':
schema:
$ref: '#/components/schemas/things'
things_response_meta:
description: OK
content:
'application/json':
schema:
$ref: '#/components/schemas/things_meta'
schemas:
things: {}
things_meta: {}
parameters:
query_filter:
name: $filter
description: OData v4 $filter query parameter
in: query
required: false
schema:
type: string
- 主要言語
- JavaScript
- スター
- 126
- フォーク
- 38
- 平均マージ
- 4日 18時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OAI/Overlay-Specification のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
OAI/Overlay-Specification#415 ·
メンテナーはふだん 1 日以内に返信
-
Revisit: should Overlays declare their target document format? (follow-up to #268)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OAI/Overlay-Specification#367 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OAI/Overlay-Specification#358 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
OAI/Overlay-Specification#299 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
OAI/Overlay-Specification#291 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
OAI/Overlay-Specification の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Automattic/node-canvas#2633 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
capricorn86/happy-dom#2594 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
microsoft/monaco-editor#5575 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信