This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 752d99cba45dbdc5564146b7fa146aea4aaa9e14 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Aug 30 11:08:44 2021 +0200 Component JARs with mixed API and non-API based component should not generate APIs intyo the non API component. --- .../maven/packaging/EndpointSchemaGeneratorMojo.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java index 1355268..88a3296 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointSchemaGeneratorMojo.java @@ -266,7 +266,9 @@ public class EndpointSchemaGeneratorMojo extends AbstractGeneratorMojo { } // enrich the component model with additional configurations for api components - enhanceComponentModelWithApiModel(componentModel); + if (componentModel.isApi()) { + enhanceComponentModelWithApiModel(componentModel); + } String json = JsonMapper.createParameterJsonSchema(componentModel); @@ -863,10 +865,14 @@ public class EndpointSchemaGeneratorMojo extends AbstractGeneratorMojo { while (true) { String apiName = null; boolean apiOption = false; - ApiParams apiParams = classElement.getAnnotation(ApiParams.class); - if (apiParams != null) { - apiName = apiParams.apiName(); - apiOption = !Strings.isNullOrEmpty(apiName); + // only check for api if component is API based + ApiParams apiParams = null; + if (componentModel.isApi()) { + apiParams = classElement.getAnnotation(ApiParams.class); + if (apiParams != null) { + apiName = apiParams.apiName(); + apiOption = !Strings.isNullOrEmpty(apiName); + } } String excludedProperties = ""; @@ -1019,9 +1025,9 @@ public class EndpointSchemaGeneratorMojo extends AbstractGeneratorMojo { } UriParam param = fieldElement.getAnnotation(UriParam.class); - ApiParam apiParam = fieldElement.getAnnotation(ApiParam.class); - fieldName = fieldElement.getName(); if (param != null) { + ApiParam apiParam = fieldElement.getAnnotation(ApiParam.class); + fieldName = fieldElement.getName(); String name = prefix + (Strings.isNullOrEmpty(param.name()) ? fieldName : param.name()); // should we exclude the name?
