openapi-ts
openapi-ts copied to clipboard
Make the generation of `unknown` types for undefined spec configurable
Description
This is similar, but not quite the same, to https://github.com/hey-api/openapi-ts/issues/820.
Spec excerpt:
paths:
/login:
post:
operationId: loginMethod
responses:
200:
description: OK
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/LoginRequest"
Generated TS relating to the response body:
// types.gen.ts
export type LoginMethodResponse = unknown;
In this case, if I don't define anything for the response body, it still gets generated as an unknown type. The name of this type is inferred from the operationId field, eg:
operationId: loginMethod -> LoginMethodResponse
This is unexpected behavior for me, after switching from openapi-typescript-codegen.
Still, it might be by design now, which is why I'm not reporting a bug, but instead asking for the possibility to make it configurable; thus allowing the developer to choose NOT to generate a type at all (even void would be preferable here).
Thanks