I am trying to generate Typescript client with OpenAPI Generator 4.0.0-SNAPSHOT (our manager asked us to use that version for some reason) that reads an OpenAPI 3.0 spec. All of our current endpoints either accept data in query string or as form body, and they all work perfectly. I have a new endpoint that will read data as JSON in POST body (other endpoints will eventually be converted too). It will accept an object like the following:
{email: "[email protected]"}
I'm trying to document the endpoint in YAML as following:
/users/send-password-reminder:
post:
[...]
requestBody:
content:
application/json:
schema:
type: object
properties:
email:
type: string
responses:
[...]
However, when I generate the Typescript client, it generates a SendPasswordReminderRequest object, which wraps an autogenerated InlineObject1 object, which wraps my actual email.
This causes me to use it like:
const req: SendPasswordReminderRequest = {
inlineObject1:{
email: "..."
}
};
APIClient.user.sendPasswordReminder(req, ...)
What I want instead is to get rid of that InlineObject1 completely and make SendPasswordReminderRequest directly wrap email property, and to be able to use it as:
const req: SendPasswordReminderRequest = {
email: "..."
};
APIClient.user.sendPasswordReminder(req, ...)
I've tried defining the body in components/requestBodies and using $ref, and it still wraps the actual body even though it uses the name of my request body type.
How can I get rid of this wrapping?
inlineObject1withUser. - Shaun Luttin$ref,InlineObject1is replaced byMyNameThatIChoose, but I want to remove wrapping altogether. - Can Poyrazoğlu