Hi all,
I'm attempting to update to Camel 4.10.4 but having issues generating routes
and models some open api schemas on recent versions of the
camel-restdsl-openapi-plugin.
Here is a simple example schema that I put together that is failing for me.
openapi: 3.0.4
info:
title: Sales API
version: 1.0.1
description: Sales API
paths:
/sales:
delete:
summary: Delete Sales
responses:
"200":
description: OK
If I switch the response to 202, it works.
If I add content to the 200 response it works.
As far as I can tell 200 with no specified content definition is valid.
These are not my API's so I'd prefer not to have to modify them all.
Maven snippet:
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restdsl-openapi-plugin</artifactId>
<version>4.10.4</version>
<executions>
<execution>
<id>example</id>
<goals>
<!--goal>generate</goal>-->
<goal>generate-with-dto</goal>
</goals>
<configuration>
<specificationUri>
${project.basedir}/src/main/resources/openapi_input/example.yaml</specificationUri>
<restConfiguration>false</restConfiguration>
<destinationGenerator></destinationGenerator>
<modelPackage>com.example</modelPackage>
<packageName>com.example.routes.gen</packageName>
<className>ExampleRestRoute</className>
<outputDirectory>
${project.build.directory}/generated-sources/routes</outputDirectory>
<configOptions>
<library>jersey2</library>
<swaggerAnnotations>false</swaggerAnnotations>
<additional-properties>
generateModelBuilders=yes,useJackson=true,sortParamsByRequiredFlag=false,useJacksonJsonIgnoreUnknownProperties=false</additional-properties>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
I get the error:
[INFO] Generating Camel DSL source in directory:
D:\workspaces\functions\EIPCTM\guild-eip\target\generated-sources\routes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.995 s
[INFO] Finished at: 2025-05-02T08:49:04+10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.camel:camel-restdsl-openapi-plugin:4.10.4:generate-with-dto
(example) on project eip: Execution example of goal
org.apache.camel:camel-restdsl-openapi-plugin:4.10.4:generate-with-dto failed:
Cannot invoke "io.swagger.v3.oas.models.media.Content.entrySet()" because the
return value of "io.swagger.v3.oas.models.responses.ApiResponse.getContent()"
is null -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.camel:camel-restdsl-openapi-plugin:4.10.4:generate-with-dto
(example) on project guild-eip: Execution example of goal
org.apache.camel:camel-restdsl-openapi-plugin:4.10.4:generate-with-dto failed:
Cannot invoke "io.swagger.v3.oas.models.media.Content.entrySet()" because the
return value of "io.swagger.v3.oas.models.responses.ApiResponse.getContent()"
is null
at
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:333)
at
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
at
org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
at
org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
at
org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:206)
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:568)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution example
of goal org.apache.camel:camel-restdsl-openapi-plugin:4.10.4:generate-with-dto
failed: Cannot invoke "io.swagger.v3.oas.models.media.Content.entrySet()"
because the return value of
"io.swagger.v3.oas.models.responses.ApiResponse.getContent()" is null
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at
org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
... 25 more
Caused by: java.lang.NullPointerException: Cannot invoke
"io.swagger.v3.oas.models.media.Content.entrySet()" because the return value of
"io.swagger.v3.oas.models.responses.ApiResponse.getContent()" is null
at
org.apache.camel.generator.openapi.OperationVisitor.emitOperation(OperationVisitor.java:229)
at
org.apache.camel.generator.openapi.OperationVisitor.visit(OperationVisitor.java:171)
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.RestDslSourceCodeGenerator.generateConfigureMethod(RestDslSourceCodeGenerator.java:142)
at
org.apache.camel.generator.openapi.RestDslSourceCodeGenerator.generateSourceCode(RestDslSourceCodeGenerator.java:155)
at
org.apache.camel.generator.openapi.PathGenerator.generate(PathGenerator.java:33)
at
org.apache.camel.generator.openapi.PathGenerator.generate(PathGenerator.java:25)
at
org.apache.camel.maven.generator.openapi.GenerateMojo.execute(GenerateMojo.java:145)
at
org.apache.camel.maven.generator.openapi.GenerateWithDtoMojo.execute(GenerateWithDtoMojo.java:41)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
... 26 more
[cid:guild_group_box_1d412af1-affb-4c07-9f3a-296134fb000c.png]<https://www.guildgroup.com.au/><https://www.guildgroup.com.au/>
Andy Gilette
Solutions Architect - Software Engineer
Level 1, 132 Leichhardt Street, Spring Hill, QLD 4000
p: +61 3 7000 0405
w: guildgroup.com.au<https://www.guildgroup.com.au>
[cid:thrivetogether-blue_4c72fa74-1bd9-4732-bb06-cf4ebbd58bac.png]
We work flexibly at Guild. I'm sending this message at a time that suits me.
Please feel comfortable knowing that I don't expect you to read, respond to or
action it outside of regular working hours.
In the spirit of reconciliation, Guild Group acknowledges the Traditional
Custodians of Country throughout Australia and their connections to land, sea,
and community. We pay our respect to their Elders past and present and extend
that respect to all Aboriginal and Torres Strait Islander peoples today.
________________________________
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and delete this e-mail from your system. Any
unauthorised copying, disclosure, dissemination or distribution of the material
in this e-mail is strictly forbidden. The sender, as well as Guild Group
Holdings and any of its related companies do not guarantee the integrity of any
e-mails or attached files. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any such problems in the contents of this message
which arise as a result of e-mail transmissions.