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 3a2e249d2b148518da42043dd0e81d399f36f38f Author: Claus Ibsen <[email protected]> AuthorDate: Sat Jul 5 12:26:23 2025 +0200 CAMEL-22219: api component generator should include json metadata for API methods that has no parameters. --- .../packaging/EndpointSchemaGeneratorMojo.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 f4bf79a20db..9e3559e7d96 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 @@ -1300,6 +1300,31 @@ public class EndpointSchemaGeneratorMojo extends AbstractGeneratorMojo { } if (apiOption) { + // include extra methods that has no parameters and are only included in the class annotation + final String apiModelName = apiName; + Optional<ApiModel> op = componentModel.getApiOptions().stream() + .filter(o -> o.getName().equals(apiModelName)) + .findFirst(); + if (op.isPresent()) { + ApiModel am = op.get(); + apiParams = classElement.getAnnotation(ApiParams.class); + if (apiParams != null) { + ApiMethod[] extra = apiParams.apiMethods(); + if (extra != null) { + for (ApiMethod m : extra) { + boolean exists = am.getMethods().stream() + .anyMatch(o -> m.methodName().equals(o.getName())); + if (!exists) { + ApiMethodModel o = am.newMethod(m.methodName()); + o.setDescription(m.description()); + for (String sig : m.signatures()) { + o.addSignature(sig); + } + } + } + } + } + } // do not check super classes for api options as we only check one level (to include new options and not common) // if there are no options added then add the api name as empty option so we have it marked break;
