Skip to content

[BUG][typescript-angular] allOf not working without additional properties #4770

@joke

Description

@joke

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

The typescript generator generators does not include attributes without specifying additional properties:

  • The interface PetListEntry is empty and does not extend Pet
export interface PetNew { 
    name: string;
}

export interface Pet { 
    id: string;
    name: string;
}

export interface PetListEntry { 
}
openapi-generator version

4.2.2

OpenAPI declaration file content
openapi: 3.0.2
info:
  title: api
  version: 1.0.0
paths:
  /pets:
    get:
      summary: list all pets
      responses:
        200:
          description: An array of pets
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PetListEntry'
    post:
      summary: create new pet
      requestBody:
        description: Pet to be created
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PetNew'
      responses:
        201:
          description: Newly created pet
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      allOf:
        - type: object
          required:
            - id
          properties:
            id:
              type: string
        - $ref: '#/components/schemas/PetNew'
    PetListEntry:
      allOf:
        - $ref: '#/components/schemas/Pet'
    PetNew:
      type: object
      required:
        - name
      properties:
        name:
          type: string
Command line used for generation
$ openapi-generator-cli-4.2.2.jar generate -g typescript-angular -i api.yaml
Steps to reproduce
  • Generate the model files
  • Check model files

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