Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: RequestBody type omits application/json when application/json doesn't have schema property #129

Open
tkow opened this issue Feb 12, 2024 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@tkow
Copy link
Contributor

tkow commented Feb 12, 2024

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.

スクリーンショット 2024-02-12 17 06 35

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
}
@tkow tkow added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant