

# x-amazon-apigateway-gateway-responses.responseTemplates オブジェクト
<a name="api-gateway-swagger-extensions-gateway-responses.responseTemplates"></a>

特定のゲートウェイレスポンスの [GatewayResponse](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html) マッピングテンプレートを、キーと値のペアの文字列間マップとして定義します。キーと値のペアごとに、キーはコンテンツタイプです。たとえば、「application/json」と値は、単純な変数置換のための文字列化されたマッピングテンプレートです。`GatewayResponse` マッピングテンプレートは、[Velocity Template Language (VTL)](https://velocity.apache.org/engine/devel/vtl-reference.html) エンジンでは処理されません。


| プロパティ名 | タイプ | 説明 | 
| --- | --- | --- | 
| content-type | string |  ゲートウェイレスポンス本文をカスタマイズする方法として単純な変数の置換のみをサポートする `GatewayResponse` 本文マッピングテンプレートです。  | 

## x-amazon-apigateway-gateway-responses.responseTemplates の例
<a name="api-gateway-swagger-extensions-gateway-responses.responseTemplates-example"></a>

 次の OpenAPI 拡張例では、API Gateway により生成されたエラーレスポンスをアプリ固有の形式にカスタマイズする [GatewayResponse](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html) マッピングテンプレートを示しています。

```
      "responseTemplates": {
        "application/json": "{ \"message\": $context.error.messageString, \"type\":$context.error.responseType, \"statusCode\": '488' }"
      }
```

 次の OpenAPI 拡張例では、API Gateway により生成されたエラーレスポンスを静的なエラーメッセージで上書きする [GatewayResponse](https://docs.aws.amazon.com/apigateway/latest/api/API_GatewayResponse.html) マッピングテンプレートを示しています。

```
      "responseTemplates": {
        "application/json": "{ \"message\": 'API-specific errors' }"
      }
```