This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/master by this push: new 4702f78 [yaml] cleanup schema generator leftovers 4702f78 is described below commit 4702f78b6028031134dc745a20a273ff3569e38d Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Fri Jul 10 14:30:38 2020 +0200 [yaml] cleanup schema generator leftovers --- .../k/loader/yaml/parser/AggregateStepParser.java | 2 +- .../k/loader/yaml/parser/ChoiceStepParser.java | 2 +- .../yaml/parser/CircuitBreakerStepParser.java | 2 +- .../k/loader/yaml/parser/DelayStepParser.java | 2 +- .../k/loader/yaml/parser/DoTryStepParser.java | 2 +- .../yaml/parser/DynamicRouterStepParser.java | 2 +- .../k/loader/yaml/parser/EnrichStepParser.java | 2 +- .../loader/yaml/parser/ErrorHandlerStepParser.java | 4 +-- .../k/loader/yaml/parser/FilterStepParser.java | 2 +- .../camel/k/loader/yaml/parser/FromStepParser.java | 5 ++- .../yaml/parser/IdempotentConsumerParser.java | 2 +- .../loader/yaml/parser/LoadBalanceStepParser.java | 2 +- .../camel/k/loader/yaml/parser/LoopStepParser.java | 2 +- .../k/loader/yaml/parser/MarshalStepParser.java | 2 +- .../k/loader/yaml/parser/MulticastStepParser.java | 2 +- .../loader/yaml/parser/OnExceptionStepParser.java | 4 +-- .../k/loader/yaml/parser/PipelineStepParser.java | 2 +- .../k/loader/yaml/parser/PollEnrichStepParser.java | 2 +- .../k/loader/yaml/parser/ProcessStepParser.java | 2 +- .../yaml/parser/RecipientListStepParser.java | 2 +- .../k/loader/yaml/parser/ResequenceStepParser.java | 2 +- .../camel/k/loader/yaml/parser/RestStepParser.java | 5 ++- .../k/loader/yaml/parser/RouteStepParser.java | 5 ++- .../loader/yaml/parser/RoutingSlipStepParser.java | 2 +- .../camel/k/loader/yaml/parser/SagaStepParser.java | 2 +- .../k/loader/yaml/parser/SampleStepParser.java | 2 +- .../k/loader/yaml/parser/ScriptStepParser.java | 2 +- .../loader/yaml/parser/ServiceCallStepParser.java | 2 +- .../k/loader/yaml/parser/SetBodyStepParser.java | 2 +- .../yaml/parser/SetExchangePatternStepParser.java | 2 +- .../k/loader/yaml/parser/SetHeaderStepParser.java | 2 +- .../loader/yaml/parser/SetPropertyStepParser.java | 2 +- .../camel/k/loader/yaml/parser/SortStepParser.java | 2 +- .../k/loader/yaml/parser/SplitStepParser.java | 2 +- .../camel/k/loader/yaml/parser/StepStepParser.java | 2 +- .../k/loader/yaml/parser/ThrottleStepParser.java | 2 +- .../yaml/parser/ThrowExceptionStepParser.java | 2 +- .../k/loader/yaml/parser/ToDynamicStepParser.java | 2 +- .../camel/k/loader/yaml/parser/ToStepParser.java | 2 +- .../k/loader/yaml/parser/TransactedStepParser.java | 2 +- .../k/loader/yaml/parser/TransformStepParser.java | 2 +- .../k/loader/yaml/parser/UnmarshalStepParser.java | 2 +- .../k/loader/yaml/parser/ValidateStepParser.java | 2 +- .../k/loader/yaml/parser/WireTapStepParser.java | 2 +- .../camel/k/loader/yaml/spi/StartStepParser.java | 9 +++-- .../apache/camel/k/loader/yaml/spi/StepParser.java | 24 +++++++++++++ .../apache/camel/k/loader/yaml/TestSupport.groovy | 4 +-- .../k/loader/yaml/parser/ErrorHandlerTest.groovy | 8 ++--- .../camel/k/loader/yaml/parser/FromTest.groovy | 4 +-- .../k/loader/yaml/parser/OnExceptionTest.groovy | 2 +- .../camel/k/loader/yaml/parser/RestTest.groovy | 8 ++--- .../camel/k/loader/yaml/support/MyBean.groovy} | 25 +++++-------- .../quarkus/deployment/DeploymentProcessor.java | 2 -- .../k/knative/yaml/parser/KnativeStepParser.java | 2 +- .../camel/k/annotation/yaml/YAMLStepParser.java | 3 +- .../camel/k/tooling/maven/GenerateYamlSchema.java | 42 ++++++++++++---------- 56 files changed, 125 insertions(+), 109 deletions(-) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/AggregateStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/AggregateStepParser.java index 92dfbd5..6955a93 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/AggregateStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/AggregateStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.language.ExpressionDefinition; import org.apache.camel.reifier.AggregateReifier; -@YAMLStepParser(id = "aggregate", definitions = AggregateStepParser.Definition.class) +@YAMLStepParser(id = "aggregate", definition = AggregateStepParser.Definition.class) public class AggregateStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ChoiceStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ChoiceStepParser.java index b895493..96e15d5 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ChoiceStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ChoiceStepParser.java @@ -29,7 +29,7 @@ import org.apache.camel.model.OtherwiseDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.WhenDefinition; -@YAMLStepParser(id = "choice", definitions = ChoiceStepParser.Definition.class) +@YAMLStepParser(id = "choice", definition = ChoiceStepParser.Definition.class) public class ChoiceStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/CircuitBreakerStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/CircuitBreakerStepParser.java index 3bb2d42..685b1ec 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/CircuitBreakerStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/CircuitBreakerStepParser.java @@ -34,7 +34,7 @@ import org.apache.camel.model.Resilience4jConfigurationDefinition; import org.apache.camel.reifier.CircuitBreakerReifier; import org.apache.camel.reifier.OnFallbackReifier; -@YAMLStepParser(id = "circuit-breaker", definitions = CircuitBreakerStepParser.CBDefinition.class) +@YAMLStepParser(id = "circuit-breaker", definition = CircuitBreakerStepParser.CBDefinition.class) public class CircuitBreakerStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DelayStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DelayStepParser.java index a372828..7ba308b 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DelayStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DelayStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.DelayDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.DelayReifier; -@YAMLStepParser(id = "delay", definitions = DelayStepParser.Definition.class) +@YAMLStepParser(id = "delay", definition = DelayStepParser.Definition.class) public class DelayStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DoTryStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DoTryStepParser.java index 249b78c..c608552 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DoTryStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DoTryStepParser.java @@ -34,7 +34,7 @@ import org.apache.camel.reifier.CatchReifier; import org.apache.camel.reifier.FinallyReifier; import org.apache.camel.reifier.TryReifier; -@YAMLStepParser(id = "do-try", definitions = DoTryStepParser.DoTryDefinition.class) +@YAMLStepParser(id = "do-try", definition = DoTryStepParser.DoTryDefinition.class) public class DoTryStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DynamicRouterStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DynamicRouterStepParser.java index 88a65a9..35fa580 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DynamicRouterStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/DynamicRouterStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.DynamicRouterDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.DynamicRouterReifier; -@YAMLStepParser(id = "dynamic-router", definitions = DynamicRouterStepParser.Definition.class) +@YAMLStepParser(id = "dynamic-router", definition = DynamicRouterStepParser.Definition.class) public class DynamicRouterStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/EnrichStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/EnrichStepParser.java index d3e0948..a2f279b 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/EnrichStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/EnrichStepParser.java @@ -26,7 +26,7 @@ import org.apache.camel.model.EnrichDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.EnrichReifier; -@YAMLStepParser(id = "enrich", definitions = EnrichStepParser.Definition.class) +@YAMLStepParser(id = "enrich", definition = EnrichStepParser.Definition.class) public class EnrichStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ErrorHandlerStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ErrorHandlerStepParser.java index fff1a2c..f4c10ca 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ErrorHandlerStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ErrorHandlerStepParser.java @@ -30,10 +30,10 @@ import org.apache.camel.k.loader.yaml.spi.StepParserSupport; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.RouteDefinition; -@YAMLStepParser(id = "error-handler", definitions = ErrorHandlerStepParser.Definition.class) +@YAMLStepParser(id = "error-handler", definition = ErrorHandlerStepParser.Definition.class) public class ErrorHandlerStepParser implements StartStepParser, ProcessorStepParser { @Override - public ProcessorDefinition<?> toStartProcessor(Context context) { + public Object process(Context context) { final Definition definition = context.node(Definition.class); StepParserSupport.notNull(definition.builder, "builder"); diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FilterStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FilterStepParser.java index e23afc1..cb7ef13 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FilterStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FilterStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.FilterDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.FilterReifier; -@YAMLStepParser(id = "filter", definitions = FilterStepParser.Definition.class) +@YAMLStepParser(id = "filter", definition = FilterStepParser.Definition.class) public class FilterStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java index e517763..de986c0 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java @@ -28,14 +28,13 @@ import org.apache.camel.k.annotation.yaml.YAMLStepParser; import org.apache.camel.k.loader.yaml.model.Step; import org.apache.camel.k.loader.yaml.spi.StartStepParser; import org.apache.camel.k.loader.yaml.spi.StepParserSupport; -import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.RouteDefinition; import org.apache.camel.util.URISupport; -@YAMLStepParser(id = "from", definitions = FromStepParser.Definition.class) +@YAMLStepParser(id = "from", definition = FromStepParser.Definition.class) public class FromStepParser implements StartStepParser { @Override - public ProcessorDefinition<?> toStartProcessor(Context context) { + public Object process(Context context) { final Definition definition = context.node(Definition.class); final String uri = definition.getEndpointUri(); final RouteDefinition route = context.builder().from(uri); diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/IdempotentConsumerParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/IdempotentConsumerParser.java index aa6ff77..806ce65 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/IdempotentConsumerParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/IdempotentConsumerParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.IdempotentConsumerDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.IdempotentConsumerReifier; -@YAMLStepParser(id = "idempotent-consumer", definitions = IdempotentConsumerParser.Definition.class) +@YAMLStepParser(id = "idempotent-consumer", definition = IdempotentConsumerParser.Definition.class) public class IdempotentConsumerParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoadBalanceStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoadBalanceStepParser.java index 9f854c8..c13c1ff 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoadBalanceStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoadBalanceStepParser.java @@ -42,7 +42,7 @@ import org.apache.camel.model.loadbalancer.TopicLoadBalancerDefinition; import org.apache.camel.model.loadbalancer.WeightedLoadBalancerDefinition; import org.apache.camel.reifier.LoadBalanceReifier; -@YAMLStepParser(id = "load-balance", definitions = LoadBalanceStepParser.Definition.class) +@YAMLStepParser(id = "load-balance", definition = LoadBalanceStepParser.Definition.class) public class LoadBalanceStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoopStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoopStepParser.java index 4a72084..5aa6f3b 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoopStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/LoopStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.LoopDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.LoopReifier; -@YAMLStepParser(id = "loop", definitions = LoopStepParser.Definition.class) +@YAMLStepParser(id = "loop", definition = LoopStepParser.Definition.class) public class LoopStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MarshalStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MarshalStepParser.java index 520e4d0..c2ad0e5 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MarshalStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MarshalStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.MarshalDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.MarshalReifier; -@YAMLStepParser(id = "marshal", definitions = MarshalStepParser.Definition.class) +@YAMLStepParser(id = "marshal", definition = MarshalStepParser.Definition.class) public class MarshalStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MulticastStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MulticastStepParser.java index f226900..10248c6 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MulticastStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/MulticastStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.MulticastDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.MulticastReifier; -@YAMLStepParser(id = "multicast", definitions = MulticastStepParser.Definition.class) +@YAMLStepParser(id = "multicast", definition = MulticastStepParser.Definition.class) public class MulticastStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/OnExceptionStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/OnExceptionStepParser.java index 5408414..f734a9c 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/OnExceptionStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/OnExceptionStepParser.java @@ -37,11 +37,11 @@ import org.apache.camel.reifier.OnExceptionReifier; import static org.apache.camel.util.ObjectHelper.ifNotEmpty; -@YAMLStepParser(id = "on-exception", definitions = OnExceptionStepParser.Definition.class) +@YAMLStepParser(id = "on-exception", definition = OnExceptionStepParser.Definition.class) public class OnExceptionStepParser implements StartStepParser, ProcessorStepParser { @SuppressWarnings("unchecked") @Override - public ProcessorDefinition<?> toStartProcessor(Context context) { + public Object process(Context context) { final Definition definition = context.node(Definition.class); final OnExceptionDefinition onException = context.builder().onException(); diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PipelineStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PipelineStepParser.java index ce82308..e3835de 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PipelineStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PipelineStepParser.java @@ -27,7 +27,7 @@ import org.apache.camel.k.loader.yaml.spi.StepParserSupport; import org.apache.camel.model.PipelineDefinition; import org.apache.camel.model.ProcessorDefinition; -@YAMLStepParser(id = "pipeline", definitions = PipelineStepParser.Definition.class) +@YAMLStepParser(id = "pipeline", definition = PipelineStepParser.Definition.class) public class PipelineStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PollEnrichStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PollEnrichStepParser.java index ba77c59..ec82f9e 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PollEnrichStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/PollEnrichStepParser.java @@ -25,7 +25,7 @@ import org.apache.camel.model.PollEnrichDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.PollEnrichReifier; -@YAMLStepParser(id = "poll-enrich", definitions = PollEnrichStepParser.Definition.class) +@YAMLStepParser(id = "poll-enrich", definition = PollEnrichStepParser.Definition.class) public class PollEnrichStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ProcessStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ProcessStepParser.java index 4a008bd..40f260a 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ProcessStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ProcessStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessDefinition; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.reifier.ProcessReifier; -@YAMLStepParser(id = "process", definitions = ProcessStepParser.Definition.class) +@YAMLStepParser(id = "process", definition = ProcessStepParser.Definition.class) public class ProcessStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RecipientListStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RecipientListStepParser.java index 104433f..d133563 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RecipientListStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RecipientListStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.RecipientListDefinition; import org.apache.camel.reifier.RecipientListReifier; -@YAMLStepParser(id = "recipient-list", definitions = RecipientListStepParser.Definition.class) +@YAMLStepParser(id = "recipient-list", definition = RecipientListStepParser.Definition.class) public class RecipientListStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ResequenceStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ResequenceStepParser.java index c49d7c4..d3ad79f 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ResequenceStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ResequenceStepParser.java @@ -33,7 +33,7 @@ import org.apache.camel.model.config.BatchResequencerConfig; import org.apache.camel.model.config.StreamResequencerConfig; import org.apache.camel.reifier.ResequenceReifier; -@YAMLStepParser(id = "resequence", definitions = ResequenceStepParser.Definition.class) +@YAMLStepParser(id = "resequence", definition = ResequenceStepParser.Definition.class) public class ResequenceStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RestStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RestStepParser.java index 3bdedca..5b97c71 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RestStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RestStepParser.java @@ -26,15 +26,14 @@ import org.apache.camel.k.annotation.yaml.YAMLStepParser; import org.apache.camel.k.loader.yaml.model.Step; import org.apache.camel.k.loader.yaml.spi.StartStepParser; import org.apache.camel.k.loader.yaml.spi.StepParserSupport; -import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.rest.RestBindingMode; import org.apache.camel.model.rest.RestDefinition; import org.apache.camel.util.ObjectHelper; -@YAMLStepParser(id = "rest", definitions = RestStepParser.Definition.class) +@YAMLStepParser(id = "rest", definition = RestStepParser.Definition.class) public class RestStepParser implements StartStepParser { @Override - public ProcessorDefinition<?> toStartProcessor(Context context) { + public Object process(Context context) { Definition definition = context.node(Definition.class); StepParserSupport.notNull(definition.uri, "uri"); diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java index acb76cc..b78dc03 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java @@ -28,15 +28,14 @@ import org.apache.camel.k.annotation.yaml.YAMLStepParser; import org.apache.camel.k.loader.yaml.model.Step; import org.apache.camel.k.loader.yaml.spi.StartStepParser; import org.apache.camel.k.loader.yaml.spi.StepParserSupport; -import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.RouteDefinition; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.URISupport; -@YAMLStepParser(id = "route", definitions = RouteStepParser.Definition.class) +@YAMLStepParser(id = "route", definition = RouteStepParser.Definition.class) public class RouteStepParser implements StartStepParser { @Override - public ProcessorDefinition<?> toStartProcessor(Context context) { + public Object process(Context context) { final Definition definition = context.node(Definition.class); final String uri = definition.from.getEndpointUri(); final RouteDefinition route = context.builder().from(uri); diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RoutingSlipStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RoutingSlipStepParser.java index 3b6ae84..36bb2fc 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RoutingSlipStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RoutingSlipStepParser.java @@ -24,7 +24,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.RoutingSlipDefinition; import org.apache.camel.reifier.RoutingSlipReifier; -@YAMLStepParser(id = "routing-slip", definitions = RoutingSlipStepParser.Definition.class) +@YAMLStepParser(id = "routing-slip", definition = RoutingSlipStepParser.Definition.class) public class RoutingSlipStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SagaStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SagaStepParser.java index 79d9208..ff15a3d 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SagaStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SagaStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SagaDefinition; import org.apache.camel.reifier.SagaReifier; -@YAMLStepParser(id = "saga", definitions = SagaStepParser.Definition.class) +@YAMLStepParser(id = "saga", definition = SagaStepParser.Definition.class) public class SagaStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SampleStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SampleStepParser.java index 4afae6e..72fd80b 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SampleStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SampleStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SamplingDefinition; import org.apache.camel.reifier.SamplingReifier; -@YAMLStepParser(id = "sample", definitions = SampleStepParser.Definition.class) +@YAMLStepParser(id = "sample", definition = SampleStepParser.Definition.class) public class SampleStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ScriptStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ScriptStepParser.java index 3f5861e..c764472 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ScriptStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ScriptStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ScriptDefinition; import org.apache.camel.reifier.ScriptReifier; -@YAMLStepParser(id = "script", definitions = ScriptStepParser.Definition.class) +@YAMLStepParser(id = "script", definition = ScriptStepParser.Definition.class) public class ScriptStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ServiceCallStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ServiceCallStepParser.java index baf3559..97678df 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ServiceCallStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ServiceCallStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.cloud.ServiceCallServiceFilterConfiguration; import org.apache.camel.model.cloud.ServiceCallServiceLoadBalancerConfiguration; import org.apache.camel.model.language.ExpressionDefinition; -@YAMLStepParser(id = "service-call", definitions = ServiceCallStepParser.Definition.class) +@YAMLStepParser(id = "service-call", definition = ServiceCallStepParser.Definition.class) public class ServiceCallStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetBodyStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetBodyStepParser.java index 3b09cc5..e0c297a 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetBodyStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetBodyStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SetBodyDefinition; import org.apache.camel.reifier.SetBodyReifier; -@YAMLStepParser(id = "set-body", definitions = SetBodyStepParser.Definition.class) +@YAMLStepParser(id = "set-body", definition = SetBodyStepParser.Definition.class) public class SetBodyStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetExchangePatternStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetExchangePatternStepParser.java index aa6bc6a..f109509 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetExchangePatternStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetExchangePatternStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SetExchangePatternDefinition; import org.apache.camel.reifier.SetExchangePatternReifier; -@YAMLStepParser(id = "set-exchange-pattern", definitions = SetExchangePatternStepParser.Definition.class) +@YAMLStepParser(id = "set-exchange-pattern", definition = SetExchangePatternStepParser.Definition.class) public class SetExchangePatternStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetHeaderStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetHeaderStepParser.java index 3db6601..e34514b 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetHeaderStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetHeaderStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SetHeaderDefinition; import org.apache.camel.reifier.SetHeaderReifier; -@YAMLStepParser(id = "set-header", definitions = SetHeaderStepParser.Definition.class) +@YAMLStepParser(id = "set-header", definition = SetHeaderStepParser.Definition.class) public class SetHeaderStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetPropertyStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetPropertyStepParser.java index 3a7ccdf..a3362fb 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetPropertyStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SetPropertyStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SetPropertyDefinition; import org.apache.camel.reifier.SetPropertyReifier; -@YAMLStepParser(id = "set-property", definitions = SetPropertyStepParser.Definition.class) +@YAMLStepParser(id = "set-property", definition = SetPropertyStepParser.Definition.class) public class SetPropertyStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SortStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SortStepParser.java index a46f55c..25fb12d 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SortStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SortStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SortDefinition; import org.apache.camel.reifier.SortReifier; -@YAMLStepParser(id = "sort", definitions = SortStepParser.Definition.class) +@YAMLStepParser(id = "sort", definition = SortStepParser.Definition.class) public class SortStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SplitStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SplitStepParser.java index 433e8d2..e5661c1 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SplitStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/SplitStepParser.java @@ -28,7 +28,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.SplitDefinition; import org.apache.camel.reifier.SplitReifier; -@YAMLStepParser(id = "split", definitions = SplitStepParser.Definition.class) +@YAMLStepParser(id = "split", definition = SplitStepParser.Definition.class) public class SplitStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/StepStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/StepStepParser.java index e843af2..7ddd352 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/StepStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/StepStepParser.java @@ -27,7 +27,7 @@ import org.apache.camel.k.loader.yaml.spi.StepParserSupport; import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.StepDefinition; -@YAMLStepParser(id = "step", definitions = StepStepParser.Definition.class) +@YAMLStepParser(id = "step", definition = StepStepParser.Definition.class) public class StepStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrottleStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrottleStepParser.java index 24e53a1..6d958f3 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrottleStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrottleStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ThrottleDefinition; import org.apache.camel.reifier.ThrottleReifier; -@YAMLStepParser(id = "throttle", definitions = ThrottleStepParser.Definition.class) +@YAMLStepParser(id = "throttle", definition = ThrottleStepParser.Definition.class) public class ThrottleStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrowExceptionStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrowExceptionStepParser.java index 96c3303..66a7cb5 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrowExceptionStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ThrowExceptionStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ThrowExceptionDefinition; import org.apache.camel.reifier.ThrowExceptionReifier; -@YAMLStepParser(id = "throw-exception", definitions = ThrowExceptionStepParser.Definition.class) +@YAMLStepParser(id = "throw-exception", definition = ThrowExceptionStepParser.Definition.class) public class ThrowExceptionStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java index a3dddca..932f3b6 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java @@ -29,7 +29,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ToDynamicDefinition; import org.apache.camel.util.URISupport; -@YAMLStepParser(id = "tod", definitions = ToDynamicStepParser.Definition.class) +@YAMLStepParser(id = "tod", definition = ToDynamicStepParser.Definition.class) public class ToDynamicStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java index b46960d..6308084 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java @@ -29,7 +29,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ToDefinition; import org.apache.camel.util.URISupport; -@YAMLStepParser(id = "to", definitions = ToStepParser.Definition.class) +@YAMLStepParser(id = "to", definition = ToStepParser.Definition.class) public class ToStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransactedStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransactedStepParser.java index 5b338fb..aa192b1 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransactedStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransactedStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.TransactedDefinition; import org.apache.camel.reifier.TransactedReifier; -@YAMLStepParser(id = "transacted", definitions = TransactedStepParser.Definition.class) +@YAMLStepParser(id = "transacted", definition = TransactedStepParser.Definition.class) public class TransactedStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransformStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransformStepParser.java index b200c75..13050d4 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransformStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/TransformStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.TransformDefinition; import org.apache.camel.reifier.TransformReifier; -@YAMLStepParser(id = "transform", definitions = TransformStepParser.Definition.class) +@YAMLStepParser(id = "transform", definition = TransformStepParser.Definition.class) public class TransformStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/UnmarshalStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/UnmarshalStepParser.java index 613cfb7..02f01cf 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/UnmarshalStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/UnmarshalStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.UnmarshalDefinition; import org.apache.camel.reifier.UnmarshalReifier; -@YAMLStepParser(id = "unmarshal", definitions = UnmarshalStepParser.Definition.class) +@YAMLStepParser(id = "unmarshal", definition = UnmarshalStepParser.Definition.class) public class UnmarshalStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ValidateStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ValidateStepParser.java index 424c9f6..c3062da 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ValidateStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ValidateStepParser.java @@ -23,7 +23,7 @@ import org.apache.camel.model.ProcessorDefinition; import org.apache.camel.model.ValidateDefinition; import org.apache.camel.reifier.ValidateReifier; -@YAMLStepParser(id = "validate", definitions = ValidateStepParser.Definition.class) +@YAMLStepParser(id = "validate", definition = ValidateStepParser.Definition.class) public class ValidateStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java index 2cd5f28..2b44652 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java @@ -35,7 +35,7 @@ import org.apache.camel.reifier.WireTapReifier; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.URISupport; -@YAMLStepParser(id = "wiretap", definitions = WireTapStepParser.Definition.class) +@YAMLStepParser(id = "wiretap", definition = WireTapStepParser.Definition.class) public class WireTapStepParser implements ProcessorStepParser { @Override public ProcessorDefinition<?> toProcessor(Context context) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StartStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StartStepParser.java index 10426a2..6f0bb19 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StartStepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StartStepParser.java @@ -16,16 +16,15 @@ */ package org.apache.camel.k.loader.yaml.spi; -import org.apache.camel.model.ProcessorDefinition; - @FunctionalInterface public interface StartStepParser extends StepParser { /** * @param context + * @return */ - ProcessorDefinition<?> toStartProcessor(Context context); + Object process(Context context); - static ProcessorDefinition<?> invoke(Context context, String stepId) { - return context.lookup(StartStepParser.class, stepId).toStartProcessor(context); + static Object invoke(Context context, String stepId) { + return context.lookup(StartStepParser.class, stepId).process(context); } } diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StepParser.java index b8f62be..5009dae 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StepParser.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/spi/StepParser.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.CamelContext; @@ -71,6 +72,10 @@ public interface StepParser { return node; } + public ObjectMapper mapper() { + return this.mapper; + } + public <T> T node(Class<T> type) { ObjectHelper.notNull(node, "node"); ObjectHelper.notNull(type, "type"); @@ -90,6 +95,25 @@ public interface StepParser { return definition; } + public <T> T node(TypeReference<T> type) { + ObjectHelper.notNull(node, "node"); + ObjectHelper.notNull(type, "type"); + + final T definition; + + try { + definition = mapper.reader().forType(type).readValue(node); + } catch (IOException e) { + throw new IllegalStateException(e); + } + + if (definition == null) { + throw new IllegalStateException("Unable to decode node " + node + " to type " + type); + } + + return definition; + } + public <T extends StepParser> T lookup(Class<T> type, String stepId) { StepParser parser = resolver.resolve(builder.getContext(), stepId); if (type.isInstance(parser)) { diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy index 2c82a34..a2426a6 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/TestSupport.groovy @@ -121,7 +121,7 @@ class TestSupport extends Specification { } static <U extends StartStepParser> ProcessorDefinition<?> toStartProcessor(Class<U> type, String content) { - return type.getConstructor().newInstance().toStartProcessor(stepContext(content)) + return type.getConstructor().newInstance().process(stepContext(content)) } static ProcessorDefinition<?> toProcessor(String id, String content) { @@ -132,7 +132,7 @@ class TestSupport extends Specification { return parser.toProcessor(ctx) } if (parser instanceof StartStepParser) { - return parser.toStartProcessor(ctx) + return parser.process(ctx) } throw new IllegalArgumentException("No parser of ${id}") } diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ErrorHandlerTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ErrorHandlerTest.groovy index db0d563..51f5ed4 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ErrorHandlerTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ErrorHandlerTest.groovy @@ -81,7 +81,7 @@ class ErrorHandlerTest extends TestSupport { no-error-handler: {} ''') when: - new ErrorHandlerStepParser().toStartProcessor(stepContext) + new ErrorHandlerStepParser().process(stepContext) then: stepContext.builder().routeCollection.errorHandlerFactory instanceof NoErrorHandlerBuilder } @@ -93,7 +93,7 @@ class ErrorHandlerTest extends TestSupport { dead-letter-uri: "jms:queue:dead" ''') when: - new ErrorHandlerStepParser().toStartProcessor(stepContext) + new ErrorHandlerStepParser().process(stepContext) then: with(stepContext.builder().routeCollection.errorHandlerFactory, DefaultErrorHandlerBuilder) { deadLetterUri == 'jms:queue:dead' @@ -106,7 +106,7 @@ class ErrorHandlerTest extends TestSupport { dead-letter-channel: "jms:queue:dead" ''') when: - new ErrorHandlerStepParser().toStartProcessor(stepContext) + new ErrorHandlerStepParser().process(stepContext) then: with(stepContext.builder().routeCollection.errorHandlerFactory, DefaultErrorHandlerBuilder) { deadLetterUri == 'jms:queue:dead' @@ -119,7 +119,7 @@ class ErrorHandlerTest extends TestSupport { ref: "myErrorHandler" ''') when: - new ErrorHandlerStepParser().toStartProcessor(stepContext) + new ErrorHandlerStepParser().process(stepContext) then: with(stepContext.builder().routeCollection.errorHandlerFactory, ErrorHandlerBuilderRef) { ref == 'myErrorHandler' diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy index 87161ed..49a9f86 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy @@ -34,7 +34,7 @@ class FromTest extends TestSupport { message: "test" ''') when: - def processor = new FromStepParser().toStartProcessor(stepContext) + def processor = new FromStepParser().process(stepContext) then: with(processor, RouteDefinition) { input instanceof FromDefinition @@ -48,7 +48,7 @@ class FromTest extends TestSupport { uri: "timer://tick" ''') when: - new FromStepParser().toStartProcessor(stepContext) + new FromStepParser().process(stepContext) then: def ex = thrown(StepParserException) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/OnExceptionTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/OnExceptionTest.groovy index 4f286f8..4f60916 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/OnExceptionTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/OnExceptionTest.groovy @@ -104,7 +104,7 @@ class OnExceptionTest extends TestSupport { constant: "continued" ''') when: - def processor = new OnExceptionStepParser().toStartProcessor(stepContext) + def processor = new OnExceptionStepParser().process(stepContext) then: stepContext.builder().routeCollection.onExceptions.size() == 1 stepContext.builder().routeCollection.onExceptions[0].exceptions.contains("java.lang.Exception") diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/RestTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/RestTest.groovy index 30d090e..e175c5a 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/RestTest.groovy +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/RestTest.groovy @@ -33,7 +33,7 @@ class RestTest extends TestSupport { message: "test" ''') when: - def processor = new RestStepParser().toStartProcessor(stepContext) + def processor = new RestStepParser().process(stepContext) then: with(processor, RouteDefinition) { restDefinition != null @@ -51,7 +51,7 @@ class RestTest extends TestSupport { message: "test" ''') when: - new RestStepParser().toStartProcessor(stepContext) + new RestStepParser().process(stepContext) then: def ex = thrown(StepParserException) @@ -67,7 +67,7 @@ class RestTest extends TestSupport { message: "test" ''') when: - new RestStepParser().toStartProcessor(stepContext) + new RestStepParser().process(stepContext) then: def ex = thrown(StepParserException) @@ -81,7 +81,7 @@ class RestTest extends TestSupport { uri: "/api/{id}" ''') when: - new RestStepParser().toStartProcessor(stepContext) + new RestStepParser().process(stepContext) then: def ex = thrown(StepParserException) diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/model/Node.java b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/support/MyBean.groovy similarity index 67% rename from camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/model/Node.java rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/support/MyBean.groovy index 9149228..db817b5 100644 --- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/model/Node.java +++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/support/MyBean.groovy @@ -14,24 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.k.loader.yaml.model; +package org.apache.camel.k.loader.yaml.support -import com.fasterxml.jackson.databind.JsonNode; +class MyBean { + String field1 + String field2 + Nested nested -public class Node { - private final String type; - private final JsonNode data; - - public Node(String type, JsonNode data) { - this.type = type; - this.data = data; - } - - public String getType() { - return type; - } - - public JsonNode getData() { - return data; + static class Nested { + String field1 + String field2 } } diff --git a/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java b/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java index cbe86d3..a83e8ec 100644 --- a/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java +++ b/camel-k-quarkus/camel-k-quarkus-loader-yaml/deployment/src/main/java/org/apache/camel/k/loader/yaml/quarkus/deployment/DeploymentProcessor.java @@ -20,7 +20,6 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -import org.apache.camel.k.loader.yaml.model.Node; import org.apache.camel.k.loader.yaml.model.Step; import org.apache.camel.k.loader.yaml.parser.HasDataFormat; import org.apache.camel.k.loader.yaml.parser.HasExpression; @@ -85,6 +84,5 @@ public class DeploymentProcessor { reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, Step.Deserializer.class)); reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, HasExpression.class)); reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, HasDataFormat.class)); - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, Node.class)); } } diff --git a/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/yaml/parser/KnativeStepParser.java b/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/yaml/parser/KnativeStepParser.java index b1d4c75..8e07785 100644 --- a/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/yaml/parser/KnativeStepParser.java +++ b/camel-k-runtime-knative/src/main/java/org/apache/camel/k/knative/yaml/parser/KnativeStepParser.java @@ -34,7 +34,7 @@ import org.apache.camel.util.URISupport; public class KnativeStepParser implements ProcessorStepParser, StartStepParser { @Override - public ProcessorDefinition<?> toStartProcessor(Context context) { + public Object process(Context context) { final Definition definition = context.node(Definition.class); final String uri = definition.getEndpointUri(); final RouteDefinition route = context.builder().from(uri); diff --git a/tooling/camel-k-annotations/src/main/java/org/apache/camel/k/annotation/yaml/YAMLStepParser.java b/tooling/camel-k-annotations/src/main/java/org/apache/camel/k/annotation/yaml/YAMLStepParser.java index 7634747..757f2f9 100644 --- a/tooling/camel-k-annotations/src/main/java/org/apache/camel/k/annotation/yaml/YAMLStepParser.java +++ b/tooling/camel-k-annotations/src/main/java/org/apache/camel/k/annotation/yaml/YAMLStepParser.java @@ -25,5 +25,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface YAMLStepParser { String id(); - Class<?>[] definitions(); + Class<?> definition(); + boolean schema() default true; } diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSchema.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSchema.java index 2640992..dab3fcd 100644 --- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSchema.java +++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSchema.java @@ -155,6 +155,14 @@ public class GenerateYamlSchema extends GenerateYamlSupport { .sorted(Comparator.comparing(entry -> entry.name().toString())) .forEach( entry -> { + boolean schema = annotationValue(entry, YAML_STEP_PARSER_ANNOTATION, "schema") + .map(AnnotationValue::asBoolean) + .orElse(true); + + if (!schema) { + return; + } + String stepId = annotationValue(entry, YAML_STEP_PARSER_ANNOTATION, "id") .map(AnnotationValue::asString) .orElseThrow(() -> new IllegalArgumentException("Missing id field")); @@ -163,29 +171,27 @@ public class GenerateYamlSchema extends GenerateYamlSupport { return; } - String[] models = annotationValue(entry, YAML_STEP_PARSER_ANNOTATION, "definitions") - .map(AnnotationValue::asStringArray) + String model = annotationValue(entry, YAML_STEP_PARSER_ANNOTATION, "definition") + .map(AnnotationValue::asString) .orElseThrow(() -> new IllegalArgumentException("Missing definitions field")); - for (String model: models) { - DotName name = DotName.createSimple(model); + DotName name = DotName.createSimple(model); - if (implementsInterface(entry, START_STEP_PARSER_CLASS)) { - items.put("maxProperties", 1); - items.with("properties") - .putObject(stepId) - .put("$ref", "#/items/definitions/" + name.toString()); - } + if (implementsInterface(entry, START_STEP_PARSER_CLASS)) { + items.put("maxProperties", 1); + items.with("properties") + .putObject(stepId) + .put("$ref", "#/items/definitions/" + name.toString()); + } - if (implementsInterface(entry, PROCESSOR_STEP_PARSER_CLASS)) { - ObjectNode stepNode = definitions.with("step"); - stepNode.put("type", "object"); - stepNode.put("maxProperties", 1); + if (implementsInterface(entry, PROCESSOR_STEP_PARSER_CLASS)) { + ObjectNode stepNode = definitions.with("step"); + stepNode.put("type", "object"); + stepNode.put("maxProperties", 1); - stepNode.with("properties") - .putObject(stepId) - .put("$ref", "#/items/definitions/" + name.toString()); - } + stepNode.with("properties") + .putObject(stepId) + .put("$ref", "#/items/definitions/" + name.toString()); } } );