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

Option to rename requestBody #2011

Open
gersongoulart opened this issue Jan 29, 2024 · 1 comment
Open

Option to rename requestBody #2011

gersongoulart opened this issue Jan 29, 2024 · 1 comment

Comments

@gersongoulart
Copy link

In the OpenAPI v3 spec, the requestBody does not have a name. By default, it will be passed into the generated function as requestBody.

It would be nice to accept the commonly used x-body-name property in the operation schema to override this name.

Example:

paths:
  /foo:
    post:
      operationId: api.foo_get
      requestBody:
        x-body-name: payload
        content:
          application/json:
            schema:
              ...
# default
body: requestBody,

# based on x-body-name
body: payload,
gersongoulart pushed a commit to provantagex/openapi-typescript-codegen that referenced this issue Jan 29, 2024
…fault, it will be passed into the generated function as `requestBody`. Accept the commonly used `x-body-name` property in the operation schema to override this name. ferdikoomen#2011
@mrlubos
Copy link
Collaborator

mrlubos commented Feb 4, 2024

Hey @gersongoulart, I see you have other commits in your fork in addition to this feature, but just wanted to let you know I've also added this feature to our fork. It has some other features too, mostly around OpenAPI 3.1 compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants