[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.