From 01d2ee37402698427d39ffa1fd092bc121cb5c03 Mon Sep 17 00:00:00 2001 From: Alex Weaver <alex.weaver@ni.com> Date: Mon, 10 Feb 2020 15:18:31 -0600 Subject: [PATCH 1/5] Don't use plain underscore when escaping reserved words --- .../org/openapitools/codegen/languages/AbstractCppCodegen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java index c49f5681e5d..5f446294f14 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java @@ -201,7 +201,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } - return sanitizeName("_" + name); + return sanitizeName("r_" + name); } @Override -- GitLab From 6460eb105f75f6314b6b65f2111471df7a36474d Mon Sep 17 00:00:00 2001 From: Alex Weaver <alex.weaver@ni.com> Date: Mon, 10 Feb 2020 15:22:46 -0600 Subject: [PATCH 2/5] Regenerate petstore output --- .../cpp-restsdk/client/.openapi-generator/VERSION | 2 +- .../petstore/cpp-restsdk/client/ApiClient.cpp | 2 +- .../petstore/cpp-restsdk/client/ApiClient.h | 2 +- .../cpp-restsdk/client/ApiConfiguration.cpp | 2 +- .../cpp-restsdk/client/ApiConfiguration.h | 2 +- .../petstore/cpp-restsdk/client/ApiException.cpp | 2 +- .../petstore/cpp-restsdk/client/ApiException.h | 2 +- .../petstore/cpp-restsdk/client/HttpContent.cpp | 2 +- .../petstore/cpp-restsdk/client/HttpContent.h | 2 +- .../petstore/cpp-restsdk/client/IHttpBody.h | 2 +- .../petstore/cpp-restsdk/client/JsonBody.cpp | 2 +- .../client/petstore/cpp-restsdk/client/JsonBody.h | 2 +- .../petstore/cpp-restsdk/client/ModelBase.cpp | 2 +- .../petstore/cpp-restsdk/client/ModelBase.h | 2 +- .../cpp-restsdk/client/MultipartFormData.cpp | 2 +- .../cpp-restsdk/client/MultipartFormData.h | 2 +- .../client/petstore/cpp-restsdk/client/Object.cpp | 2 +- .../client/petstore/cpp-restsdk/client/Object.h | 2 +- .../petstore/cpp-restsdk/client/api/PetApi.cpp | 2 +- .../petstore/cpp-restsdk/client/api/PetApi.h | 2 +- .../petstore/cpp-restsdk/client/api/StoreApi.cpp | 2 +- .../petstore/cpp-restsdk/client/api/StoreApi.h | 2 +- .../petstore/cpp-restsdk/client/api/UserApi.cpp | 2 +- .../petstore/cpp-restsdk/client/api/UserApi.h | 2 +- .../petstore/cpp-restsdk/client/git_push.sh | 15 +++++++++++---- .../cpp-restsdk/client/model/ApiResponse.cpp | 2 +- .../cpp-restsdk/client/model/ApiResponse.h | 2 +- .../cpp-restsdk/client/model/Category.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Category.h | 2 +- .../petstore/cpp-restsdk/client/model/Order.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Order.h | 2 +- .../petstore/cpp-restsdk/client/model/Pet.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Pet.h | 2 +- .../petstore/cpp-restsdk/client/model/Tag.cpp | 2 +- .../petstore/cpp-restsdk/client/model/Tag.h | 2 +- .../petstore/cpp-restsdk/client/model/User.cpp | 2 +- .../petstore/cpp-restsdk/client/model/User.h | 2 +- 37 files changed, 47 insertions(+), 40 deletions(-) diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION index 83a328a9227..bfbf77eb7fa 100644 --- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION +++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/VERSION @@ -1 +1 @@ -4.1.0-SNAPSHOT \ No newline at end of file +4.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp index 7aa7c87fc28..dfc97c8313d 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiClient.h b/samples/client/petstore/cpp-restsdk/client/ApiClient.h index bfabf55ec9b..99a4810def1 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiClient.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp index 0d8f3fde31c..b17f26a2b34 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h index 45b5145ab79..96b127bfd64 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiException.cpp b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp index aae7fcd050c..e15af69bb03 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiException.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ApiException.h b/samples/client/petstore/cpp-restsdk/client/ApiException.h index 8be47599399..146c84e88ef 100644 --- a/samples/client/petstore/cpp-restsdk/client/ApiException.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp index 7664053f202..92289ec7ad1 100644 --- a/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/HttpContent.h b/samples/client/petstore/cpp-restsdk/client/HttpContent.h index 2024da6764e..fefd179c25a 100644 --- a/samples/client/petstore/cpp-restsdk/client/HttpContent.h +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/IHttpBody.h b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h index 4bcd03e1006..f941649a65e 100644 --- a/samples/client/petstore/cpp-restsdk/client/IHttpBody.h +++ b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp index 19e60971c57..59c7c2d6d87 100644 --- a/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/JsonBody.h b/samples/client/petstore/cpp-restsdk/client/JsonBody.h index f8011a08da6..39a3b22617a 100644 --- a/samples/client/petstore/cpp-restsdk/client/JsonBody.h +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp index 940b9884d23..d3fd80b5544 100644 --- a/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/ModelBase.h index 91eed9bc776..2d33fbe33cb 100644 --- a/samples/client/petstore/cpp-restsdk/client/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp index d38042f15cb..5e840c1acbb 100644 --- a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h index e94e4487953..fac570cc749 100644 --- a/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/Object.cpp b/samples/client/petstore/cpp-restsdk/client/Object.cpp index d148cb427e8..6c0e441a9fc 100644 --- a/samples/client/petstore/cpp-restsdk/client/Object.cpp +++ b/samples/client/petstore/cpp-restsdk/client/Object.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/Object.h b/samples/client/petstore/cpp-restsdk/client/Object.h index 191d17e2cc7..6f3a186ba51 100644 --- a/samples/client/petstore/cpp-restsdk/client/Object.h +++ b/samples/client/petstore/cpp-restsdk/client/Object.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp index c5c68011d17..d45c89f1983 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h index 422ad2afee8..e44b3922d0b 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp index a1651f3a160..66e469136e4 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h index a13033db76a..0a5cbe98d9f 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp index ac5933dde09..b5a0835cf0b 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h index ede5f2937c7..e078ee104aa 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/git_push.sh b/samples/client/petstore/cpp-restsdk/client/git_push.sh index 14171b3f814..ced3be2b0c7 100644 --- a/samples/client/petstore/cpp-restsdk/client/git_push.sh +++ b/samples/client/petstore/cpp-restsdk/client/git_push.sh @@ -1,11 +1,17 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-cpprest "minor update" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi if [ "$git_user_id" = "" ]; then git_user_id="GIT_USER_ID" @@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -47,5 +53,6 @@ fi git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp index 2fa289ebd99..2e1ba85a6c2 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h index 6567d7a82c8..530171c4aa7 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp index c181f0ba6fa..e710f6448c9 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Category.h b/samples/client/petstore/cpp-restsdk/client/model/Category.h index d12c200ca70..f35054c6d45 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp index 2d869abdd45..f3f6659de71 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Order.h b/samples/client/petstore/cpp-restsdk/client/model/Order.h index b678f43361e..d1d2239d7f8 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp index f82d856aaac..c2387635bd5 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/model/Pet.h index 5c8a9ddaedf..bbc0a09cac6 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp index 9b46c05f0d7..b1a7598237e 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/model/Tag.h index 921d17672be..a9153548fbd 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/model/User.cpp index ace766573f3..f0fa581f868 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/User.cpp @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/model/User.h b/samples/client/petstore/cpp-restsdk/client/model/User.h index ce0fea2d166..b66202fccfa 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/model/User.h @@ -4,7 +4,7 @@ * * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.1.3-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.3.0-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ -- GitLab From 32b2d95601478a98c2b2c6ae483546d57fc15999 Mon Sep 17 00:00:00 2001 From: Alex Weaver <alex.weaver@ni.com> Date: Fri, 21 Feb 2020 13:42:14 -0600 Subject: [PATCH 3/5] Add CLI option for reserved word prefix --- .../codegen/languages/AbstractCppCodegen.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java index 5f446294f14..913ca59897f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java @@ -40,6 +40,9 @@ import java.util.Map; abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class); + protected static final String RESERVED_WORD_PREFIX_OPTION = "reservedWordPrefix"; + protected String reservedWordPrefix = "r_"; + public AbstractCppCodegen() { super(); @@ -136,6 +139,9 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg "xor", "xor_eq") ); + + addOption(RESERVED_WORD_PREFIX_OPTION, "Prefix to prepend to reserved words in order to avoid conflicts", + this.reservedWordPrefix); } @Override @@ -201,7 +207,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } - return sanitizeName("r_" + name); + return sanitizeName(reservedWordPrefix + name); } @Override @@ -260,6 +266,12 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg LOGGER.info("Environment variable CPP_POST_PROCESS_FILE not defined so the C++ code may not be properly formatted. To define it, try 'export CPP_POST_PROCESS_FILE=\"/usr/local/bin/clang-format -i\"' (Linux/Mac)"); LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); } + + if (additionalProperties.containsKey(RESERVED_WORD_PREFIX_OPTION)) { + reservedWordPrefix = (String) additionalProperties.get(RESERVED_WORD_PREFIX_OPTION); + } else { + additionalProperties.put(RESERVED_WORD_PREFIX_OPTION, reservedWordPrefix); + } } @Override -- GitLab From f6c6af464ccabb44f56c73b30b075d9a6547b4d3 Mon Sep 17 00:00:00 2001 From: Alex Weaver <alex.weaver@ni.com> Date: Fri, 21 Feb 2020 14:06:37 -0600 Subject: [PATCH 4/5] Ensure CLI option isn't cleared in cpprest client codegen --- .../codegen/languages/AbstractCppCodegen.java | 10 ++++++---- .../codegen/languages/CppRestSdkClientCodegen.java | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java index 913ca59897f..6946b87a1d2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCppCodegen.java @@ -41,6 +41,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class); protected static final String RESERVED_WORD_PREFIX_OPTION = "reservedWordPrefix"; + protected static final String RESERVED_WORD_PREFIX_DESC = "Prefix to prepend to reserved words in order to avoid conflicts"; protected String reservedWordPrefix = "r_"; public AbstractCppCodegen() { @@ -140,8 +141,9 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg "xor_eq") ); - addOption(RESERVED_WORD_PREFIX_OPTION, "Prefix to prepend to reserved words in order to avoid conflicts", - this.reservedWordPrefix); + addOption(RESERVED_WORD_PREFIX_OPTION, + RESERVED_WORD_PREFIX_DESC, + this.reservedWordPrefix); } @Override @@ -269,9 +271,9 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg if (additionalProperties.containsKey(RESERVED_WORD_PREFIX_OPTION)) { reservedWordPrefix = (String) additionalProperties.get(RESERVED_WORD_PREFIX_OPTION); - } else { - additionalProperties.put(RESERVED_WORD_PREFIX_OPTION, reservedWordPrefix); } + + additionalProperties.put(RESERVED_WORD_PREFIX_OPTION, reservedWordPrefix); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index 8058932f911..90e5d377c5c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -129,6 +129,9 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { addOption(GENERATE_GMOCKS_FOR_APIS, "Generate Google Mock classes for APIs.", null); + addOption(RESERVED_WORD_PREFIX_OPTION, + RESERVED_WORD_PREFIX_DESC, + this.reservedWordPrefix); supportingFiles.add(new SupportingFile("modelbase-header.mustache", "", "ModelBase.h")); supportingFiles.add(new SupportingFile("modelbase-source.mustache", "", "ModelBase.cpp")); @@ -194,6 +197,10 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { defaultInclude = additionalProperties.get(DEFAULT_INCLUDE).toString(); } + if (additionalProperties.containsKey(RESERVED_WORD_PREFIX_OPTION)) { + reservedWordPrefix = (String) additionalProperties.get(RESERVED_WORD_PREFIX_OPTION); + } + if (convertPropertyToBoolean(GENERATE_GMOCKS_FOR_APIS)) { apiTemplateFiles.put("api-gmock.mustache", "GMock.h"); additionalProperties.put("gmockApis", "true"); @@ -207,6 +214,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { additionalProperties.put("apiHeaderGuardPrefix", apiPackage.replaceAll("\\.", "_").toUpperCase(Locale.ROOT)); additionalProperties.put("declspec", declspec); additionalProperties.put("defaultInclude", defaultInclude); + additionalProperties.put(RESERVED_WORD_PREFIX_OPTION, reservedWordPrefix); } /** -- GitLab From 9a5787bedbd7803d4ac325f01dfbc82f21fde0c8 Mon Sep 17 00:00:00 2001 From: Alex Weaver <alex.weaver@ni.com> Date: Fri, 21 Feb 2020 16:05:22 -0600 Subject: [PATCH 5/5] Regenerate docs --- docs/generators/cpp-qt5-client.md | 1 + docs/generators/cpp-qt5-qhttpengine-server.md | 1 + docs/generators/cpp-restsdk.md | 1 + docs/generators/cpp-tizen.md | 1 + 4 files changed, 4 insertions(+) diff --git a/docs/generators/cpp-qt5-client.md b/docs/generators/cpp-qt5-client.md index 2d510c95849..996c5df4851 100644 --- a/docs/generators/cpp-qt5-client.md +++ b/docs/generators/cpp-qt5-client.md @@ -12,6 +12,7 @@ sidebar_label: cpp-qt5-client |modelNamePrefix|Prefix that will be prepended to all model names.| |OAI| |optionalProjectFile|Generate client.pri.| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| diff --git a/docs/generators/cpp-qt5-qhttpengine-server.md b/docs/generators/cpp-qt5-qhttpengine-server.md index 2b4ca0653f6..a1ebea367fd 100644 --- a/docs/generators/cpp-qt5-qhttpengine-server.md +++ b/docs/generators/cpp-qt5-qhttpengine-server.md @@ -11,6 +11,7 @@ sidebar_label: cpp-qt5-qhttpengine-server |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |modelNamePrefix|Prefix that will be prepended to all model names.| |OAI| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| diff --git a/docs/generators/cpp-restsdk.md b/docs/generators/cpp-restsdk.md index 9a368d34bdc..e9aef630708 100644 --- a/docs/generators/cpp-restsdk.md +++ b/docs/generators/cpp-restsdk.md @@ -11,6 +11,7 @@ sidebar_label: cpp-restsdk |generateGMocksForApis|Generate Google Mock classes for APIs.| |null| |modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.client.model| |packageVersion|C++ package version.| |1.0.0| +|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| ## IMPORT MAPPING diff --git a/docs/generators/cpp-tizen.md b/docs/generators/cpp-tizen.md index 58bc494e67b..51668f97298 100644 --- a/docs/generators/cpp-tizen.md +++ b/docs/generators/cpp-tizen.md @@ -8,6 +8,7 @@ sidebar_label: cpp-tizen |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| -- GitLab