openapi-generator/samples/server/petstore/cpp-pistache
stkrwork 23ab5177b3 [C++][Pistache] Fix optional error and wrong function signatures (#264)
* Added missing includes for optional

* Removed shared pointer from pistache generator

* Changed Net namespace to Pistache Namespace

* Clean up code and removed unnecessary lines in mustache files

* Removed remaining shared pointer syntax

* Code review fixes + updated samples

* Added const to all model setter functions, and reference to all params in setters that are not primitives

* Refactored modelbase

* Removed const

* Updated samples
2018-06-22 09:12:35 +08:00
..
.openapi-generator [C++][Pistache] Fix optional error and wrong function signatures (#264) 2018-06-22 09:12:35 +08:00
api [C++][Pistache] Fix optional error and wrong function signatures (#264) 2018-06-22 09:12:35 +08:00
impl [C++][Pistache] Fix optional error and wrong function signatures (#264) 2018-06-22 09:12:35 +08:00
model [C++][Pistache] Fix optional error and wrong function signatures (#264) 2018-06-22 09:12:35 +08:00
.openapi-generator-ignore [C++ server] Adjust the names (script, sample folder, generator) to lang option (#250) 2018-06-10 22:48:30 +08:00
CMakeLists.txt [C++ server] Adjust the names (script, sample folder, generator) to lang option (#250) 2018-06-10 22:48:30 +08:00
PetApiMainServer.cpp [C++ server] Adjust the names (script, sample folder, generator) to lang option (#250) 2018-06-10 22:48:30 +08:00
README.md [C++ server] Adjust the names (script, sample folder, generator) to lang option (#250) 2018-06-10 22:48:30 +08:00
StoreApiMainServer.cpp [C++ server] Adjust the names (script, sample folder, generator) to lang option (#250) 2018-06-10 22:48:30 +08:00
UserApiMainServer.cpp [C++ server] Adjust the names (script, sample folder, generator) to lang option (#250) 2018-06-10 22:48:30 +08:00

REST API Server for OpenAPI Petstore

Overview

This API Server was generated by the OpenAPI Generator project. It uses the Pistache Framework.

Files organization

The Pistache C++ REST server generator creates three folders:

  • api: This folder contains the handlers for each method specified in the OpenAPI definition. Every handler extracts the path and body parameters (if any) from the requests and tries to parse and possibly validate them. Once this step is completed, the main API class calls the corresponding abstract method that should be implemented by the developer (a basic implementation is provided under the impl folder)
  • impl: As written above, the implementation folder contains, for each API, the corresponding implementation class, which extends the main API class and implements the abstract methods. Every method receives the path and body parameters as constant reference variables and a reference to the response object, that should be filled with the right response and sent at the end of the method with the command: response.send(returnCode, responseBody, [mimeType])
  • model: This folder contains the corresponding class for every object schema found in the OpenAPI specification.

The main folder contains also a file with a main that can be used to start the server. Of course, is you should customize this file based on your needs

Installation

First of all, you need to download and install the libraries listed here.

Once the libraries are installed, in order to compile and run the server please follow the steps below:

mkdir build
cd build
cmake ..
make

Once compiled run the server:

cd build
./server

Libraries required

Namespaces

org.openapitools.server.api org.openapitools.server.model