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
  • #586
Closed
Open
Issue created Jul 17, 2018 by Administrator@rootContributor

[all-languages] Supporting files duplicated

Created by: Peaches491

Description

Currently, all executions of openapi-generator produce a set of supportingFiles alongside the model/ and api/ files. If you have more than one openapi-generator spec target, these supportingFiles are completely identical, except for the namespace in which they are generated.

This prevents end-users from creating useful libraries or abstractions on top of the generated code, as each generated API uses these supportingFiles objects from different namespaces.

openapi-generator version

All versions.

Steps to reproduce

Generating two separate clients will produce a set of logically conflicting files. With no extra namespace provided, these files will create duplicate symbols when linked together:

openapi-generator generate --input-spec some_api.yaml --generator-name cpp-restsdk --output /tmp/some_api/

openapi-generator generate --input-spec some_other_api.yaml --generator-name cpp-restsdk --output /tmp/some_other_api/

Conflicting supporting files generated in both /tmp/some_api and /tmp/some_other_api/:

├── ApiClient.cpp
├── ApiClient.h
├── ApiConfiguration.cpp
├── ApiConfiguration.h
├── ApiException.cpp
├── ApiException.h
├── CMakeLists.txt
├── HttpContent.cpp
├── HttpContent.h
├── IHttpBody.h
├── JsonBody.cpp
├── JsonBody.h
├── ModelBase.cpp
├── ModelBase.h
├── MultipartFormData.cpp
├── MultipartFormData.h
├── Object.cpp
├── Object.h
├── api
│   └── ...
└── model
    ├── ...
Related issues/PRs

This issue was partially addressed in PR #580, where the cpp-restsdk generator was augmented to take a supportingFilesDirectory and supportingFilesNamespace. That way, a client could be generated with references (i.e. #includes) a set of external supporting files, under the given directory and the given namespace.

Suggest a fix/enhancement

Unfortunately, the solution in #580 is not a complete solution. A complete solution would require the following:

[ ] A way for users to (optionally) generate only supporting files, using a specified namespace [ ] A parameter to client generation which prevents the creation of supporting files if an external set of supporting files is specified.

Assignee
Assign to
Time tracking