kubernetes-client / gen

Common generator scripts for all client libraries
Apache License 2.0
148 stars 145 forks source link

failed generating with latest openapi-generator ver 5.x #207

Closed itaru2622 closed 2 years ago

itaru2622 commented 2 years ago

when I tried gen with latest openapi-generator v5.3.0, the following error raised in gen.

The reason is very simple. gen/openapi/{{language}}.xml is still using older 'language' perspective and no replaced 'generatorName' perspective.

the below patch passed the openapi-generator process in case of python client. I think all other language clients have the same issue.

diff --git a/openapi/python.xml b/openapi/python.xml
--- a/openapi/python.xml
+++ b/openapi/python.xml
                         <configuration>
                             <language>python</language>
+                            <generatorName>python</generatorName>
                             <gitUserId>kubernetes-client</gitUserId>

error message:

export OPENAPI_GENERATOR_COMMIT="v5.3.0"
generate client for python (by scripts/update-clients.sh in kubernetes-client/python )

:
[INFO] --------------------< io.kubernetes:client-python >---------------------
[INFO] Building client-python 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
:
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/3.3.1/maven-artifact-3.3.1.jar (55 kB at 95 kB/s)
[ERROR] A generator name (generatorName) is required.
[WARNING] /output_dir/swagger.json [0:0]: unexpected error in Open-API generation
org.apache.maven.plugin.MojoExecutionException: The generator requires 'generatorName'. Refer to documentation for a list of options.
    at org.openapitools.codegen.plugin.CodeGenMojo.execute (CodeGenMojo.java:550)
    :
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openapitools:openapi-generator-maven-plugin:5.3.0:generate (default) on project client-python: Code generation failed. See above for the full exception. -> [Help 1]
yliaog commented 2 years ago

could you please send a PR?

itaru2622 commented 2 years ago

@yliaog I submitted the PR.

brendandburns commented 2 years ago

Closing since #208 merged.