@@ -6,7 +6,87 @@ Prioritized tasks that are currently in progress.
66
77## to do
88
9+ - [ ] fix: change ` passthroughBehavior ` to ` never ` instead of ` when_no_match ` , if correct
910- [ ] bug: ` rx init ` shouldn't overwrite a file if it exists. Can overwrite with ` --force ` .
1011- [ ] bug: the CORS headers should be added to all operations, not just ` OPTIONS `
1112- [ ] bug: all errors should be friendly, unless verbose is on.
1213- [ ] feature: all log output history should be stored like git log or reflog format.
14+ - [ ] feature: upgrade to AWS API Gateway v2 API
15+ - [ ] bug: oclif autocomplete doesn't work when opening a new shell on mac (maybe because of bashrc instead of bash_profile?)
16+
17+ ## notes
18+
19+ ``` typescript
20+ import ' source-map-support/register'
21+ import { APIGatewayProxyHandler , APIGatewayEvent } from ' aws-lambda'
22+ import { APIGateway } from ' aws-sdk'
23+
24+ const gateway = new APIGateway ()
25+
26+ export const handler: APIGatewayProxyHandler = async function (event , context ) {
27+ const getExportResponse = await gateway .getExport ({
28+ restApiId: event .requestContext .apiId ,
29+ stageName: event .requestContext .stage ,
30+ exportType: ' swagger' ,
31+ parameters: event .requestContext .path === ' /docs/postman' ? { extensions: ' postman' } : undefined ,
32+ accepts: ' application/json'
33+ }).promise ()
34+ if (! getExportResponse .body ) {
35+ console .error (' No export returned' )
36+ return {
37+ statusCode: 500 ,
38+ body: JSON .stringify ({ message: ' Internal server error' })
39+ }
40+ }
41+ return {
42+ statusCode: 200 ,
43+ headers: {
44+ ' Content-Type' : ' application/json'
45+ },
46+ body: getExportResponse .body .toString ()
47+ }
48+ }
49+ ```
50+
51+ ``` yaml
52+ /docs/swagger :
53+ get :
54+ summary : Returns a swagger specification
55+ description : Returns a swagger specification
56+ produces :
57+ - application/json
58+ responses :
59+ 200 :
60+ description : OK
61+ schema :
62+ $ref : " #/definitions/SpecResponse"
63+ security :
64+ - api_key : []
65+ x-amazon-apigateway-auth :
66+ type : aws_iam
67+ x-amazon-apigateway-integration :
68+ type : aws_proxy
69+ httpMethod : POST
70+ uri : ${spec_lambda_invoke_arn}
71+ passthroughBehavior : when_no_match
72+ /docs/postman :
73+ get :
74+ summary : Returns a postman collection
75+ description : Returns a postman collection
76+ produces :
77+ - application/json
78+ responses :
79+ 200 :
80+ description : OK
81+ schema :
82+ $ref : " #/definitions/SpecResponse"
83+ security :
84+ - api_key : []
85+ x-amazon-apigateway-auth :
86+ type : aws_iam
87+ x-amazon-apigateway-integration :
88+ type : aws_proxy
89+ httpMethod : POST
90+ uri : ${spec_lambda_invoke_arn}
91+ passthroughBehavior : when_no_match
92+ ` ` `
0 commit comments