openapi-typescript-code-generator
openapi-typescript-code-generator copied to clipboard
Bug: RequestBody type omits application/json when application/json doesn't have schema property
Steps To Reproduce
If oas file has lacked schema property about media type, RequestBody type omits application/json type. This cause build error because Param type generates reference to it. See followed by an example.
requestBody:
description: The request body is currently not used.
required: true
content:
application/json:
example: '{}'
I thought it's loose schema definition, but OAS doesn't require it must be specified.
Run bun i && bun gen.ts && npx tsc --noEmit ./src/client.ts in https://github.com/tkow/cloudflare-ts-client.
The current behavior
Params type generate requestBody refers to RequstBodyType,
requestBody: RequestBody$zone$cache$settings$start$cache$reserve$clear["application/json"]
but empty RequestBody type is generated.
export interface RequestBody$zone$cache$settings$start$cache$reserve$clear {
}
The expected behavior
It may be suitable that it generates
export interface RequestBody$zone$cache$settings$start$cache$reserve$clear {
"application/json": any
}