jboss-fuse / fuse-apicurito-generator

Fuse Apicurito Generator
5 stars 14 forks source link

Generated Spring XML DSL is not a valid XML #27

Closed zregvart closed 5 years ago

zregvart commented 5 years ago

The generated Spring XML DSL (src/main/resources/camel-context.xml) is not valid, there is a superfluous` opening tag:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/spring       http://camel.apache.org/schema/spring/camel-spring.xsd">

    <camelContext xmlns="http://camel.apache.org/schema/spring">

        <onException>
            <exception>java.lang.Exception</exception>
            <handled><constant>true</constant></handled>
            <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
                <constant>500</constant>
            </setHeader>
            <setBody>
                <simple>${exception.message}</simple>
            </setBody>
        </onException>

        <restConfiguration component="servlet"/>

        <rest path="/" enableCORS="true">
            <get id="openapi.json" produces="application/json" uri="openapi.json">
                <description>Gets the openapi document for this service</description>
                <route>
                    <setBody>
                        <simple>resource:classpath:openapi.json</simple>
                    </setBody>
                </route>
            </get>
        </rest>

        <rest path="/api" bindingMode="json" enableCORS="true">

        <rest> <!-- HERE -->
            <get uri="/{id}">
                <description>Fetches task by given identifier</description>
                <param dataType="integer" description="Task identifier" name="id" required="true" type="path"/>
                <to uri="direct:rest1"/>
            </get>
        </rest>

        <route>
            <from uri="direct:rest1"/>
            <to uri="direct:501"/>
        </route>

        <route>
            <from uri="direct:501"/>
            <log message="API operation not yet implemented: ${headers.CamelHttpMethod} ${headers.CamelHttpPath}"/>
            <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
                <constant>501</constant>
            </setHeader>
            <setBody><simple>API operation not implemented: ${headers.CamelHttpMethod} ${headers.CamelHttpPath}</simple></setBody>
        </route>

    </camelContext>
</beans>

36, 15: cvc-complex-type.2.4.a:  Invalid content was found starting with element 'rest'. One of  '{"http://camel.apache.org/schema/spring":description,  "http://camel.apache.org/schema/spring":verb,  "http://camel.apache.org/schema/spring":delete,  "http://camel.apache.org/schema/spring":get,  "http://camel.apache.org/schema/spring":head,  "http://camel.apache.org/schema/spring":options,  "http://camel.apache.org/schema/spring":patch,  "http://camel.apache.org/schema/spring":post,  "http://camel.apache.org/schema/spring":put}' is expected.
58, 7: The element type "rest" must be terminated by the matching end-tag "</rest>".