You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Federico Mariani (Jira)" <ji...@apache.org> on 2024/02/07 16:36:00 UTC

[jira] [Created] (CAMEL-20394) camel-jbang wrong rests and routes transformation

Federico Mariani created CAMEL-20394:
----------------------------------------

             Summary: camel-jbang wrong rests and routes transformation
                 Key: CAMEL-20394
                 URL: https://issues.apache.org/jira/browse/CAMEL-20394
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
    Affects Versions: 4.3.0
            Reporter: Federico Mariani


The following yaml

{code:yaml}
- rest:
    id: rest-c658
    get:
      - id: get-2028
        to: direct:start
- route:
    id: route-a41e
    nodePrefixId: route-7fd
    from:
      id: from-131e
      uri: direct
      parameters:
        name: start
      steps:
        - setBody:
            id: setBody-31fe
            expression:
              simple:
                id: simple-56a9
                expression: ${headers.CamelFtpReplyCode}
        - log:
            id: log-793d
            message: ${body}
{code}
is transformed, via 
{code:bash}
camel transform route --format=xml test.yaml
{code}
into the following XML

{code:xml}
<camel>
    <route id="route-a41e" nodePrefixId="route-7fd">
        <from id="from-131e" uri="direct:start"/>
        <setBody id="setBody-31fe">
            <simple>${headers.CamelFtpReplyCode}</simple>
        </setBody>
        <log id="log-793d" message="${body}"/>
    </route>

<rests>
    <rest id="rest-c658">
        <get id="get-2028">
            <to uri="direct:start"/>
        </get>
    </rest>
</rests>
</camel>
{code}
the _rests_ section does not work as is, in particular the _camel run_ fails with the following error _XmlPullParserException: Unexpected element '{}rests'_.

Removing <rests> tag, _camel run_ works as expected
{code:xml}
<camel>
    <route id="route-a41e" nodePrefixId="route-7fd">
        <from id="from-131e" uri="direct:start"/>
        <setBody id="setBody-31fe">
            <simple>${headers.CamelFtpReplyCode}</simple>
        </setBody>
        <log id="log-793d" message="${body}"/>
    </route>

    <rest id="rest-c658">
        <get id="get-2028">
            <to uri="direct:start"/>
        </get>
    </rest>
</camel>
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)