davsclaus opened a new pull request, #28777:
URL: https://github.com/apache/camel/pull/28777

   [CAMEL-26442](https://issues.apache.org/jira/browse/CAMEL-26442)
   
   `camel generate rest --dto` generates the DTOs into a temporary directory 
and moved the directory of the package into the working directory with 
`File.renameTo`, which fails when:
   
   - the package has more than one name and its parent directory does not exist 
(`--package=org.acme` without `org/`): only `rest.yaml` was written;
   - the directory of the package exists, as when the command runs a second 
time;
   - the temporary directory is on another file system.
   
   The command then printed `ERROR: Failed to move generated DTOs to org/acme` 
and exited with `0`, and the temporary `gendto*` directory was left behind on 
every run.
   
   ## Changes
   
   - The DTOs are copied into the directory of their package 
(`CodeRestGenerator.copyDirectory`), which creates the directories, replaces a 
file of an earlier run and keeps the other files.
   - The temporary directory of the generator is removed afterwards.
   - A failure to write the DTOs exits with `1` (`ERROR: Failed to write the 
generated DTOs to <dir> - <reason>`).
   
   ## Tests
   
   The module had no tests; `CodeRestGeneratorTest` runs the generator on the 
petstore spec of camel-openapi-java:
   
   - the DTOs of `--package=org.acme` without `org/` are written, with `package 
org.acme;`, and no `gendto*` directory is left;
   - a second run replaces the DTOs and keeps a file that is not generated;
   - a file where the package directory would be makes the command exit with 
`1`;
   - `copyDirectory` creates the target with its parents.
   
   _Claude Code on behalf of davsclaus (Claus Ibsen)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_0128ThHB3iQdrvSRLVBGRrdP
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to