java-camel-server.validation.mustache Maven / Gradle / Ivy
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) ({{{generatorVersion}}}).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package {{apiPackage}};
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
@Component
public class {{classname}}Validator extends RouteBuilder {
@Override
public void configure() throws Exception {
onException(Exception.class)
.log(LoggingLevel.ERROR, "${exception.message}: ${exception.stacktrace}")
.handled(true)
.process("{{camelValidationErrorProcessor}}");
{{#operations}}{{#operation}}
from("direct:validate-{{operationId}}")
.id("validate-{{operationId}}"){{#hasConsumes}}
.to("bean-validator://validate-request"){{/hasConsumes}}
.to("direct:{{operationId}}"){{^hasProduces}};{{/hasProduces}}{{#hasProduces}}
.to("bean-validator://validate-response");{{/hasProduces}}
{{/operation}}{{/operations}}
}
}