Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3070
Closed
Open
Issue created Jun 03, 2019 by Administrator@rootContributor

[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

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java#L248

/**
 * 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;
Assignee
Assign to
Time tracking