Skip to content

[BUG] [TYPESCRIPT-AXIOS] [MAVEN] allOf inherit not working #23376

@Rudolf0002

Description

@Rudolf0002

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I have 2 classes, the first one (One1) has some fields and the second one (Two2) has also some fields and inherits the fields from class One1.

On my Java generator this works just fine.
On my Typescript-axios generator this doesnt work, and generate me the class One1, but the class Two2 doesnt have any inherits nor fields, it will do this:

export type Two2 = One1;

Ive also tried this on the Typescript-angular & Typescript-fetch generator, they also work just fine.
Only Typescript-Axios seems to have this issue.

Image
openapi-generator version

Tested this issue with these version of the openapi-generator-maven plugin:
7.21.0
7.19.0
7.5.0

OpenAPI declaration file content
openapi: 3.0.4
info:
  title: test
  version: '0.1'
paths:
  /api/test-path:
    get:
      summary: test endpoint
      operationId: testEndPoint
      security: []
      responses:
        "200":
          description: success
          content:
            'application/json':
              schema:
                $ref: '#/components/schemas/One1'
components:
  schemas:
    One1:
      type: object
      required:
        - a
      properties:
        a:
          type: string

    Two2:
      allOf:
        - $ref: '#/components/schemas/One1'
        - type: object
          required:
            - c
          properties:
            c:
              type: string
            d:
              type: integer
Generation Details

POM.xml
<plugin> <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <version>7.21.0</version> <executions> <execution> <id>openapi-test-gen</id> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> <configuration> <generatorName>typescript-axios</generatorName> <inputSpec>src/main/resources/swagger.yaml</inputSpec> <apiPackage>services</apiPackage> <modelPackage>types</modelPackage> <generateApis>true</generateApis> <generateModels>true</generateModels> <configOptions> <withSeparateModelsAndApi>true</withSeparateModelsAndApi> <withAWSV4Signature>false</withAWSV4Signature> <enumPropertyNaming>UPPERCASE</enumPropertyNaming> <openapiNormalizer>REF_AS_PARENT_IN_ALLOF=true</openapiNormalizer> </configOptions> </configuration> </execution> </executions> </plugin>

Steps to reproduce

Just generate a Typescript-Axios client with the given specs i provided.
Take a look at the generated types/classes.

Related issues/PRs
Suggest a fix
  • When i have time, i will edit this post or comment here.

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