Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #6377
Closed
Open
Issue created May 20, 2020 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][C++][QT5] Code not compileable when circular scheme dependencies exist

Created by: ghost

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?
  • [Optional] Bounty to sponsor the fix (example)
Description

The generated C++ (QT5) code cannot be compiled, when circular scheme dependencies are used.

openapi-generator version

4.3.1

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: 0.0.1
  title: Test
paths:
  /endpoint:
    get:
      operationId: getOptions
      description: "-"
      parameters:
      - name: OptionA
        in: header
        schema:
          $ref: '#/components/schemas/OptionA'
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OptionA'
components:
  schemas:
    OptionA:
      type: object
      description: 'OptionA'
      properties:
        suboptions:
          type: array
          description: 'Suboptions of OptionA'
          items:
            $ref: '#/components/schemas/OptionB'
    OptionB:
      type: object
      description: 'OptionB'
      properties:
        suboptions1:
          type: array
          description: 'Suboptions 1 of OptionB'
          items:
            $ref: '#/components/schemas/OptionA'
        suboptions2:
          type: array
          description: 'Suboptions 2 of OptionB'
          items:
            $ref: '#/components/schemas/OptionB'
Command line used for generation

java -cp openapi-generator-cli-4.3.1.jar org.openapitools.codegen.OpenAPIGenerator generate -i ${SPEC_FILE} -g cpp-qt5-client -o gen/ --model-name-prefix Test

Steps to reproduce
  1. Generate CPP code with above command line.
  2. Generate Makefiles e.g. with (MAC and QT5.14.0): cmake CMakeLists.txt -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.14.0/
  3. Compile: make
Related issues/PRs

Few similar issues (other languages) seems to exist.

Suggest a fix

Partly it can probably be fixed by forward declaration in headers, but not completely. More investigation needed.

Assignee
Assign to
Time tracking