Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21368

Regression in Camel JBang fails when generating REST routes from OpenAPI spec

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.8.0
    • 4.8.2, 4.9.0
    • camel-jbang
    • None
    • Unknown

    Description

      When generating REST routes from the attached OpenAPI spec using Camel JBang, I get the following error:

      java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
              at org.apache.camel.generator.openapi.RestDefinitionEmitter.emit(RestDefinitionEmitter.java:50)
              at org.apache.camel.generator.openapi.OperationVisitor.emit(OperationVisitor.java:118)
              at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
              at org.apache.camel.generator.openapi.OperationVisitor.visit(OperationVisitor.java:166)
              at org.apache.camel.generator.openapi.PathVisitor.lambda$visit$0(PathVisitor.java:46)
              at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
              at org.apache.camel.generator.openapi.PathVisitor.visit(PathVisitor.java:46)
              at org.apache.camel.generator.openapi.RestDslYamlGenerator.generate(RestDslYamlGenerator.java:83)
              at org.apache.camel.dsl.jbang.core.commands.generate.CodeRestGenerator.doCall(CodeRestGenerator.java:122)
              at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:71)
              at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:37)
              at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
              at picocli.CommandLine.access$1500(CommandLine.java:148)
              at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
              at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
              at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
              at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
              at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
              at picocli.CommandLine.execute(CommandLine.java:2174)
              at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:173)
              at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:62)
              at main.CamelJBang.main(CamelJBang.java:36)
      Caused by: java.lang.reflect.InvocationTargetException
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:569)
              at org.apache.camel.generator.openapi.RestDefinitionEmitter.emit(RestDefinitionEmitter.java:48)
              ... 21 more
      Caused by: java.lang.IllegalArgumentException: name must be specified and not empty
              at org.apache.camel.util.StringHelper.notEmpty(StringHelper.java:356)
              at org.apache.camel.model.rest.ParamDefinition.endParam(ParamDefinition.java:344)
              ... 26 more
       

      In version 4.5.0, I was able to generate the routes but something broke in 4.8.0. The command I'm running is: jbang "-Dcamel.jbang.version=4.8.0" camel@apache/camel generate rest --input us-core-server.openapi.json --output api.yaml . I've observed that the command works when there's a single path in the spec.

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            claude.mamo Claude Mamo

            Dates

              Created:
              Updated:

              Slack

                Issue deployment