Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define/Modify default API Gateway responses #7071

Closed
mbsimonovic opened this issue Mar 30, 2020 · 1 comment · Fixed by #7441 or bifravst/cloudformation-cleaner#13
Closed

Define/Modify default API Gateway responses #7071

mbsimonovic opened this issue Mar 30, 2020 · 1 comment · Fixed by #7441 or bifravst/cloudformation-cleaner#13
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on.

Comments

@mbsimonovic
Copy link

Feature request: a way to modify the default API Gateway response templates.

Use Case

I'd like to add validation errors in the API response, by modifying the BAD_REQUEST_BODY template to return validation errors:

{ 
  "message":$context.error.messageString, 
  "validationErrors":"$context.error.validationErrorString" 
}

Proposed Solution

Ideally thru the RestApiProps:

new apigateway.RestApi(this, 'apigw', {
 responseTemplates: { 
    apigateway.ResponseTypes.BAD_REQUEST_BODY: {
      'application/json': '{"message":$context.error.messageString,"validationErrors":"$context.error.validationErrorString"}'
    }
 }
}

This is a 🚀 Feature Request

@mbsimonovic mbsimonovic added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Mar 30, 2020
@SomayaB SomayaB added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Mar 30, 2020
@nija-at
Copy link
Contributor

nija-at commented Apr 3, 2020

Thanks for filing this issue.

The AWS::ApiGateway::GatewayResponse needs to be implemented to support this.

@nija-at nija-at added effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Apr 3, 2020
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Apr 20, 2020
@mergify mergify bot closed this as completed in #7441 Apr 27, 2020
mergify bot pushed a commit that referenced this issue Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on.
Projects
None yet
3 participants