Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !553

[cpp-restsdk] Relative include paths

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/zooxco/daniel/cpprestsdk_relative_filepaths into master 7 years ago
  • Overview 0
  • Commits 5
  • Pipelines 0
  • Changes 40

Created by: Peaches491

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.1.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Enables proper relative imports in cpp-restsdk generated code. This allows users to compile the C++ without any alterations to the import paths, making the codegen'd code more self-contained.

  • Updates the cpp-restsdk petstore example, by running cpp-restsdk-petstore.sh.
  • Removes the now-unnecessary import_directories in the generated CMakeLists.txt file.
Compare
  • master (base)

and
  • latest version
    69184d5e
    5 commits, 2 years ago

40 files
+ 61
- 60

    Preferences

    File browser
    Compare changes
modules/openapi-g‎enerator/src/main‎
java/org/openapitoo‎ls/codegen/languages‎
CppRestSdkClie‎ntCodegen.java‎ +3 -2
resources/cpp-‎rest-sdk-client‎
api-sourc‎e.mustache‎ +3 -3
cmake-list‎s.mustache‎ +1 -1
samples/client/pe‎tstore/cpp-restsdk‎
.openapi-‎generator‎
VER‎SION‎ +1 -1
a‎pi‎
PetAp‎i.cpp‎ +4 -4
PetA‎pi.h‎ +4 -4
StoreA‎pi.cpp‎ +4 -4
Store‎Api.h‎ +2 -2
UserA‎pi.cpp‎ +4 -4
User‎Api.h‎ +2 -2
mo‎del‎
ApiResp‎onse.cpp‎ +1 -1
ApiRes‎ponse.h‎ +1 -1
Catego‎ry.cpp‎ +1 -1
Categ‎ory.h‎ +1 -1
Orde‎r.cpp‎ +1 -1
Ord‎er.h‎ +1 -1
Pet‎.cpp‎ +1 -1
Pe‎t.h‎ +3 -3
Tag‎.cpp‎ +1 -1
Ta‎g.h‎ +1 -1
User‎.cpp‎ +1 -1
Use‎r.h‎ +1 -1
ApiCli‎ent.cpp‎ +1 -1
ApiCl‎ient.h‎ +1 -1
ApiConfigu‎ration.cpp‎ +1 -1
ApiConfig‎uration.h‎ +1 -1
ApiExcep‎tion.cpp‎ +1 -1
ApiExce‎ption.h‎ +1 -1
CMakeLi‎sts.txt‎ +1 -1
HttpCon‎tent.cpp‎ +1 -1
HttpCo‎ntent.h‎ +1 -1
IHttp‎Body.h‎ +1 -1
JsonBo‎dy.cpp‎ +1 -1
JsonB‎ody.h‎ +1 -1
ModelB‎ase.cpp‎ +1 -1
Model‎Base.h‎ +1 -1
MultipartF‎ormData.cpp‎ +1 -1
Multipart‎FormData.h‎ +2 -2
Objec‎t.cpp‎ +1 -1
Obje‎ct.h‎ +1 -1
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java
+ 3
- 2
  • View file @ 69184d5e


@@ -158,7 +158,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
@@ -158,7 +158,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
importMapping.put("std::vector", "#include <vector>");
importMapping.put("std::vector", "#include <vector>");
importMapping.put("std::map", "#include <map>");
importMapping.put("std::map", "#include <map>");
importMapping.put("std::string", "#include <string>");
importMapping.put("std::string", "#include <string>");
importMapping.put("HttpContent", "#include \"HttpContent.h\"");
importMapping.put("HttpContent", "#include \"../HttpContent.h\"");
importMapping.put("Object", "#include \"Object.h\"");
importMapping.put("Object", "#include \"Object.h\"");
importMapping.put("utility::string_t", "#include <cpprest/details/basic_types.h>");
importMapping.put("utility::string_t", "#include <cpprest/details/basic_types.h>");
importMapping.put("utility::datetime", "#include <cpprest/details/basic_types.h>");
importMapping.put("utility::datetime", "#include <cpprest/details/basic_types.h>");
@@ -208,7 +208,8 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
@@ -208,7 +208,8 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
if (importMapping.containsKey(name)) {
if (importMapping.containsKey(name)) {
return importMapping.get(name);
return importMapping.get(name);
} else {
} else {
return "#include \"" + name + ".h\"";
// Use relative imports unless this model is explicitly import-mapped.
 
return "#include \"../model/" + name + ".h\"";
}
}
}
}
modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-source.mustache
+ 3
- 3
  • View file @ 69184d5e


@@ -2,9 +2,9 @@
@@ -2,9 +2,9 @@
{{#operations}}
{{#operations}}
#include "{{classname}}.h"
#include "{{classname}}.h"
#include "IHttpBody.h"
#include "../IHttpBody.h"
#include "JsonBody.h"
#include "../JsonBody.h"
#include "MultipartFormData.h"
#include "../MultipartFormData.h"
#include <unordered_set>
#include <unordered_set>
modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache
+ 1
- 1
  • View file @ 69184d5e


@@ -39,7 +39,7 @@ if( NOT DEFINED CPPREST_ROOT )
@@ -39,7 +39,7 @@ if( NOT DEFINED CPPREST_ROOT )
message( FATAL_ERROR "Failed to find cpprest SDK (or missing components). Double check that \"CPPREST_ROOT\" is properly set")
message( FATAL_ERROR "Failed to find cpprest SDK (or missing components). Double check that \"CPPREST_ROOT\" is properly set")
endif( NOT DEFINED CPPREST_ROOT )
endif( NOT DEFINED CPPREST_ROOT )
include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR})
include_directories(${PROJECT_SOURCE_DIR} ${CPPREST_INCLUDE_DIR})
#SUPPORTING FILES
#SUPPORTING FILES
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
samples/client/petstore/cpp-restsdk/.openapi-generator/VERSION
+ 1
- 1
  • View file @ 69184d5e

3.0.0-SNAPSHOT
3.1.1-SNAPSHOT
\ No newline at end of file
\ No newline at end of file
samples/client/petstore/cpp-restsdk/api/PetApi.cpp
+ 4
- 4
  • View file @ 69184d5e


@@ -4,16 +4,16 @@
@@ -4,16 +4,16 @@
*
*
* OpenAPI spec version: 1.0.0
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT.
* NOTE: This class is auto generated by OpenAPI-Generator 3.1.1-SNAPSHOT.
* https://openapi-generator.tech
* https://openapi-generator.tech
* Do not edit the class manually.
* Do not edit the class manually.
*/
*/
#include "PetApi.h"
#include "PetApi.h"
#include "IHttpBody.h"
#include "../IHttpBody.h"
#include "JsonBody.h"
#include "../JsonBody.h"
#include "MultipartFormData.h"
#include "../MultipartFormData.h"
#include <unordered_set>
#include <unordered_set>
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
Client: Elixir Enhancement: General
2
Client: Elixir Enhancement: General
    Assign labels
  • Manage project labels

Milestone
5.0.0
5.0.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!7803
Source branch: github/fork/zooxco/daniel/cpprestsdk_relative_filepaths

Menu

Explore Projects Groups Snippets