You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of 1.0.17, becuase the DefaultCodegenConfig#apiFilename method uses File.separator to concatenate the filename, an issue occurs on windows that causes the generator to create files with incorrect package structures. This is a problem because some classes are expected to be in the same package, and this could also break ignore rules, leading to duplicate classes and other compilation issues. In the java JAX-RS generator, we check for a '/', causing the index to be inaccurate on Windows (or any other OS that doesn't use / as the file path separator), resulting in a the substring and replace calls not doing what is intended. The same happens in the Factory.mustache branch of the if statement.
We should use File.separator everywhere we are forming/checking file paths. Otherwise, we run the risk of assuming the OS the project is running on, and breaking compilation due to malformed paths.
The text was updated successfully, but these errors were encountered:
Ok, I was thinking I would revert that line before making bigger changes but maybe not. I'll update the Jax-RS generator to use the File.separator when checking filenames in this workflow
will-thurman
pushed a commit
to will-thurman/swagger-codegen-generators
that referenced
this issue
Mar 16, 2020
As of 1.0.17, becuase the DefaultCodegenConfig#apiFilename method uses
File.separator
to concatenate the filename, an issue occurs on windows that causes the generator to create files with incorrect package structures. This is a problem because some classes are expected to be in the same package, and this could also break ignore rules, leading to duplicate classes and other compilation issues. In the java JAX-RS generator, we check for a'/'
, causing the index to be inaccurate on Windows (or any other OS that doesn't use/
as the file path separator), resulting in a the substring and replace calls not doing what is intended. The same happens in theFactory.mustache
branch of the if statement.We should use
File.separator
everywhere we are forming/checking file paths. Otherwise, we run the risk of assuming the OS the project is running on, and breaking compilation due to malformed paths.The text was updated successfully, but these errors were encountered: