CodeSampleX

サンプル

axum 0.8.9: Handle silent breaking changes in axum 0.8 OptionalFromRequest and OptionalFromRequestParts extractors where malformed Path, invalid Json, and tuple arity mismatches reject with 400, 415, 422, or 500 instead of returning None

検証済みサンプル — cargo axum 0.8.9: Handle silent breaking changes in axum 0.8 OptionalFromRequest and OptionalFromRequestParts extractors where malformed Path…

sha256:f6665f3f04e7d8f13d3608f752ed887269d13145363c702ac891e260d741385e

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
2
ビルドした署名鍵
2
宣言された環境 rust linux x64 rust rust cargo

検証実行環境

環境 コントラクト ステージ 実行日
rust 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1
2026-08-16
rust 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1
2026-08-18

ケース

HOW
ゴール
Handle silent breaking changes in axum 0.8 OptionalFromRequest and OptionalFromRequestParts extractors where malformed Path, invalid Json, and tuple arity mismatches reject with 400, 415, 422, or 500 instead of returning None
パッケージ
シンボル
  • axum::extract::Path
  • axum::extract::OptionalFromRequestParts
  • axum::extract::OptionalFromRequest
  • axum::Json
  • axum::Router::route
  • tower::ServiceExt::oneshot
環境
rust
作成日
2026-08-16T08:12:04Z

コントラクト

  1. assert Option<Path<u32>> returns Some(Path(42)) on a route with a valid path parameter
  2. assert Option<Path<u32>> rejects with 400 Bad Request instead of None when the path parameter in the route fails deserialization
  3. assert Option<Path<u32>> evaluates to None only when the matched route definition contains zero path parameters
  4. assert Option<Json<T>> evaluates to None only when the Content-Type header is completely omitted
  5. assert Option<Json<T>> rejects with 400 Bad Request instead of None when Content-Type is application/json but body has malformed JSON syntax
  6. assert Option<Json<T>> rejects with 422 Unprocessable Entity instead of None when Content-Type is application/json but body has schema or field type mismatches
  7. assert Option<Json<T>> rejects with 422 Unprocessable Entity instead of None when Content-Type is application/json but required fields are missing
  8. assert Option<Json<T>> rejects with 415 Unsupported Media Type instead of None when Content-Type header is non-JSON like text/plain
  9. assert Option<Json<T>> returns Some(Json(T)) when valid JSON body and Content-Type are provided
  10. assert a 1-tuple Path<(u32,)> on a 2-parameter route rejects with 500 Internal Server Error for arity mismatch instead of silently extracting the first parameter
  11. assert a 2-tuple Path<(u32, u32)> on a 2-parameter route extracts both parameters and returns 200 OK

ファイル

  • Cargo.lock
  • Cargo.toml
  • NOTES.md
  • csx.json
  • src/lib.rs

ソースアーティファクトをダウンロード (tar.gz)

オリジンシーダー

csx-seed