Skip to content

Commit

Permalink
Update http-api-ts version to ESM version
Browse files Browse the repository at this point in the history
  • Loading branch information
GDownes committed Oct 18, 2023
1 parent 18397ce commit 32b5850
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@hexlabs/lambda-api-ts": "^0.1.12"
},
"devDependencies": {
"@hexlabs/http-api-ts": "^1.1.33",
"@hexlabs/http-api-ts": "^2.0.36",
"@types/aws-lambda": "^8.10.40",
"@types/jest": "^24.9.1",
"@types/node": "^18.18.5",
Expand Down
2 changes: 1 addition & 1 deletion src/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Method {
return `[${statusCode}]: { ${responses.join(', ')} }`;
}).join(', ');
const handlerType = `(request: ${this.aws ? `APIGatewayProxyEvent, parts: Parts<{${singleQueries}},{${multiQueries}},{${paths}},{${singleHeaders}},{${multiHeaders}}>, respondWith: { ${returner} }` : 'Req'}) => Promise<${this.aws ? 'APIGatewayProxyResult' : 'Response'}>`;
return [`${spacing}bind(HttpMethod.${this.method.toUpperCase()}, ${this.aws ? `mapped(${singleHeaderNames}, ${multiHeaderNames},`: ''}(...params: any[]) => this.handlers.${name}?.bind(this)?.(...params, { ${returnerImplementation} }) ?? (async () => ({statusCode: 501, body: 'Not Implemented'})))${this.aws ? ')': ''}`, [name + `: ${handlerType}`]];
return [`${spacing}bind(HttpMethod.${this.method.toUpperCase()}, ${this.aws ? `mapped(${singleHeaderNames}, ${multiHeaderNames},`: ''}(...params: any[]) => this.handlers['${name}']?.bind(this)?.(...params, { ${returnerImplementation} }) ?? (async () => ({statusCode: 501, body: 'Not Implemented'})))${this.aws ? ')': ''}`, [`'${name}'` + `: ${handlerType}`]];
}
}

Expand Down
2 changes: 0 additions & 2 deletions test/schema-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default OpenApiSpecificationBuilder
'/chicken': {
get: {
security: [{Auth: ['read', 'write', 'admin']}],
operationId: 'getChickens',
responses: {
200: o.response(o.jsonContent('ChickenCollection'), 'The Flock'),
}
Expand All @@ -65,7 +64,6 @@ export default OpenApiSpecificationBuilder
},
'/chicken/{chickenId}': {
get: {
operationId: 'getChicken',
parameters: [
o.path('chickenId'),
o.query('someQuery'),
Expand Down
2 changes: 1 addition & 1 deletion test/schema-simple-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default OpenApiSpecificationBuilder
o.query('someOtherQuery', false, true) // A multi string query parameter
],
responses: {
200: o.response('A Chicken', o.jsonContent('Chicken')) // Chicken here can only be one of the defined entries in the schema
200: o.response(o.jsonContent('Chicken'), 'A Chicken') // Chicken here can only be one of the defined entries in the schema
}
},
}
Expand Down

0 comments on commit 32b5850

Please sign in to comment.