[ 
https://issues.apache.org/jira/browse/CAMEL-21368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claude Mamo updated CAMEL-21368:
--------------------------------
    Description: 
When generating REST routes from the *attached* OpenAPI spec using Camel JBang, 
I get the following error:
{code:java}
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
 {code}
{{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.}}

 

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

 
{code:java}
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
 {code}
{{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.}}

 


> Regression in Camel JBang fails when generating REST routes from OpenAPI spec
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-21368
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21368
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>    Affects Versions: 4.8.0
>            Reporter: Claude Mamo
>            Priority: Blocker
>         Attachments: us-core-server.openapi.json
>
>
> When generating REST routes from the *attached* OpenAPI spec using Camel 
> JBang, I get the following error:
> {code:java}
> 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
>  {code}
> {{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.}}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to