[
https://issues.apache.org/jira/browse/CAMEL-26442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135935#comment-18135935
]
Claus Ibsen commented on CAMEL-26442:
-------------------------------------
Fixed via https://github.com/apache/camel/pull/28777
_Claude Code on behalf of Claus Ibsen_
> camel-jbang - camel generate rest --dto does not write the DTOs of a package
> with more than one name, or when they exist
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26442
> URL: https://issues.apache.org/jira/browse/CAMEL-26442
> Project: Camel
> Issue Type: Bug
> Components: camel-jbang
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> {{camel generate rest --dto}} generates the DTOs into a temporary directory,
> and moves the directory of the package to the working directory with
> {{File.renameTo}} ({{CodeRestGenerator.generateDto}}). That fails, and the
> DTOs are not written:
> * when the package has more than one name and its parent directory does not
> exist ({{--package=org.acme}} without a directory {{org}}): {{renameTo}} does
> not create parent directories;
> * when the directory of the package exists, such as when the command runs a
> second time;
> * when the temporary directory is on another file system than the working
> directory (such as a {{/tmp}} on tmpfs).
> The command then prints {{ERROR: Failed to move generated DTOs to org/acme}}
> but exits with {{0}}, and leaves the temporary {{gendto*}} directory behind
> (also when the move works, as only its subdirectory is moved).
> Reproduce (with
> {{components/camel-openapi-java/src/test/resources/petstore-v3.json}}):
> {code}
> camel generate rest --input=petstore-v3.json --dto --output=rest.yaml
> --package=org.acme
> {code}
> It writes {{rest.yaml}} only, and exits with 0. With {{mkdir org}} first it
> writes the 8 DTOs into {{org/acme}}; running it again fails the same way. The
> default package ({{model}}) works the first time.
> Expected: the DTOs are written (creating the directories, replacing the files
> of an earlier run), the temporary directory is removed, and a failure exits
> with a non-zero exit code.
> Found while checking CAMEL-26441.
> _Claude Code on behalf of davsclaus (Claus Ibsen)_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)