Skip to content

[BUG][typescript-fetch] withInterfaces result includes 'raw' methods #10237

@deroude

Description

@deroude
Description

When I generate typescript-fetch code from OpenAPI spec, using withInterfaces=true switch, the generated interfaces include two methods for each API operation, e.g. getArticles and getArticlesRaw.

The raw method is not part of the API, it's an implementation detail; the interface should be 1:1 with the OpenAPI spec.

openapi-generator version

"@openapitools/openapi-generator-cli": "^2.3.7"

OpenAPI declaration file content or url
openapi: 3.0.1 info: title: Example description: Reproducing bug version: 1.0.0 servers: - url: 'http://localhost:9000/' tags: - name: article description: 'Everything concerning articles, comments' paths: /article: get: tags: - article summary: Get all articles operationId: getArticles parameters: - in: query name: category schema: type: string default: BLOG - in: query name: filter schema: type: string - in: query name: language schema: type: string default: en - in: query name: page schema: type: integer default: 0 - in: query name: itemsPerPage schema: type: integer default: 20 responses: '200': description: Articles retrieved content: application/json: schema: type: array items: $ref: '#/components/schemas/Article' components: schemas: Article: type: object properties: id: type: string format: uuid author: $ref: '#/components/schemas/User' category: type: string description: Category enum: - BLOG - FRONT_PAGE title: type: string description: Title slug: type: string text: type: string tags: type: string language: type: string publishDate: type: string format: date-time description: Published Date 
Generation Details
openapi-generator-cli generate -g typescript-fetch -i api-bundle.yaml -o ./packages/generated --additional-properties=typescriptThreePlus=true,withInterfaces=true 
Steps to reproduce

Generate code from provided spec using provided script.
Check generated/apis/ArticleApi.ts

Suggest a fix

The method is written here -- either remove this completely, or make it ? optional.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions