Skip to content

Commit 8862b96

Browse files
authored
Add cpp-oatpp-server generator (alpha) (#21547)
* Oat++ Server Generator (C++) * Fixed for support for newest OpenAPI version. * ALPHA not STABLE. * Fixed for support for newest OpenAPI version. * Added github workflow & changed to OA3 Petstore. * Good catch on adding the Workflow. * Might help to update the samples. * Set C++ Standard the CMake way. * Would be easier if there was a .pc file. * oatpp.lib. * Add ws2. * This probably doesn't work, need to take a time out.
1 parent 64ab13a commit 8862b96

38 files changed

+2736
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Samples cpp oat++ server
2+
3+
on:
4+
push:
5+
branches:
6+
- "samples/server/petstore/cpp-oatpp/**"
7+
pull_request:
8+
paths:
9+
- "samples/server/petstore/cpp-oatpp/**"
10+
11+
env:
12+
GRADLE_VERSION: 6.9
13+
14+
jobs:
15+
build:
16+
name: Build cpp qt client
17+
strategy:
18+
matrix:
19+
sample:
20+
- samples/server/petstore/cpp-oatpp
21+
os:
22+
- ubuntu-latest
23+
- macOS-latest
24+
- windows-latest
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Build
29+
working-directory: ${{ matrix.sample }}
30+
run: cmake -B build && cmake --build build --verbose

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
9292
| | Languages/Frameworks |
9393
| -------------------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
9494
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, Spring 6 RestClient, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient, pekko), **Swift** (2.x, 3.x, 4.x, 5.x, 6.x), **Typescript** (AngularJS, Angular (9.x - 19.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo**, **Zapier** |
95-
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
95+
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Oat++, Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** ([Flight](https://docs.flightphp.com/), Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), [Cask](https://github.com/com-lihaoyi/cask), Scalatra) |
9696
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
9797
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
9898
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Postman Collection**, **Protocol Buffer**, **WSDL** |
@@ -1128,6 +1128,7 @@ Here is a list of template creators:
11281128
* C# Azure functions: @Abrhm7786
11291129
* C# NancyFX: @mstefaniuk
11301130
* C++ (Qt5 QHttpEngine): @etherealjoy
1131+
* C++ Oat++: @Kraust
11311132
* C++ Pistache: @sebymiano
11321133
* C++ Restbed: @stkrwork
11331134
* Erlang Server: @galaxie @nelsonvides
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generatorName: cpp-oatpp-server
2+
outputDir: samples/server/petstore/cpp-oatpp
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/cpp-oatpp-server
5+
additionalProperties:
6+
addExternalLibs: "true"

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ The following generators are available:
8787
* [ada-server](generators/ada-server.md)
8888
* [aspnet-fastendpoints](generators/aspnet-fastendpoints.md)
8989
* [aspnetcore](generators/aspnetcore.md)
90+
* [cpp-oatpp-server](generators/cpp-oatpp-server.md)
9091
* [cpp-pistache-server](generators/cpp-pistache-server.md)
9192
* [cpp-qt-qhttpengine-server](generators/cpp-qt-qhttpengine-server.md)
9293
* [cpp-restbed-server](generators/cpp-restbed-server.md)

docs/generators/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The following generators are available:
6565
## SERVER generators
6666
* [ada-server](ada-server.md)
6767
* [aspnetcore](aspnetcore.md)
68+
* [cpp-oatpp-server](cpp-oatpp-server.md)
6869
* [cpp-pistache-server](cpp-pistache-server.md)
6970
* [cpp-qt5-qhttpengine-server](cpp-qt5-qhttpengine-server.md)
7071
* [cpp-restbed-server](cpp-restbed-server.md)

docs/generators/cpp-oatpp-server.md

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
---
2+
title: Documentation for the cpp-oatpp-server Generator
3+
---
4+
5+
## METADATA
6+
7+
| Property | Value | Notes |
8+
| -------- | ----- | ----- |
9+
| generator name | cpp-oatpp-server | pass this to the generate command after -g |
10+
| generator stability | STABLE | |
11+
| generator type | SERVER | |
12+
| generator language | C++ | |
13+
| generator default templating engine | mustache | |
14+
| helpTxt | Generates a C++ API server (based on Oat++) | |
15+
16+
## CONFIG OPTIONS
17+
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
18+
19+
| Option | Description | Values | Default |
20+
| ------ | ----------- | ------ | ------- |
21+
|addExternalLibs|Add the Possibility to fetch and compile external Libraries needed by this Framework.| |true|
22+
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
23+
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true|
24+
25+
## IMPORT MAPPING
26+
27+
| Type/Alias | Imports |
28+
| ---------- | ------- |
29+
30+
31+
## INSTANTIATION TYPES
32+
33+
| Type/Alias | Instantiated By |
34+
| ---------- | --------------- |
35+
36+
37+
## LANGUAGE PRIMITIVES
38+
39+
<ul class="column-ul">
40+
<li>oatpp::Any</li>
41+
<li>oatpp::Boolean</li>
42+
<li>oatpp::Fields</li>
43+
<li>oatpp::Float64</li>
44+
<li>oatpp::Int32</li>
45+
<li>oatpp::Int64</li>
46+
<li>oatpp::Object</li>
47+
<li>oatpp::String</li>
48+
<li>oatpp::UnorderedSet</li>
49+
<li>oatpp::Vector</li>
50+
</ul>
51+
52+
## RESERVED WORDS
53+
54+
<ul class="column-ul">
55+
<li>NULL</li>
56+
<li>alignas</li>
57+
<li>alignof</li>
58+
<li>and</li>
59+
<li>and_eq</li>
60+
<li>asm</li>
61+
<li>auto</li>
62+
<li>bitand</li>
63+
<li>bitor</li>
64+
<li>bool</li>
65+
<li>break</li>
66+
<li>case</li>
67+
<li>catch</li>
68+
<li>char</li>
69+
<li>char16_t</li>
70+
<li>char32_t</li>
71+
<li>class</li>
72+
<li>compl</li>
73+
<li>concept</li>
74+
<li>const</li>
75+
<li>const_cast</li>
76+
<li>constexpr</li>
77+
<li>continue</li>
78+
<li>decltype</li>
79+
<li>default</li>
80+
<li>delete</li>
81+
<li>do</li>
82+
<li>double</li>
83+
<li>dynamic_cast</li>
84+
<li>else</li>
85+
<li>enum</li>
86+
<li>explicit</li>
87+
<li>export</li>
88+
<li>extern</li>
89+
<li>false</li>
90+
<li>float</li>
91+
<li>for</li>
92+
<li>friend</li>
93+
<li>goto</li>
94+
<li>if</li>
95+
<li>inline</li>
96+
<li>int</li>
97+
<li>linux</li>
98+
<li>long</li>
99+
<li>mutable</li>
100+
<li>namespace</li>
101+
<li>new</li>
102+
<li>noexcept</li>
103+
<li>not</li>
104+
<li>not_eq</li>
105+
<li>nullptr</li>
106+
<li>operator</li>
107+
<li>or</li>
108+
<li>or_eq</li>
109+
<li>private</li>
110+
<li>protected</li>
111+
<li>public</li>
112+
<li>register</li>
113+
<li>reinterpret_cast</li>
114+
<li>requires</li>
115+
<li>return</li>
116+
<li>short</li>
117+
<li>signed</li>
118+
<li>sizeof</li>
119+
<li>static</li>
120+
<li>static_assert</li>
121+
<li>static_cast</li>
122+
<li>struct</li>
123+
<li>switch</li>
124+
<li>template</li>
125+
<li>this</li>
126+
<li>thread_local</li>
127+
<li>throw</li>
128+
<li>true</li>
129+
<li>try</li>
130+
<li>typedef</li>
131+
<li>typeid</li>
132+
<li>typename</li>
133+
<li>union</li>
134+
<li>unsigned</li>
135+
<li>using</li>
136+
<li>virtual</li>
137+
<li>void</li>
138+
<li>volatile</li>
139+
<li>wchar_t</li>
140+
<li>while</li>
141+
<li>xor</li>
142+
<li>xor_eq</li>
143+
</ul>
144+
145+
## FEATURE SET
146+
147+
148+
### Client Modification Feature
149+
| Name | Supported | Defined By |
150+
| ---- | --------- | ---------- |
151+
|BasePath|✗|ToolingExtension
152+
|Authorizations|✗|ToolingExtension
153+
|UserAgent|✗|ToolingExtension
154+
|MockServer|✗|ToolingExtension
155+
156+
### Data Type Feature
157+
| Name | Supported | Defined By |
158+
| ---- | --------- | ---------- |
159+
|Custom|✗|OAS2,OAS3
160+
|Int32|✓|OAS2,OAS3
161+
|Int64|✓|OAS2,OAS3
162+
|Float|✓|OAS2,OAS3
163+
|Double|✓|OAS2,OAS3
164+
|Decimal|✓|ToolingExtension
165+
|String|✓|OAS2,OAS3
166+
|Byte|✓|OAS2,OAS3
167+
|Binary|✓|OAS2,OAS3
168+
|Boolean|✓|OAS2,OAS3
169+
|Date|✓|OAS2,OAS3
170+
|DateTime|✓|OAS2,OAS3
171+
|Password|✓|OAS2,OAS3
172+
|File|✓|OAS2
173+
|Uuid||
174+
|Array|✓|OAS2,OAS3
175+
|Null|✗|OAS3
176+
|AnyType|✗|OAS2,OAS3
177+
|Object|✓|OAS2,OAS3
178+
|Maps|✓|ToolingExtension
179+
|CollectionFormat|✓|OAS2
180+
|CollectionFormatMulti|✓|OAS2
181+
|Enum|✓|OAS2,OAS3
182+
|ArrayOfEnum|✓|ToolingExtension
183+
|ArrayOfModel|✓|ToolingExtension
184+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
185+
|ArrayOfCollectionOfModel|✓|ToolingExtension
186+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
187+
|MapOfEnum|✓|ToolingExtension
188+
|MapOfModel|✓|ToolingExtension
189+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
190+
|MapOfCollectionOfModel|✓|ToolingExtension
191+
|MapOfCollectionOfEnum|✓|ToolingExtension
192+
193+
### Documentation Feature
194+
| Name | Supported | Defined By |
195+
| ---- | --------- | ---------- |
196+
|Readme|✓|ToolingExtension
197+
|Model|✓|ToolingExtension
198+
|Api|✓|ToolingExtension
199+
200+
### Global Feature
201+
| Name | Supported | Defined By |
202+
| ---- | --------- | ---------- |
203+
|Host|✓|OAS2,OAS3
204+
|BasePath|✓|OAS2,OAS3
205+
|Info|✓|OAS2,OAS3
206+
|Schemes|✗|OAS2,OAS3
207+
|PartialSchemes|✓|OAS2,OAS3
208+
|Consumes|✓|OAS2
209+
|Produces|✓|OAS2
210+
|ExternalDocumentation|✓|OAS2,OAS3
211+
|Examples|✓|OAS2,OAS3
212+
|XMLStructureDefinitions|✗|OAS2,OAS3
213+
|MultiServer|✗|OAS3
214+
|ParameterizedServer|✗|OAS3
215+
|ParameterStyling|✗|OAS3
216+
|Callbacks|✗|OAS3
217+
|LinkObjects|✗|OAS3
218+
219+
### Parameter Feature
220+
| Name | Supported | Defined By |
221+
| ---- | --------- | ---------- |
222+
|Path|✓|OAS2,OAS3
223+
|Query|✓|OAS2,OAS3
224+
|Header|✓|OAS2,OAS3
225+
|Body|✓|OAS2
226+
|FormUnencoded|✓|OAS2
227+
|FormMultipart|✓|OAS2
228+
|Cookie|✗|OAS3
229+
230+
### Schema Support Feature
231+
| Name | Supported | Defined By |
232+
| ---- | --------- | ---------- |
233+
|Simple|✓|OAS2,OAS3
234+
|Composite|✓|OAS2,OAS3
235+
|Polymorphism|✗|OAS2,OAS3
236+
|Union|✗|OAS3
237+
|allOf|✗|OAS2,OAS3
238+
|anyOf|✗|OAS3
239+
|oneOf|✗|OAS3
240+
|not|✗|OAS3
241+
242+
### Security Feature
243+
| Name | Supported | Defined By |
244+
| ---- | --------- | ---------- |
245+
|BasicAuth|✗|OAS2,OAS3
246+
|ApiKey|✗|OAS2,OAS3
247+
|OpenIDConnect|✗|OAS3
248+
|BearerToken|✗|OAS3
249+
|OAuth2_Implicit|✗|OAS2,OAS3
250+
|OAuth2_Password|✗|OAS2,OAS3
251+
|OAuth2_ClientCredentials|✗|OAS2,OAS3
252+
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
253+
|SignatureAuth|✗|OAS3
254+
|AWSV4Signature|✗|ToolingExtension
255+
256+
### Wire Format Feature
257+
| Name | Supported | Defined By |
258+
| ---- | --------- | ---------- |
259+
|JSON|✓|OAS2,OAS3
260+
|XML|✓|OAS2,OAS3
261+
|PROTOBUF|✗|ToolingExtension
262+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)