Generated servers cannot route a path parameter declared `allowReserved: true`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
ext/OpenAPIHTTPExt.jl、OpenAPI.server_source、および生成されたサーバー glue コードで使用される _SERVER_OPS データを読みます。test/servergen.jl の SERVER_ROUNDTRIP_DOCUMENT から始めて、既存のサーバー生成テストを実行します。生成されたクライアントとサーバーが allowReserved のパス値を round-trip し、サポートされていない非末尾の greedy パラメーターが生成時の診断を生成すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Since the runtime honours allowReserved on path parameters, a generated
client sends a slash-delimited path value as multiple path segments. A
generated server built from the same document still registers the raw
template (/documents/{path}), and HTTP.Router matches {name} against
exactly one segment — so the request 404s before it ever reaches
_decode_path_parameter.
One document therefore produces a client and a server that cannot talk to each
other, and the failure is a silent 404 rather than a diagnostic.
Reproduction
Document (3.0 or 3.2 — see the version note below):
"/documents/{path}": {
"get": {
"operationId": "getDocument",
"parameters": [{
"name": "path", "in": "path", "required": true,
"allowReserved": true,
"schema": { "type": "string" }
}],
"responses": { "200": { "description": "ok",
"content": { "text/plain": { "schema": { "type": "string" } } } } }
}
}
Generate the server, register! it on an HTTP.Router, and dispatch both wire
forms of the value opa/examples/public servers:
/documents/opa%2Fexamples%2Fpublic%20servers -> 200 got:opa/examples/public servers
/documents/opa/examples/public%20servers -> 404 <empty> <-- what the client now sends
Cause
ext/OpenAPIHTTPExt.jl registers the template verbatim:
HTTP.register!(router, entry.method, string(path_prefix, entry.path), handler)
HTTP.Handlers.gethandler splits the request target on / and matches
segment by segment, so {path} is inherently single-segment.
_decode_path_parameter is not at fault — given the full multi-segment raw
text it _percent_decodes to the correct value. Only the route shape is wrong.
Constraints on a fix
- HTTP.jl's only multi-segment construct is
**, andinsert!hard-errors
with"/** double wildcard must be last segment in path". A greedy route is
therefore only possible when theallowReservedparameter is the final
path segment./documents/{path}/versionsis unservable this way and should
raise a generation-time diagnostic rather than emit a silently broken route. **is not parsed as aVariable, so it contributes nothing to
HTTP.getparams. The generated handler has to slice the tail out of
request.targetitself.OpenAPI.server_sourceis a public seam and the HTTP extension is only one
consumer. The "this operation has a greedy tail parameter" fact belongs in
_SERVER_OPS(e.g. agreedy_path_argfield) rather than inside
GENERATED_HTTP_SERVER_GLUE, so other framework extensions do not each
re-derive it.- Not confined to
style: simple.labelandmatrixvalues span segments
too (.a/b,;path=a/b), so those branches of_decode_path_parameterare
in scope for whatever routing fix lands. allowReservedpreserves existing percent-escapes (_escape("%2F"; allow_reserved = true) == "%2F"), so a value whose literal text contains
%2Fis indistinguishable from a separator on the wire. That ambiguity is
inherent to the feature and should be documented, not worked around.
Tests
SERVER_ROUNDTRIP_DOCUMENT in test/servergen.jl has no allowReserved path
parameter, which is why nothing caught this. A round-trip case there — generated
client target in, generated server handler argument out — is the right place for
the regression test.
Version note
The bundled spec schemas disagree about whether allowReserved is even legal
on a path parameter:
| Document version | allowReserved on a path parameter |
|---|---|
| 3.0 | accepted (generic Parameter property; PathParameter does not forbid it) |
| 3.1 | rejected — scoped to styles-for-query under unevaluatedProperties: false; the document fails to load even with strict = false |
| 3.2 | accepted, explicitly (styles-for-path) |
So this affects 3.0 and 3.2 documents only. The client-side caveat is already
documented in MIGRATION.md and docs/src/clients.md.
- 主要言語
- Julia
- スター
- 56
- フォーク
- 16
- 平均マージ
- 1日 51分
- マージ済み PR(30日)
- 12
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaComputing/OpenAPI.jl のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
JuliaComputing/OpenAPI.jl#128 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaComputing/OpenAPI.jl#118 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
JuliaComputing/OpenAPI.jl#117 ·
メンテナーはふだん 1 日以内に返信
-
stale
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
JuliaComputing/OpenAPI.jl#87 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
stale
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaComputing/OpenAPI.jl#73 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
JuliaComputing/OpenAPI.jl の issue をすべて見る
似ている issue
-
add-on doc enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
JuliaGraphics/ColorTypes.jl#344 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
R
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
eWaterCycle/remotebmi#58 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
`enzymexla.linalg.lu` lowering fails for a tall matrix: the permutation is built with the pivot typeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
EnzymeAD/Enzyme-JAX#3286 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
SciML/LinearSolve.jl#1359 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信