Skip to main content

Module models

Module models 

Source
Expand description

§データモデルモジュール

このモジュールは、コンタクトフォームAPIのリクエスト・レスポンスに使用するデータ構造を定義します。 Lambda 関数が受け取る API Gateway リクエストの構造と、クライアントに返すレスポンスの構造を 型安全に扱えるようにします。

§リクエスト構造

API Gateway HTTP API が Lambda に渡すペイロードは次の形式です(バージョン2.0):

{
  "requestContext": {
    "http": { "method": "GET" },
    "authorizer": {
      "jwt": {
        "claims": {
          "email": "user@example.com",
          "sub": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        }
      }
    }
  },
  "body": "{\"subject\":\"...\",\"body\":\"...\"}"
}

§レスポンス構造

Lambda から API Gateway に返すレスポンスは次の形式です:

{
  "statusCode": 200,
  "headers": {
    "Content-Type": "application/json",
    "Access-Control-Allow-Origin": "https://example.com"
  },
  "body": "{\"email\":\"...\",\"count\":1,\"inquiries\":[...]}"
}

§OpenAPI スキーマ

openapi フィーチャーが有効な場合、[utoipa::ToSchema] が derive されます。 [crate::bin::generate-openapi] バイナリがこれを使用して OpenAPI 定義を生成します。

Structs§

Authorizer 🔒
API Gateway JWT Authorizer の認可情報
Claims 🔒
JWT クレームセット
CreateInquiryRequest 🔒
POST /inquiries のリクエストボディ
CreateInquiryResponse 🔒
POST /inquiries のレスポンスボディ
ErrorResponseBody 🔒
エラーレスポンスボディ
Http 🔒
HTTP メソッド情報
Inquiry 🔒
お問い合わせの詳細情報
InquiryListResponse 🔒
GET /inquiries のレスポンスボディ
Jwt 🔒
JWT トークン情報
Request 🔒
API Gateway HTTP API からの Lambda イベントペイロード
RequestContext 🔒
API Gateway リクエストコンテキスト
Response 🔒
Lambda から API Gateway に返すHTTPレスポンス