Forum Discussion

Sadie's avatar
Sadie
Occasional Visitor
4 years ago

Function type naming [TypeScript]

Hi anyone!

 

I'm generating typescript-fetch code from swagger.yaml using openapi. It generates great code and names correctly function name and function parameters using OperationId parameter. But! It cannot  name function type and  just write InlineResponse{number}. I want them to be named the same way.

 

For example,

get:
security:
- AccessToken: []
summary: get pony count
operationId: getPonyCount
parameters:
- in: path
name: name
required: true
schema:
type: string
responses:
200:
description: success
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/CalcIndicator"

It will generate

async getPonyCountRaw(requestParameters: GetPonyCountRaw): Promise<runtime.ApiResponse<InlineResponse20058>> {

 I want InlineResponse20058 not to be here.

 

I tried to put whole schema to components/schemas and put ref to it. It helped, but this solution is not good enough. I tried to  add x-codegen-request-body-name parameter, but it didn't help/ I turned on --additional-properties=prefixParameterInterfaces=true. It also didn't help.

 

Has anyone more ideas? 🙂

 

No RepliesBe the first to reply