swagger-api / swagger-api/swagger-codegen

[BUG] [Angular-Typescript] Not generating inheritances for allOf

Open
#11,128 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

When using the current version (https://editor.swagger.io/) with this YAML

openapi: 3.0.1
info:
  title: Swagger API
  version: v1
paths:
  /Authentication/Logout:
    get:
      tags:
        - Authentication
      operationId: Logout
      responses:
        '200':
          description: Success
components:
  schemas:
    IBase1:
      type: object
      allOf:
        - $ref: '#/components/schemas/IHiddenBase'
      properties:
        a:
          type: string
          nullable: true
      additionalProperties: false
    IBase2:
      type: object
      properties:
        b:
          type: string
          nullable: true
      additionalProperties: false
    IHiddenBase:
      type: object
      allOf:
        - $ref: '#/components/schemas/IObject'
      properties:
        hid:
          type: string
          nullable: true
      additionalProperties: false
    IObject:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
      additionalProperties: false
    IObjectX:
      type: object
      allOf:
        - $ref: '#/components/schemas/IBase1'
        - $ref: '#/components/schemas/IBase2'
      properties:
        x:
          type: string
          nullable: true
      additionalProperties: false

I get the following model with only IBase1 extended:

import { IBase1 } from './iBase1';
import { IBase2 } from './iBase2';

export interface IObjectX extends IBase1 { 
    b?: string;
    x?: string;
}

Guess that's an issue? Took me a while already to make Swashbuckle understand multiple interface inheritances, please don't tell me I'll fail now on generation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in editor.swagger.io with the YAML and Angular-TypeScript output shown here. Trace the generator's allOf handling and verify that the generated IObjectX interface extends both IBase1 and IBase2 while preserving the listed properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.