[Bug] Inherited class not generated with referencing

Open
#6,360 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
yaml
Domain
api

Research direction

Reproduce the setup from index.yaml and definitions.yaml with swagger 2.2.3, then trace how the referenced ResponseWrapper«TestDto» inheritance is resolved during generation. Compare the generated models with the hackfix case; done means TestDto is generated from the original response reference without the fake endpoint.

Written by the indexing model from the issue text.

Description

TestDto isn't generated for setup below:

index.yaml

paths:
  /testpath:
    post:
      responses:
        '200':
          schema:
            $ref: './definitions.yaml#/definitions/ResponseWrapper«TestDto»'

definitions.yaml

definitions:
  ResponseWrapper:
    type: object
    properties:
      data:
        type: object
    required:
      - data
  ResponseWrapper«TestDto»:
    allOf:
      - $ref: '#/definitions/ResponseWrapper'
      - type: object
        properties:
          data:
            $ref: '#/definitions/TestDto'
  TestDto:
    type: object
    properties:
      alertId:
        type: string

hackfix used to generate TestDto:

paths:
   #hackfix for swagger-codegen
  /fakeApiPleaseIgnore:
    post:
       description: hackfix, please ignore
       responses:
        500:
          schema:
            $ref: './definitions.yaml#/definitions/TestDto'

swagger 2.2.3

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

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.

More from swagger-api/swagger-codegen

All issues in swagger-api/swagger-codegen

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.