CAUTION! 
This article shows how to use the Clean Generated command, which removes all files from the configured output folder, and all of its subfolders.  This normally should include only generated files.  But if you have manually edited or added files any of the output folders, those files will also be deleted.


Stale Generated Files

When you run code generation in RepreZen API Studio, any files in the configured output folder will be overwritten by newly generated files of the same name.  But in some cases old files will remain.  For example, if you removed or renamed a path item in your source RAPID-ML or Swagger-OpenAPI specification, a generated file for the old path item may remain in the generated output folder. 


Cleaning Up Generated Files

You can remove these generated files using the Clean Generated command in the context menu:


The Clean Generated command operates on a GenTarget folder, or a parent folder containing one or more GenTargets.  It will delete the configured output directory directory, and all of its contents, for each GenTarget within the selected scope. 


By default, GenTargets are configured to write generated output into a subfolder named 'generated' under the GenTarget folder.  You con override this default by specifying a different value for the relativeOutputDir in the .gen configuration file: 



Clean Generated will remove the configured folder specified in each of the in-scope GenTargets. 


Recommended Practices

We recommend the following precautions:

  • Keep manual code in a separate location from generated code.  Wherever possible, the best way to avoid accidental deletion of manually edited files is to keep them in a separate location, outside of the configured output folder.
     
  • Use version control.  RepreZen API Studio supports integration with git and other version control systems. Keeping your entire project in version control is recommended. For the best possible protection, include generated files in version control, and commit and push frequently to the central repository.