From 0a73e80d9106b65ba3601d6d5c7e2f8ce469ab4f Mon Sep 17 00:00:00 2001 From: Dennis Kliban Date: Sun, 14 Apr 2019 23:19:23 -0400 Subject: [PATCH] Problem: client is generated using swagger-codegen-cli Solution: Switch to using openapi-generator-cli re: #4691 https://pulp.plan.io/issues/4691 --- ...odegen-ignore => .openapi-generator-ignore | 0 README.rst | 6 ++--- generate.sh | 23 ++++++++----------- 3 files changed, 13 insertions(+), 16 deletions(-) rename .swagger-codegen-ignore => .openapi-generator-ignore (100%) diff --git a/.swagger-codegen-ignore b/.openapi-generator-ignore similarity index 100% rename from .swagger-codegen-ignore rename to .openapi-generator-ignore diff --git a/README.rst b/README.rst index 72f00eb..610d87e 100644 --- a/README.rst +++ b/README.rst @@ -1,10 +1,10 @@ -pulp-swagger-codegen -==================== +pulp-openapi-generator +====================== This repository provides a script that helps generate Python and Ruby bindings for pulpcore or any of it's plugins. -The first time the script is run, a docker container with swagger-codegen-cli is downloaded. All +The first time the script is run, a docker container with openapi-generator-cli is downloaded. All subsequent runs will re-use the container that was downloaded on the initial run. Requirements diff --git a/generate.sh b/generate.sh index c309ca8..767157d 100755 --- a/generate.sh +++ b/generate.sh @@ -16,32 +16,29 @@ fi if [ $2 = 'python' ] then - docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ + docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \ -i /local/api.json \ - -l python \ + -g python \ -o /local/$1-client \ -DpackageName=pulpcore.client.$1 \ -DprojectName=$1-client \ - -DpackageVersion=${VERSION} + -DpackageVersion=${VERSION} \ + --skip-validate-spec \ + --strict-spec=false cp python/__init__.py $1-client/pulpcore/ cp python/__init__.py $1-client/pulpcore/client - # There is a bug in swagger-codegen. When using package names within a namespace it creates the package - # accross 2 different directories. We move everything back into place here. - cp $1-client/pulpcore.client.$1/* $1-client/pulpcore/client/$1/ - cp $1-client/pulpcore.client.$1/api/* $1-client/pulpcore/client/$1/api/ - cp $1-client/pulpcore.client.$1/models/* $1-client/pulpcore/client/$1/models/ - # Then remove the wrong directory - rm -rf $1-client/pulpcore.client.$1 fi if [ $2 = 'ruby' ] then - docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \ + docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \ -i /local/api.json \ - -l ruby \ + -g ruby \ -o /local/$1-client \ -DgemName=$1_client \ -DgemLicense="GPLv2" \ - -DgemVersion=${VERSION} + -DgemVersion=${VERSION} \ + --skip-validate-spec \ + --strict-spec=false fi rm api.json