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
  • #2477
Closed
Open
Issue created Mar 22, 2019 by Administrator@rootContributor

[C++][Pistache-Server] Creation of weird #include statements from oneOf-statement

Created by: jochengern

Description

If I use a schema definition as shown in the yaml-snippet below, I get a file Error.h that contains the following #include statement: #include OneOfErrInternalErrorErrInvalidIdErrCurrentlyNotAllowedErrApplicationNotLoadableErrApplicationNotAvailableErrItemDoesNotExist.h" that will never compile because such a file does not exist. It also contains the following method-declrarations: OneOfErrInternalErrorErrInvalidIdErrCurrentlyNotAllowedErrApplicationNotLoadableErrApplicationNotAvailableErrItemDoesNotExist getCode() const; void setCode(OneOfErrInternalErrorErrInvalidIdErrCurrentlyNotAllowedErrApplicationNotLoadableErrApplicationNotAvailableErrItemDoesNotExist const& value);

Neither while validating the yaml that contains this schema does issue an error message nor does the creation process.

openapi-generator version

4.0.0-beta2

OpenAPI declaration file content or url

'''yaml components: schemas: Error: type: object required: - code - message properties: code: oneOf: - $ref: '#/components/schemas/ErrInternalError' - $ref: '#/components/schemas/ErrInvalidId' - $ref: '#/components/schemas/ErrCurrentlyNotAllowed' - $ref: '#/components/schemas/ErrApplicationNotLoadable' - $ref: '#/components/schemas/ErrApplicationNotAvailable' - $ref: '#/components/schemas/ErrItemDoesNotExist' message: type: string '''

Command line used for generation

java -ea -Xms512M -Xmx1024M -server -jar /home/fili/alpine/gernjo/openAPI/openapi-generator-cli-4.0.0-beta2.jar generate -i ./ontrestapi_device/ore_device.yaml -g cpp-pistache-server -o ./generated_server

Suggest a fix
  • Create one include-statement for each of the items listed under oneOf
  • Create one specific setter/getter method for each of the items listed under oneOf
Assignee
Assign to
Time tracking