From 7b8ab83a744bf4cc58f654e40ca0d98fc77772a6 Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Tue, 25 Nov 2025 10:13:10 +0100 Subject: [PATCH] feat(generator): add individual blacklist for each language --- .../golang/.openapi-generator-ignore | 0 .../golang/blacklist.txt | 0 .../golang/openapi-generator-config.yml | 2 +- .../golang/templates}/README.mustache | 0 .../golang/templates}/api.mustache | 0 .../golang/templates}/api_doc.mustache | 0 .../golang/templates}/api_test.mustache | 0 .../golang/templates}/client.mustache | 0 .../golang/templates}/configuration.mustache | 0 .../helper/array_json_example_value.mustache | 0 .../container_json_example_value.mustache | 0 .../custom/model_oneof_test.mustache | 0 .../custom/model_simple_test.mustache | 0 .../templates}/custom/model_test.mustache | 0 .../golang/templates}/git_push.sh.mustache | 0 .../golang/templates}/gitignore.mustache | 0 .../golang/templates}/go.mod.mustache | 0 .../golang/templates}/go.sum.mustache | 0 .../golang/templates}/model.mustache | 0 .../golang/templates}/model_anyof.mustache | 0 .../golang/templates}/model_doc.mustache | 0 .../golang/templates}/model_enum.mustache | 0 .../golang/templates}/model_oneof.mustache | 0 .../golang/templates}/model_simple.mustache | 0 .../golang/templates}/nullable_model.mustache | 0 .../golang/templates}/openapi.mustache | 0 .../golang/templates}/partial_header.mustache | 0 .../golang/templates}/response.mustache | 0 .../golang/templates}/signing.mustache | 0 .../golang/templates}/utils.mustache | 0 .../java/.openapi-generator-ignore | 0 languages/java/blacklist.txt | 1 + .../java/openapi-generator-config.yml | 2 +- .../java/templates}/ApiCallback.mustache | 0 .../java/templates}/ApiClient.mustache | 0 .../java/templates}/README.md | 0 .../java/templates}/README.mustache | 0 .../java/templates}/api.mustache | 0 .../java/templates}/api_test.mustache | 0 .../java/templates}/build.gradle.mustache | 0 .../templates}/custom/ApiClientTest.mustache | 0 .../templates}/custom/serviceApi.mustache | 0 .../templates}/custom/serviceApiTest.mustache | 0 .../python/.openapi-generator-ignore | 0 languages/python/blacklist.txt | 12 +++ .../python/templates}/README.md | 0 .../python/templates}/README.mustache | 0 .../templates}/__init__package.mustache | 0 .../python/templates}/api.mustache | 0 .../python/templates}/api_client.mustache | 0 .../python/templates}/configuration.mustache | 0 .../python/templates}/exceptions.mustache | 0 .../python/templates}/model_generic.mustache | 0 .../python/templates}/model_oneof.mustache | 0 .../python/templates}/pyproject.mustache | 0 .../python/templates}/rest.mustache | 0 scripts/generate-sdk/languages/go.sh | 88 +++++++++---------- scripts/generate-sdk/languages/java.sh | 8 +- scripts/generate-sdk/languages/python.sh | 6 +- templates/go/.travis.yml | 8 -- 60 files changed, 66 insertions(+), 61 deletions(-) rename scripts/generate-sdk/.openapi-generator-ignore-go => languages/golang/.openapi-generator-ignore (100%) rename blacklist.txt => languages/golang/blacklist.txt (100%) rename openapi-generator-config-go.yml => languages/golang/openapi-generator-config.yml (87%) rename {templates/go => languages/golang/templates}/README.mustache (100%) rename {templates/go => languages/golang/templates}/api.mustache (100%) rename {templates/go => languages/golang/templates}/api_doc.mustache (100%) rename {templates/go => languages/golang/templates}/api_test.mustache (100%) rename {templates/go => languages/golang/templates}/client.mustache (100%) rename {templates/go => languages/golang/templates}/configuration.mustache (100%) rename {templates/go => languages/golang/templates}/custom/helper/array_json_example_value.mustache (100%) rename {templates/go => languages/golang/templates}/custom/helper/container_json_example_value.mustache (100%) rename {templates/go => languages/golang/templates}/custom/model_oneof_test.mustache (100%) rename {templates/go => languages/golang/templates}/custom/model_simple_test.mustache (100%) rename {templates/go => languages/golang/templates}/custom/model_test.mustache (100%) rename {templates/go => languages/golang/templates}/git_push.sh.mustache (100%) rename {templates/go => languages/golang/templates}/gitignore.mustache (100%) rename {templates/go => languages/golang/templates}/go.mod.mustache (100%) rename {templates/go => languages/golang/templates}/go.sum.mustache (100%) rename {templates/go => languages/golang/templates}/model.mustache (100%) rename {templates/go => languages/golang/templates}/model_anyof.mustache (100%) rename {templates/go => languages/golang/templates}/model_doc.mustache (100%) rename {templates/go => languages/golang/templates}/model_enum.mustache (100%) rename {templates/go => languages/golang/templates}/model_oneof.mustache (100%) rename {templates/go => languages/golang/templates}/model_simple.mustache (100%) rename {templates/go => languages/golang/templates}/nullable_model.mustache (100%) rename {templates/go => languages/golang/templates}/openapi.mustache (100%) rename {templates/go => languages/golang/templates}/partial_header.mustache (100%) rename {templates/go => languages/golang/templates}/response.mustache (100%) rename {templates/go => languages/golang/templates}/signing.mustache (100%) rename {templates/go => languages/golang/templates}/utils.mustache (100%) rename scripts/generate-sdk/.openapi-generator-ignore-java => languages/java/.openapi-generator-ignore (100%) create mode 100644 languages/java/blacklist.txt rename openapi-generator-config-java.yml => languages/java/openapi-generator-config.yml (95%) rename {templates/java => languages/java/templates}/ApiCallback.mustache (100%) rename {templates/java => languages/java/templates}/ApiClient.mustache (100%) rename {templates/java => languages/java/templates}/README.md (100%) rename {templates/java => languages/java/templates}/README.mustache (100%) rename {templates/java => languages/java/templates}/api.mustache (100%) rename {templates/java => languages/java/templates}/api_test.mustache (100%) rename {templates/java => languages/java/templates}/build.gradle.mustache (100%) rename {templates/java => languages/java/templates}/custom/ApiClientTest.mustache (100%) rename {templates/java => languages/java/templates}/custom/serviceApi.mustache (100%) rename {templates/java => languages/java/templates}/custom/serviceApiTest.mustache (100%) rename scripts/generate-sdk/.openapi-generator-ignore-python => languages/python/.openapi-generator-ignore (100%) create mode 100644 languages/python/blacklist.txt rename {templates/python => languages/python/templates}/README.md (100%) rename {templates/python => languages/python/templates}/README.mustache (100%) rename {templates/python => languages/python/templates}/__init__package.mustache (100%) rename {templates/python => languages/python/templates}/api.mustache (100%) rename {templates/python => languages/python/templates}/api_client.mustache (100%) rename {templates/python => languages/python/templates}/configuration.mustache (100%) rename {templates/python => languages/python/templates}/exceptions.mustache (100%) rename {templates/python => languages/python/templates}/model_generic.mustache (100%) rename {templates/python => languages/python/templates}/model_oneof.mustache (100%) rename {templates/python => languages/python/templates}/pyproject.mustache (100%) rename {templates/python => languages/python/templates}/rest.mustache (100%) delete mode 100644 templates/go/.travis.yml diff --git a/scripts/generate-sdk/.openapi-generator-ignore-go b/languages/golang/.openapi-generator-ignore similarity index 100% rename from scripts/generate-sdk/.openapi-generator-ignore-go rename to languages/golang/.openapi-generator-ignore diff --git a/blacklist.txt b/languages/golang/blacklist.txt similarity index 100% rename from blacklist.txt rename to languages/golang/blacklist.txt diff --git a/openapi-generator-config-go.yml b/languages/golang/openapi-generator-config.yml similarity index 87% rename from openapi-generator-config-go.yml rename to languages/golang/openapi-generator-config.yml index d850d7a..75c3c8b 100644 --- a/openapi-generator-config-go.yml +++ b/languages/golang/openapi-generator-config.yml @@ -1,5 +1,5 @@ useOneOfDiscriminatorLookup: true -templateDir: templates/go +templateDir: languages/golang/templates files: custom/model_test.mustache: # TODO: this should be 'ModelTests' instead of 'Model' diff --git a/templates/go/README.mustache b/languages/golang/templates/README.mustache similarity index 100% rename from templates/go/README.mustache rename to languages/golang/templates/README.mustache diff --git a/templates/go/api.mustache b/languages/golang/templates/api.mustache similarity index 100% rename from templates/go/api.mustache rename to languages/golang/templates/api.mustache diff --git a/templates/go/api_doc.mustache b/languages/golang/templates/api_doc.mustache similarity index 100% rename from templates/go/api_doc.mustache rename to languages/golang/templates/api_doc.mustache diff --git a/templates/go/api_test.mustache b/languages/golang/templates/api_test.mustache similarity index 100% rename from templates/go/api_test.mustache rename to languages/golang/templates/api_test.mustache diff --git a/templates/go/client.mustache b/languages/golang/templates/client.mustache similarity index 100% rename from templates/go/client.mustache rename to languages/golang/templates/client.mustache diff --git a/templates/go/configuration.mustache b/languages/golang/templates/configuration.mustache similarity index 100% rename from templates/go/configuration.mustache rename to languages/golang/templates/configuration.mustache diff --git a/templates/go/custom/helper/array_json_example_value.mustache b/languages/golang/templates/custom/helper/array_json_example_value.mustache similarity index 100% rename from templates/go/custom/helper/array_json_example_value.mustache rename to languages/golang/templates/custom/helper/array_json_example_value.mustache diff --git a/templates/go/custom/helper/container_json_example_value.mustache b/languages/golang/templates/custom/helper/container_json_example_value.mustache similarity index 100% rename from templates/go/custom/helper/container_json_example_value.mustache rename to languages/golang/templates/custom/helper/container_json_example_value.mustache diff --git a/templates/go/custom/model_oneof_test.mustache b/languages/golang/templates/custom/model_oneof_test.mustache similarity index 100% rename from templates/go/custom/model_oneof_test.mustache rename to languages/golang/templates/custom/model_oneof_test.mustache diff --git a/templates/go/custom/model_simple_test.mustache b/languages/golang/templates/custom/model_simple_test.mustache similarity index 100% rename from templates/go/custom/model_simple_test.mustache rename to languages/golang/templates/custom/model_simple_test.mustache diff --git a/templates/go/custom/model_test.mustache b/languages/golang/templates/custom/model_test.mustache similarity index 100% rename from templates/go/custom/model_test.mustache rename to languages/golang/templates/custom/model_test.mustache diff --git a/templates/go/git_push.sh.mustache b/languages/golang/templates/git_push.sh.mustache similarity index 100% rename from templates/go/git_push.sh.mustache rename to languages/golang/templates/git_push.sh.mustache diff --git a/templates/go/gitignore.mustache b/languages/golang/templates/gitignore.mustache similarity index 100% rename from templates/go/gitignore.mustache rename to languages/golang/templates/gitignore.mustache diff --git a/templates/go/go.mod.mustache b/languages/golang/templates/go.mod.mustache similarity index 100% rename from templates/go/go.mod.mustache rename to languages/golang/templates/go.mod.mustache diff --git a/templates/go/go.sum.mustache b/languages/golang/templates/go.sum.mustache similarity index 100% rename from templates/go/go.sum.mustache rename to languages/golang/templates/go.sum.mustache diff --git a/templates/go/model.mustache b/languages/golang/templates/model.mustache similarity index 100% rename from templates/go/model.mustache rename to languages/golang/templates/model.mustache diff --git a/templates/go/model_anyof.mustache b/languages/golang/templates/model_anyof.mustache similarity index 100% rename from templates/go/model_anyof.mustache rename to languages/golang/templates/model_anyof.mustache diff --git a/templates/go/model_doc.mustache b/languages/golang/templates/model_doc.mustache similarity index 100% rename from templates/go/model_doc.mustache rename to languages/golang/templates/model_doc.mustache diff --git a/templates/go/model_enum.mustache b/languages/golang/templates/model_enum.mustache similarity index 100% rename from templates/go/model_enum.mustache rename to languages/golang/templates/model_enum.mustache diff --git a/templates/go/model_oneof.mustache b/languages/golang/templates/model_oneof.mustache similarity index 100% rename from templates/go/model_oneof.mustache rename to languages/golang/templates/model_oneof.mustache diff --git a/templates/go/model_simple.mustache b/languages/golang/templates/model_simple.mustache similarity index 100% rename from templates/go/model_simple.mustache rename to languages/golang/templates/model_simple.mustache diff --git a/templates/go/nullable_model.mustache b/languages/golang/templates/nullable_model.mustache similarity index 100% rename from templates/go/nullable_model.mustache rename to languages/golang/templates/nullable_model.mustache diff --git a/templates/go/openapi.mustache b/languages/golang/templates/openapi.mustache similarity index 100% rename from templates/go/openapi.mustache rename to languages/golang/templates/openapi.mustache diff --git a/templates/go/partial_header.mustache b/languages/golang/templates/partial_header.mustache similarity index 100% rename from templates/go/partial_header.mustache rename to languages/golang/templates/partial_header.mustache diff --git a/templates/go/response.mustache b/languages/golang/templates/response.mustache similarity index 100% rename from templates/go/response.mustache rename to languages/golang/templates/response.mustache diff --git a/templates/go/signing.mustache b/languages/golang/templates/signing.mustache similarity index 100% rename from templates/go/signing.mustache rename to languages/golang/templates/signing.mustache diff --git a/templates/go/utils.mustache b/languages/golang/templates/utils.mustache similarity index 100% rename from templates/go/utils.mustache rename to languages/golang/templates/utils.mustache diff --git a/scripts/generate-sdk/.openapi-generator-ignore-java b/languages/java/.openapi-generator-ignore similarity index 100% rename from scripts/generate-sdk/.openapi-generator-ignore-java rename to languages/java/.openapi-generator-ignore diff --git a/languages/java/blacklist.txt b/languages/java/blacklist.txt new file mode 100644 index 0000000..46fe5c3 --- /dev/null +++ b/languages/java/blacklist.txt @@ -0,0 +1 @@ +# Transitional file to disable generation for selected services diff --git a/openapi-generator-config-java.yml b/languages/java/openapi-generator-config.yml similarity index 95% rename from openapi-generator-config-java.yml rename to languages/java/openapi-generator-config.yml index fb4b055..a477247 100644 --- a/openapi-generator-config-java.yml +++ b/languages/java/openapi-generator-config.yml @@ -1,4 +1,4 @@ -templateDir: templates/java +templateDir: languages/java/templates additionalProperties: enumUnknownDefaultCase: true artifactUrl: https://github.com/stackitcloud/stackit-sdk-java diff --git a/templates/java/ApiCallback.mustache b/languages/java/templates/ApiCallback.mustache similarity index 100% rename from templates/java/ApiCallback.mustache rename to languages/java/templates/ApiCallback.mustache diff --git a/templates/java/ApiClient.mustache b/languages/java/templates/ApiClient.mustache similarity index 100% rename from templates/java/ApiClient.mustache rename to languages/java/templates/ApiClient.mustache diff --git a/templates/java/README.md b/languages/java/templates/README.md similarity index 100% rename from templates/java/README.md rename to languages/java/templates/README.md diff --git a/templates/java/README.mustache b/languages/java/templates/README.mustache similarity index 100% rename from templates/java/README.mustache rename to languages/java/templates/README.mustache diff --git a/templates/java/api.mustache b/languages/java/templates/api.mustache similarity index 100% rename from templates/java/api.mustache rename to languages/java/templates/api.mustache diff --git a/templates/java/api_test.mustache b/languages/java/templates/api_test.mustache similarity index 100% rename from templates/java/api_test.mustache rename to languages/java/templates/api_test.mustache diff --git a/templates/java/build.gradle.mustache b/languages/java/templates/build.gradle.mustache similarity index 100% rename from templates/java/build.gradle.mustache rename to languages/java/templates/build.gradle.mustache diff --git a/templates/java/custom/ApiClientTest.mustache b/languages/java/templates/custom/ApiClientTest.mustache similarity index 100% rename from templates/java/custom/ApiClientTest.mustache rename to languages/java/templates/custom/ApiClientTest.mustache diff --git a/templates/java/custom/serviceApi.mustache b/languages/java/templates/custom/serviceApi.mustache similarity index 100% rename from templates/java/custom/serviceApi.mustache rename to languages/java/templates/custom/serviceApi.mustache diff --git a/templates/java/custom/serviceApiTest.mustache b/languages/java/templates/custom/serviceApiTest.mustache similarity index 100% rename from templates/java/custom/serviceApiTest.mustache rename to languages/java/templates/custom/serviceApiTest.mustache diff --git a/scripts/generate-sdk/.openapi-generator-ignore-python b/languages/python/.openapi-generator-ignore similarity index 100% rename from scripts/generate-sdk/.openapi-generator-ignore-python rename to languages/python/.openapi-generator-ignore diff --git a/languages/python/blacklist.txt b/languages/python/blacklist.txt new file mode 100644 index 0000000..fd7a510 --- /dev/null +++ b/languages/python/blacklist.txt @@ -0,0 +1,12 @@ +# Transitional file to disable generation for selected services +featuretoggle +workflows +openstack +notebooks +cost +functionsregistry +functions +pim +smokeapi +stackitmarketplace +support diff --git a/templates/python/README.md b/languages/python/templates/README.md similarity index 100% rename from templates/python/README.md rename to languages/python/templates/README.md diff --git a/templates/python/README.mustache b/languages/python/templates/README.mustache similarity index 100% rename from templates/python/README.mustache rename to languages/python/templates/README.mustache diff --git a/templates/python/__init__package.mustache b/languages/python/templates/__init__package.mustache similarity index 100% rename from templates/python/__init__package.mustache rename to languages/python/templates/__init__package.mustache diff --git a/templates/python/api.mustache b/languages/python/templates/api.mustache similarity index 100% rename from templates/python/api.mustache rename to languages/python/templates/api.mustache diff --git a/templates/python/api_client.mustache b/languages/python/templates/api_client.mustache similarity index 100% rename from templates/python/api_client.mustache rename to languages/python/templates/api_client.mustache diff --git a/templates/python/configuration.mustache b/languages/python/templates/configuration.mustache similarity index 100% rename from templates/python/configuration.mustache rename to languages/python/templates/configuration.mustache diff --git a/templates/python/exceptions.mustache b/languages/python/templates/exceptions.mustache similarity index 100% rename from templates/python/exceptions.mustache rename to languages/python/templates/exceptions.mustache diff --git a/templates/python/model_generic.mustache b/languages/python/templates/model_generic.mustache similarity index 100% rename from templates/python/model_generic.mustache rename to languages/python/templates/model_generic.mustache diff --git a/templates/python/model_oneof.mustache b/languages/python/templates/model_oneof.mustache similarity index 100% rename from templates/python/model_oneof.mustache rename to languages/python/templates/model_oneof.mustache diff --git a/templates/python/pyproject.mustache b/languages/python/templates/pyproject.mustache similarity index 100% rename from templates/python/pyproject.mustache rename to languages/python/templates/pyproject.mustache diff --git a/templates/python/rest.mustache b/languages/python/templates/rest.mustache similarity index 100% rename from templates/python/rest.mustache rename to languages/python/templates/rest.mustache diff --git a/scripts/generate-sdk/languages/go.sh b/scripts/generate-sdk/languages/go.sh index c07fe06..cc11165 100644 --- a/scripts/generate-sdk/languages/go.sh +++ b/scripts/generate-sdk/languages/go.sh @@ -68,15 +68,15 @@ generate_go_sdk() { fi # Clone SDK repo - if [ -d ${SDK_REPO_LOCAL_PATH} ]; then + if [ -d "${SDK_REPO_LOCAL_PATH}" ]; then echo "Old SDK repo clone was found, it will be removed." - rm -rf ${SDK_REPO_LOCAL_PATH} + rm -rf "${SDK_REPO_LOCAL_PATH}" fi - git clone --quiet ${SDK_REPO_URL} ${SDK_REPO_LOCAL_PATH} + git clone --quiet "${SDK_REPO_URL}" "${SDK_REPO_LOCAL_PATH}" # Install SDK project tools - cd ${SDK_REPO_LOCAL_PATH} - git checkout ${SDK_BRANCH} + cd "${SDK_REPO_LOCAL_PATH}" + git checkout "${SDK_BRANCH}" make project-tools # Backup of the current state of the SDK services dir (services/) @@ -86,23 +86,23 @@ generate_go_sdk() { exit 1 fi cleanup() { - rm -rf ${sdk_services_backup_dir} + rm -rf "${sdk_services_backup_dir}" } - cp -a "${SERVICES_FOLDER}/." ${sdk_services_backup_dir} + cp -a "${SERVICES_FOLDER}/." "${sdk_services_backup_dir}" # Cleanup after we are done trap cleanup EXIT # Remove old contents of services dir (services/) - rm -rf ${SERVICES_FOLDER} - rm ${SDK_REPO_LOCAL_PATH}/go.work + rm -rf "${SERVICES_FOLDER}" + rm "${SDK_REPO_LOCAL_PATH}/go.work" if [ -f "${SDK_REPO_LOCAL_PATH}/go.work.sum" ]; then - rm ${SDK_REPO_LOCAL_PATH}/go.work.sum + rm "${SDK_REPO_LOCAL_PATH}/go.work.sum" fi echo "go ${SDK_GO_VERSION}" >${SDK_REPO_LOCAL_PATH}/go.work if [ -d ${SDK_REPO_LOCAL_PATH}/core ]; then - cd ${SDK_REPO_LOCAL_PATH}/core + cd "${SDK_REPO_LOCAL_PATH}/core" go work use . fi @@ -132,18 +132,18 @@ generate_go_sdk() { exit 1 fi - if grep -E "^$service$" ${ROOT_DIR}/blacklist.txt; then + if grep -E "^$service$" "${ROOT_DIR}/languages/golang/blacklist.txt"; then echo "Skipping blacklisted service ${service}" warning+="Skipping blacklisted service ${service}\n" continue fi echo -e "\n>> Generating \"${service}\" service..." - cd ${ROOT_DIR} + cd "${ROOT_DIR}" GO_POST_PROCESS_FILE="gofmt -w" \ - mkdir -p ${SERVICES_FOLDER}/${service}/ - cp ${ROOT_DIR}/scripts/generate-sdk/.openapi-generator-ignore-go ${SERVICES_FOLDER}/${service}/.openapi-generator-ignore + mkdir -p "${SERVICES_FOLDER}/${service}/" + cp "${ROOT_DIR}/languages/golang/.openapi-generator-ignore" "${SERVICES_FOLDER}/${service}/.openapi-generator-ignore" regional_api= if grep -E "^$service$" ${ROOT_DIR}/regional-whitelist.txt; then echo "Generating new regional api" @@ -153,22 +153,22 @@ generate_go_sdk() { # Run the generator for Go java -Dlog.level=${GENERATOR_LOG_LEVEL} -jar ${jar_path} generate \ --generator-name go \ - --input-spec ${service_json} \ - --output ${SERVICES_FOLDER}/${service} \ - --package-name ${service} \ + --input-spec "${service_json}" \ + --output "${SERVICES_FOLDER}/${service}" \ + --package-name "${service}" \ --enable-post-process-file \ - --git-host ${GIT_HOST} \ - --git-user-id ${GIT_USER_ID} \ - --git-repo-id ${GIT_REPO_ID} \ + --git-host "${GIT_HOST}" \ + --git-user-id "${GIT_USER_ID}" \ + --git-repo-id "${GIT_REPO_ID}" \ --global-property apis,models,modelTests=true,modelDocs=false,apiDocs=false,supportingFiles \ --additional-properties=isGoSubmodule=true,enumClassPrefix=true,generateInterfaces=true,$regional_api \ - --http-user-agent stackit-sdk-go/${service} \ + --http-user-agent "stackit-sdk-go/${service}" \ --reserved-words-mappings type=types \ - --config openapi-generator-config-go.yml + --config "${ROOT_DIR}/languages/golang/openapi-generator-config.yml" # Remove unnecessary files - rm ${SERVICES_FOLDER}/${service}/.openapi-generator-ignore - rm ${SERVICES_FOLDER}/${service}/.openapi-generator/FILES + rm "${SERVICES_FOLDER}/${service}/.openapi-generator-ignore" + rm "${SERVICES_FOLDER}/${service}/.openapi-generator/FILES" # If there's a comment at the start of go.mod, copy it go_mod_backup_path="${sdk_services_backup_dir}/${service}/go.mod" @@ -183,40 +183,40 @@ generate_go_sdk() { fi # Move tests to the service folder - cp ${SERVICES_FOLDER}/${service}/test/* ${SERVICES_FOLDER}/${service} - rm -r ${SERVICES_FOLDER}/${service}/test/ + cp "${SERVICES_FOLDER}"/"${service}"/test/* "${SERVICES_FOLDER}/${service}" + rm -r "${SERVICES_FOLDER}/${service}/test/" # If the service has a wait package files, move them inside the service folder - if [ -d ${sdk_services_backup_dir}/${service}/wait ]; then + if [ -d "${sdk_services_backup_dir}/${service}/wait" ]; then echo "Found ${service} \"wait\" package" - cp -r ${sdk_services_backup_dir}/${service}/wait ${SERVICES_FOLDER}/${service}/wait + cp -r "${sdk_services_backup_dir}/${service}/wait" "${SERVICES_FOLDER}/${service}/wait" fi # If the service has a CHANGELOG file, move it inside the service folder - if [ -f ${sdk_services_backup_dir}/${service}/CHANGELOG.md ]; then + if [ -f "${sdk_services_backup_dir}/${service}/CHANGELOG.md" ]; then echo "Found ${service} \"CHANGELOG\" file" - cp -r ${sdk_services_backup_dir}/${service}/CHANGELOG.md ${SERVICES_FOLDER}/${service}/CHANGELOG.md + cp -r "${sdk_services_backup_dir}/${service}/CHANGELOG.md" "${SERVICES_FOLDER}/${service}/CHANGELOG.md" fi # If the service has a LICENSE file, move it inside the service folder - if [ -f ${sdk_services_backup_dir}/${service}/LICENSE.md ]; then + if [ -f "${sdk_services_backup_dir}/${service}/LICENSE.md" ]; then echo "Found ${service} \"LICENSE\" file" - cp -r ${sdk_services_backup_dir}/${service}/LICENSE.md ${SERVICES_FOLDER}/${service}/LICENSE.md + cp -r "${sdk_services_backup_dir}/${service}/LICENSE.md" "${SERVICES_FOLDER}/${service}/LICENSE.md" fi # If the service has a NOTICE file, move it inside the service folder - if [ -f ${sdk_services_backup_dir}/${service}/NOTICE.txt ]; then + if [ -f "${sdk_services_backup_dir}/${service}/NOTICE.txt" ]; then echo "Found ${service} \"NOTICE\" file" - cp -r ${sdk_services_backup_dir}/${service}/NOTICE.txt ${SERVICES_FOLDER}/${service}/NOTICE.txt + cp -r "${sdk_services_backup_dir}/${service}/NOTICE.txt" "${SERVICES_FOLDER}/${service}/NOTICE.txt" fi # If the service has a VERSION file, move it inside the service folder - if [ -f ${sdk_services_backup_dir}/${service}/VERSION ]; then + if [ -f "${sdk_services_backup_dir}/${service}/VERSION" ]; then echo "Found ${service} \"VERSION\" file" - cp -r ${sdk_services_backup_dir}/${service}/VERSION ${SERVICES_FOLDER}/${service}/VERSION + cp -r "${sdk_services_backup_dir}/${service}/VERSION" "${SERVICES_FOLDER}/${service}/VERSION" fi - cd ${SERVICES_FOLDER}/${service} + cd "${SERVICES_FOLDER}/${service}" go work use . # Make sure that dependencies are uptodate go get -u ./... @@ -224,22 +224,22 @@ generate_go_sdk() { done # Add examples to workspace - if [ -d ${EXAMPLES_FOLDER} ]; then + if [ -d "${EXAMPLES_FOLDER}" ]; then for example_dir in ${EXAMPLES_FOLDER}/*; do - cd ${example_dir} + cd "${example_dir}" go work use . done fi # Add scripts to workspace - if [ -d ${SCRIPTS_FOLDER} ]; then - cd ${SCRIPTS_FOLDER} + if [ -d "${SCRIPTS_FOLDER}" ]; then + cd "${SCRIPTS_FOLDER}" go work use . fi # Cleanup after SDK generation - cd ${SDK_REPO_LOCAL_PATH} - goimports -w ${SERVICES_FOLDER}/ + cd "${SDK_REPO_LOCAL_PATH}" + goimports -w "${SERVICES_FOLDER}/" make sync-tidy if [[ -n "$warning" ]]; then diff --git a/scripts/generate-sdk/languages/java.sh b/scripts/generate-sdk/languages/java.sh index c5171bc..7d67c46 100644 --- a/scripts/generate-sdk/languages/java.sh +++ b/scripts/generate-sdk/languages/java.sh @@ -100,7 +100,7 @@ generate_java_sdk() { continue fi - if grep -E "^$service$" "${ROOT_DIR}/blacklist.txt"; then + if grep -E "^$service$" "${ROOT_DIR}/languages/java/blacklist.txt"; then echo "Skipping blacklisted service ${service}" warning+="Skipping blacklisted service ${service}\n" continue @@ -110,7 +110,7 @@ generate_java_sdk() { cd "${ROOT_DIR}" mkdir -p "${SERVICES_FOLDER}/${service}/" - cp "${ROOT_DIR}/scripts/generate-sdk/.openapi-generator-ignore-java" "${SERVICES_FOLDER}/${service}/.openapi-generator-ignore" + cp "${ROOT_DIR}/languages/java/.openapi-generator-ignore" "${SERVICES_FOLDER}/${service}/.openapi-generator-ignore" SERVICE_DESCRIPTION=$(cat "${service_json}" | jq .info.title --raw-output) @@ -124,8 +124,8 @@ generate_java_sdk() { --git-repo-id "${GIT_REPO_ID}" \ --global-property apis,models,modelTests=false,modelDocs=false,apiDocs=false,apiTests=true,supportingFiles \ --additional-properties="artifactId=${service},artifactDescription=${SERVICE_DESCRIPTION},invokerPackage=cloud.stackit.sdk.${service},modelPackage=cloud.stackit.sdk.${service}.model,apiPackage=cloud.stackit.sdk.${service}.api,serviceName=${service_pascal_case}" >/dev/null \ - --http-user-agent stackit-sdk-java/"${service}" \ - --config openapi-generator-config-java.yml + --http-user-agent stackit-sdk-java/"${service}" \ + --config "${ROOT_DIR}/languages/java/openapi-generator-config.yml" # Rename DefaultApiServiceApi.java to {serviceName}Api.java # This approach is a workaround because the file name cannot be set dynamically via --additional-properties or the config file in OpenAPI Generator. diff --git a/scripts/generate-sdk/languages/python.sh b/scripts/generate-sdk/languages/python.sh index 1296df2..330baee 100644 --- a/scripts/generate-sdk/languages/python.sh +++ b/scripts/generate-sdk/languages/python.sh @@ -92,7 +92,7 @@ generate_python_sdk() { service=$(echo "${service}" | tr '[:upper:]' '[:lower:]') # convert upper case letters to lower case service=$(echo "${service}" | tr -d -c '[:alnum:]') # remove non-alphanumeric characters - if grep -E "^$service$" ${ROOT_DIR}/blacklist.txt; then + if grep -E "^$service$" "${ROOT_DIR}/languages/python/blacklist.txt"; then echo "Skipping blacklisted service ${service}" warning+="Skipping blacklisted service ${service}\n" continue @@ -102,7 +102,7 @@ generate_python_sdk() { cd "${ROOT_DIR}" mkdir -p "${SERVICES_FOLDER}/${service}/" - cp "${ROOT_DIR}/scripts/generate-sdk/.openapi-generator-ignore-python" "${SERVICES_FOLDER}/${service}/.openapi-generator-ignore" + cp "${ROOT_DIR}/languages/python/.openapi-generator-ignore" "${SERVICES_FOLDER}/${service}/.openapi-generator-ignore" # Run the generator java -Dlog.level="${GENERATOR_LOG_LEVEL}" -jar "${jar_path}" generate \ @@ -110,7 +110,7 @@ generate_python_sdk() { --input-spec "${service_json}" \ --output "${SERVICES_FOLDER}/${service}" \ --package-name "stackit.${service}" \ - --template-dir "${ROOT_DIR}/templates/python/" \ + --template-dir "${ROOT_DIR}/languages/python/templates/" \ --git-host "${GIT_HOST}" \ --git-user-id "${GIT_USER_ID}" \ --git-repo-id "${GIT_REPO_ID}" \ diff --git a/templates/go/.travis.yml b/templates/go/.travis.yml deleted file mode 100644 index f5cb2ce..0000000 --- a/templates/go/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go - -install: - - go get -d -v . - -script: - - go build -v ./ -