feat: requestBody matching
メンテナーはふだん 17 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- kotlin, openapi
調査の方向性
Start with RequestMatcher.kt and MockConfigRepository.kt to understand current path, method, and query matching, then inspect NetworkMockPlugin.kt around request extraction and fallback. Define the body-matching scope and fallback behavior before implementation. Done means body-constrained operations resolve independently, unmatched bodies have documented behavior, tests cover both variants, and real-network fallback still receives the body.
索引モデルが issue の本文から書いたものです。
説明
Part of #72
Depends on #1, #2. Not blocking for 0.2.0 — follow-up depth issue.
Summary
Extend request matching to consider the request body shape, using the OpenAPI requestBody object, so that two operations sharing the same path/method/query but differing by payload (e.g. two variants of a POST distinguished by a discriminator field or required property) can be matched independently.
Current state
RequestMatcher (devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/RequestMatcher.kt) matches purely on path (matchesPath, :112-126, segment-based with {param} support), method (exact string equality, checked in MockConfigRepository.findMatchingMock, :331), and query parameters (matchesQueryParams, :141-149, subset match). There is no visibility into the request body at all — the plugin never reads it (devview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt, request extraction at :161-167 only pulls host/path/method/query).
What to build
- Extend
MockMatch/findMatchingMock(or wherever this lands post-refactor) to optionally read and match against the request body when an operation declares arequestBodyschema. - Matching strategy is worth scoping carefully before implementing — full JSON Schema validation of the body against
requestBody.content.<mediaType>.schemais one option; a narrower "does this required field exist / does this discriminator field have this value" check is a cheaper and probably sufficient option for a mocking tool's purposes. Recommend starting narrow (discriminator/required-field presence) rather than a full schema validator, consistent with this library's existing "close enough for dev tooling" matching philosophy (see how lenient path/query matching already is). - This requires reading the request body in the Ktor plugin, which today never touches it — needs care around consuming a body that may need to be re-sent if this operation ultimately falls through to the real network (the plugin's existing fallback paths, e.g.
NetworkMockPlugin.kt:274-291, currently never touch the body at all, so this is new territory).
Acceptance criteria
- An operation with a
requestBodyschema can be matched more specifically than one without, when two operations otherwise collide on path/method/query. - Reading the request body for matching purposes does not break the real-network fallback path (the body must still be intact if the plugin decides to
execute()the real request). - Matching strategy (narrow vs. full schema validation) is documented in the PR with rationale.
- Tests cover: two operations differing only by body shape both resolve correctly; a body that doesn't match any declared variant falls back sensibly (either no match, or match on the operation without a body constraint — decide and document which).
Files likely touched
devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/RequestMatcher.ktdevview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.ktdevview-networkmock-ktor/src/commonMain/kotlin/com/worldline/devview/networkmock/ktor/plugin/NetworkMockPlugin.kt
- 主要言語
- Kotlin
- スター
- 11
- フォーク
- 3
- 平均マージ
- 10日 9時間
- マージ済み PR(30日)
- 18
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
worldline/devview のほかの issue
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
worldline/devview#99 · コメント 4 件 ·
メンテナーはふだん 17 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
worldline/devview#97 · コメント 4 件 ·
メンテナーはふだん 17 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
worldline/devview#95 · コメント 4 件 ·
メンテナーはふだん 17 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
worldline/devview#85 · コメント 3 件 ·
メンテナーはふだん 17 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
worldline/devview#84 · コメント 3 件 ·
メンテナーはふだん 17 日以内に返信
worldline/devview の issue をすべて見る
似ている issue
-
[BUG] Navigation drawer drops library-name suffixes without ellipsis (1.0.8, NVIDIA Shield)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
damontecres/Wholphin#2069 ·
メンテナーはふだん 1 日以内に返信
-
Android (vision-camera-location): HybridLocationManager never quits its HandlerThread on disposeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
margelo/react-native-vision-camera#4217 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
saisaharsh3/Leftovers#13 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
navikt/esyfo-narmesteleder#700 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
nightscout/AndroidAPS#5280 ·
メンテナーはふだん 1 日以内に返信