Skip to content

[BUG] [typescript-angular] AllOf hierarchy produces api that doesn't compile #8000

@tschmidt01

Description

@tschmidt01

OpenAPI Spec

openapi: 3.0.3

info:
  title: Demo
  version: 1.0.0
  description: Demo

paths:
  /some-path:
    post:
      operationId: create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtendedTransferObjectRequest'
      responses:
        201:
          description: some description
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtendedTransferObjectResponse'

components:
  schemas:
    TransferObject:
      type: object
      properties:
        id:
          type: string
          format: uuid
    ExtendedTransferObject:
      type: object
      allOf:
        - $ref: '#/components/schemas/TransferObject'
        - type: object
      required:
        - some-field
      properties:
        some-field:
          type: string
    ExtendedTransferObjectRequest:
      type: object
      allOf:
        - $ref: '#/components/schemas/ExtendedTransferObject'
        - type: object
    ExtendedTransferObjectResponse:
      type: object
      allOf:
        - $ref: '#/components/schemas/ExtendedTransferObject'
        - type: object

Generated with

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate -i /local/sample.yml -g typescript-angular -o /local/build

Results in a default.service.ts file with a invalid import statement along with unused class ExtendedTransferObject:

import { ExtendedTransferObject & object } from '../model/models';

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