Skip to content

[typescript-angular] multiple allOf with allOf does not work #1331

@lukasberanek-tpa

Description

@lukasberanek-tpa

Given the following schema:

swagger: '2.0'
paths:
  "/api/v1/users":
    get:
      summary: Get users
      operationId: GetUserRoute
      responses:
        '200':
          description: Ok
          schema:
            type: array
            items:
              "$ref": "#/definitions/user"
definitions:
  user:
    type: object
    allOf:
    - "$ref": "#/definitions/requiredUser"
    - "$ref": "#/definitions/optionalUser"
  requiredUser:
    type: object
    allOf:
    - "$ref": "#/definitions/email"
    required:
    - id
    properties:
      id:
        type: string
  email:
    type: string
  optionalUser:
    type: object
    allOf:
    - "$ref": "#/definitions/address"
    properties:
      name:
        type: string
  address:
    type: object
    properties:
      zipCode:
        type: string
      street:
        type: string

It describes a user that is allOf: requiredUser, optionalUser.
And they are again composed of properties and allOf.

Then the generated user.ts looks like this:

import { OptionalUser } from './optionalUser';
import { RequiredUser } from './requiredUser';

export interface User extends RequiredUser { 
    name?: string;
}

So all of requiredUser is included, and only the immediate properties of optionalUser but not the address from the allOf.

My expectation would be:

import { OptionalUser } from './optionalUser';
import { RequiredUser } from './requiredUser';

export interface User extends RequiredUser, OptionalUser { 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions