Open
Description
Bug Report Checklist
- What's the version of OpenAPI Generator used?
v4.1.3+ - Have you search for related issues/PRs?
Description
If an api is updated and for example some model names changed which results into a new file the old file which is no longer needed is not removed thus the project accumulates garbage files.
openapi-generator version
v4.1.3+
Steps to reproduce
Generate a client/server, rename a model, regenerate. The old model name will still be existent.
Related issues/PRs
- [FIX][WIP][CORE] Bug/golden test ignoring deleted files #4030
- Add a check enforce "samples/" folder to be up-to-date #80 (comment)
Suggest a fix
I talked with @jimschubert about this issue and he suggested to keep track of previously generated files which would result in following scenario:
- On generation collect all files which were generated and persist those alongside the openapi generator version in .openapi.
- On generation check if an old file list is available, delete all those files, generate code with new file list and warn about every file which is in the same directory as generated code but was not deleted since these could be outdated files. Do not delete a file if it is referenced in openapi-ignore.