openapi-codegen-ts
openapi-codegen-ts copied to clipboard
`Buffer` type breaks generated SDKs
Operations which produce octet/stream responses will be resolved into generated definitions using Buffer as defined in https://github.com/pagopa/openapi-codegen-ts/pull/293
This breaks the build of SDK packages as Buffer is not a native Typescript type
Example
swagger: '2.0'
info:
version: 1.0.0
title: API
host: localhost
basePath: /api/v1
schemes:
- https
paths:
/mypath:
get:
summary: An endpoint
produces:
- application/octet-stream
responses:
'200':
description: Success
schema:
format: binary
type: string
'400':
description: Bad Request
'500':
description: Internal Server Error
requestTypes.ts:2047:8 - error TS4016: Type parameter 'A0' of exported function has or is using private name 'Buffer'.
The easier solution would be to add @types/node as a dev dependency of the generated package. I have some concerns:
- Should we use a specific version of Node?
- Is it correct to reference Node? SDKs are meant to be used both in a Node application and in the browser.