Generated client treats a declared 304 Not Modified as UnexpectedResponse
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- openapi, rust
調査の方向性
Start by reading the response handling generated for progenitor::generate_api! and the tests for declared HTTP responses. Reproduce the issue with the supplied OpenAPI document and confirm that the generated client returns UnexpectedResponse for the empty 304 response. Done means callers can distinguish the declared 304 outcome and access its headers; pull request #1463 is already open.
索引モデルが issue の本文から書いたものです。
説明
A conditional GET can return 200 OK with JSON or 304 Not Modified with an empty body. With both responses declared, Progenitor 0.17.0 generates a client that returns Err(Error::UnexpectedResponse) for the 304. A caller that already has the representation has to recover a documented outcome from the catch-all error to reuse its cached copy.
Minimal OpenAPI document
{
"openapi": "3.0.3",
"info": {"title": "Conditional GET", "version": "1"},
"paths": {
"/item": {"get": {
"operationId": "get_item",
"parameters": [{"in": "header", "name": "If-None-Match", "schema": {"type": "string"}}],
"responses": {
"200": {"description": "Current item", "headers": {"ETag": {"schema": {"type": "string"}}}, "content": {"application/json": {"schema": {"type": "string"}}}},
"304": {"description": "Not modified", "headers": {"ETag": {"schema": {"type": "string"}}}}
}
}}
}
}
Reproduction
- Generate the client from this document using
progenitor::generate_api!("openapi.json")withprogenitor = "=0.17.0". - Have
GET /itemreturn200,Content-Type: application/json,ETag: "v1"and the JSON string"current". When the request includesIf-None-Match: "v1", return304with the sameETagand an empty body. - Make the two calls with the generated client.
let item = client.get_item(None).await.unwrap();
let tag = item.headers()[reqwest::header::ETAG].to_str().unwrap();
let revalidated = client.get_item(Some(tag)).await;
The first call returns the value "current". The second returns Err(Error::UnexpectedResponse(r)) with r.status() == 304 and the original ETag still present. I reproduced this on loopback with the default redirect policy.
Expected behavior
The caller can distinguish a fresh value from a declared Not Modified outcome and access its headers, without decoding an empty JSON body or matching UnexpectedResponse. The caller already holds the cached value.
Related to #451, which discusses 303 and redirect policy. A 304 completes the conditional request with the cached representation still valid. RFC 9110 §15.4.5
AI disclosure
OpenAI Codex investigated the behavior, reproduced it against Progenitor 0.17.0, and drafted this issue report.
- 主要言語
- Rust
- スター
- 1k
- フォーク
- 142
- 平均マージ
- 19時間 13分
- マージ済み PR(30日)
- 16
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
oxidecomputer/progenitor のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
oxidecomputer/progenitor#1345 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
oxidecomputer/progenitor#1457 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
oxidecomputer/progenitor#1444 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
oxidecomputer/progenitor#1382 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
oxidecomputer/progenitor#1318 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
oxidecomputer/progenitor の issue をすべて見る
似ている issue
-
[Bug]: Add Data's question says "Link to the file" for a GeoPackage where small tables are copiedオープンunconfirmed possible issue
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jerney-nexus/epikrise#364 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Yeachan-Heo/gajae-code#8058 ·
メンテナーはふだん 1 日以内に返信
-
bug daemon
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信