我如何修复openapi错误,在看似正确的“inputspec”中生成代码?

35g0bw71  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(459)

我正在尝试运行openapi生成器,但是我一直收到一条没有意义的错误消息。 Failed to execute goal org.openapitools:openapi-generator-maven-plugin:5.0.0-SNAPSHOT:generate (default-cli) on project miguelmunoz.challenge: The parameters 'inputSpec' for goal org.openapitools:openapi-generator-maven-plugin:5.0.0-SNAPSHOT:generate are missing or invalid 问题是我的 inputSpec 值指向有效的.yaml文件。文件位于 src/main/resources/yaml/pizzeria.yaml 我使用复制和粘贴来确保路径中没有拼写错误。您可以在下载一个最小的可复制测试用例https://github.com/swingguy1024/openapi_inputspec_bug.
以下是我的插件规范:

<plugin>
            <groupId>org.openapitools</groupId>
            <artifactId>openapi-generator-maven-plugin</artifactId>
            <!-- RELEASE_VERSION -->
            <version>5.0.0-SNAPSHOT</version>
            <!-- /RELEASE_VERSION -->
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <!-- General Configuration properties taken from -->
                        <!-- https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.md -->
                        <!--Changed to https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin-->
                        <!-- Modifications from https://stackoverflow.com/questions/64304049/how-to-create-a-spring-boot-rest-server-using-openapitools/64363872#64363872 -->
                        <ignoreFileOverride>${project.basedir}/my-springboot.ignores</ignoreFileOverride>  <!--Added-->
                        <inputSpec>${project.basedir}/src/main/resources/yaml/pizzeria.yaml</inputSpec>
                        <!--the language tag was replaced by the generatorName tag:-->
                        <generatorName>spring</generatorName>
                        <!--<templateDirectory>${project.basedir}/src/gen/templates/</templateDirectory>-->
                        <!--<templateResourcePath>${project.basedir}/src/gen/templates/</templateResourcePath>-->
                        <!-- <output>${project.basedir}</output>-->
                        <!-- Defaults to ${project.build.directory}/generated-sources/openapi -->
                        <apiPackage>com.dummy.pizzeria.api</apiPackage>
                        <modelPackage>com.dummy.pizzeria.model</modelPackage>
                        <invokerPackage>com.dummy.pizzeria</invokerPackage>
                        <packageName>com.dummy.pizzeria.objects</packageName>
                        <groupId>neptunedreams</groupId>
                        <artifactId>pizzeria</artifactId>
                        <library>spring-boot</library>
                        <generateModelTests>false</generateModelTests>
                        <!--<output>${project.basedir}/my-springboot</output> &lt;!&ndash; Added &ndash;&gt;-->
                        <!--<generateSupportingFiles>false</generateSupportingFiles>-->
                        <configOptions>
                            <!-- configOptions are specific to the spring generator. These are taken from -->
                            <!-- https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/spring.md -->
                            <sourceFolder>gen</sourceFolder>
                            <bigDecimalAsString>true</bigDecimalAsString>
                            <dateLibrary>java8</dateLibrary> <!-- Default-->
                            <delegatePattern>false</delegatePattern>
                            <performBeanValidation>true</performBeanValidation>
                            <useBeanValidation>true</useBeanValidation>
                            <skipDefaultInterface>false</skipDefaultInterface>
                            <library>spring-boot</library>
                            <interfaceOnly>true</interfaceOnly>
                        </configOptions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题