[BUG][JAVA] Maven Plugin `CodeGenMojo.strictSpecBehavior` does not match parameter name 'strictSpec'
Created by: karlbennett
Description
The maven plugin does not work for version 4.0.* because the strictSpecBehavior
field does not match it's parameter name strictSpec
. It seems maven ignores the name specified in the annotation and just uses reflection to look for a field that has the same name as the parameter.
[ERROR] Failed to execute goal org.openapitools:openapi-generator-maven-plugin:4.0.1:generate (default) on project test-client: Unable to parse configuration of mojo org.openapitools:openapi-generator-maven-plugin:4.0.1:generate for parameter strictSpec: Cannot find 'strictSpec' in class org.openapitools.codegen.plugin.CodeGenMojo -> [Help 1]
openapi-generator version
4.0.*
OpenAPI declaration file content or url
/**
* To treat a document strictly against the spec.
*/
@Parameter(name = "strictSpec", property = "openapi.generator.maven.plugin.strictSpec", required = false)
private Boolean strictSpecBehavior;
Steps to reproduce
Try to generate a client with the maven plugin above version 4.0.*.
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
<generatorName>java</generatorName>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Suggest a fix
Simply fix the field name.
/**
* To treat a document strictly against the spec.
*/
@Parameter(name = "strictSpec", property = "openapi.generator.maven.plugin.strictSpec", required = false)
private Boolean strictSpec;