Skip to content

Commit c000eae

Browse files
wing328Kahncode
andauthored
Add C++ UE4 client generator (#6399)
* Added new language: UE4 C++ client * rename generator * add copyright * update doc * fix with Locale.ROOT * add new file * minor improvements * remove postProcessModels Co-authored-by: Samuel Kahn <[email protected]>
1 parent 6be3bc0 commit c000eae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6607
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ Here is a list of template creators:
779779
* Bash: @bkryza
780780
* C: @PowerOfCreation @zhemant [:heart:](https://www.patreon.com/zhemant)
781781
* C++ REST: @Danielku15
782+
* C++ UE4: @Kahncode
782783
* C# (.NET 2.0): @who
783784
* C# (.NET Standard 1.3 ): @Gronsak
784785
* C# (.NET 4.5 refactored): @jimschubert [:heart:](https://www.patreon.com/jimschubert)

bin/cpp-ue4-petstore.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -t modules/openapi-generator/src/main/resources/cpp-ue4 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-ue4 -o samples/client/petstore/cpp-ue4"
30+
31+
java $JAVA_OPTS -jar $executable $ags

bin/windows/cpp-ue4-petstore.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
8+
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-ue4 -o samples\client\petstore\cpp-ue4
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The following generators are available:
1515
* [cpp-qt5-client](generators/cpp-qt5-client.md)
1616
* [cpp-restsdk](generators/cpp-restsdk.md)
1717
* [cpp-tizen](generators/cpp-tizen.md)
18+
* [cpp-ue4 (beta)](generators/cpp-ue4.md)
1819
* [csharp](generators/csharp.md)
1920
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2.md)
2021
* [csharp-netcore](generators/csharp-netcore.md)

docs/generators/cpp-ue4.md

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
---
2+
title: Config Options for cpp-ue4
3+
sidebar_label: cpp-ue4
4+
---
5+
6+
| Option | Description | Values | Default |
7+
| ------ | ----------- | ------ | ------- |
8+
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
9+
|cppNamespace|C++ namespace (convention: name::space::for::api).| |OpenAPI|
10+
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
11+
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
12+
|optionalProjectFile|Generate Build.cs| |true|
13+
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
14+
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
15+
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
16+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
17+
|unrealModuleName|Name of the generated unreal module (optional)| |OpenAPI|
18+
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -&gt; Value)| |true|
19+
20+
## IMPORT MAPPING
21+
22+
| Type/Alias | Imports |
23+
| ---------- | ------- |
24+
|HttpFileInput|#include &quot;OpenAPIHelpers.h&quot;|
25+
26+
27+
## INSTANTIATION TYPES
28+
29+
| Type/Alias | Instantiated By |
30+
| ---------- | --------------- |
31+
32+
33+
## LANGUAGE PRIMITIVES
34+
35+
<ul class="column-ul">
36+
<li>FDateTime</li>
37+
<li>FGuid</li>
38+
<li>FString</li>
39+
<li>TArray</li>
40+
<li>TArray&lt;uint8&gt;</li>
41+
<li>TMap</li>
42+
<li>TSharedPtr&lt;FJsonObject&gt;</li>
43+
<li>bool</li>
44+
<li>double</li>
45+
<li>float</li>
46+
<li>int32</li>
47+
<li>int64</li>
48+
</ul>
49+
50+
## RESERVED WORDS
51+
52+
<ul class="column-ul">
53+
<li>alignas</li>
54+
<li>alignof</li>
55+
<li>and</li>
56+
<li>and_eq</li>
57+
<li>asm</li>
58+
<li>auto</li>
59+
<li>bitand</li>
60+
<li>bitor</li>
61+
<li>bool</li>
62+
<li>break</li>
63+
<li>case</li>
64+
<li>catch</li>
65+
<li>char</li>
66+
<li>char16_t</li>
67+
<li>char32_t</li>
68+
<li>class</li>
69+
<li>compl</li>
70+
<li>concept</li>
71+
<li>const</li>
72+
<li>const_cast</li>
73+
<li>constexpr</li>
74+
<li>continue</li>
75+
<li>decltype</li>
76+
<li>default</li>
77+
<li>delete</li>
78+
<li>do</li>
79+
<li>double</li>
80+
<li>dynamic_cast</li>
81+
<li>else</li>
82+
<li>enum</li>
83+
<li>explicit</li>
84+
<li>export</li>
85+
<li>extern</li>
86+
<li>false</li>
87+
<li>float</li>
88+
<li>for</li>
89+
<li>friend</li>
90+
<li>goto</li>
91+
<li>if</li>
92+
<li>inline</li>
93+
<li>int</li>
94+
<li>linux</li>
95+
<li>long</li>
96+
<li>mutable</li>
97+
<li>namespace</li>
98+
<li>new</li>
99+
<li>noexcept</li>
100+
<li>not</li>
101+
<li>not_eq</li>
102+
<li>nullptr</li>
103+
<li>operator</li>
104+
<li>or</li>
105+
<li>or_eq</li>
106+
<li>private</li>
107+
<li>protected</li>
108+
<li>public</li>
109+
<li>register</li>
110+
<li>reinterpret_cast</li>
111+
<li>requires</li>
112+
<li>return</li>
113+
<li>short</li>
114+
<li>signed</li>
115+
<li>sizeof</li>
116+
<li>static</li>
117+
<li>static_assert</li>
118+
<li>static_cast</li>
119+
<li>struct</li>
120+
<li>switch</li>
121+
<li>template</li>
122+
<li>this</li>
123+
<li>thread_local</li>
124+
<li>throw</li>
125+
<li>true</li>
126+
<li>try</li>
127+
<li>typedef</li>
128+
<li>typeid</li>
129+
<li>typename</li>
130+
<li>union</li>
131+
<li>unsigned</li>
132+
<li>using</li>
133+
<li>virtual</li>
134+
<li>void</li>
135+
<li>volatile</li>
136+
<li>wchar_t</li>
137+
<li>while</li>
138+
<li>xor</li>
139+
<li>xor_eq</li>
140+
</ul>
141+
142+
## FEATURE SET
143+
144+
145+
### Client Modification Feature
146+
| Name | Supported | Defined By |
147+
| ---- | --------- | ---------- |
148+
|BasePath|✗|ToolingExtension
149+
|Authorizations|✗|ToolingExtension
150+
|UserAgent|✗|ToolingExtension
151+
152+
### Data Type Feature
153+
| Name | Supported | Defined By |
154+
| ---- | --------- | ---------- |
155+
|Custom|✗|OAS2,OAS3
156+
|Int32|✓|OAS2,OAS3
157+
|Int64|✓|OAS2,OAS3
158+
|Float|✓|OAS2,OAS3
159+
|Double|✓|OAS2,OAS3
160+
|Decimal|✓|ToolingExtension
161+
|String|✓|OAS2,OAS3
162+
|Byte|✓|OAS2,OAS3
163+
|Binary|✓|OAS2,OAS3
164+
|Boolean|✓|OAS2,OAS3
165+
|Date|✓|OAS2,OAS3
166+
|DateTime|✓|OAS2,OAS3
167+
|Password|✓|OAS2,OAS3
168+
|File|✓|OAS2
169+
|Array|✓|OAS2,OAS3
170+
|Maps|✓|ToolingExtension
171+
|CollectionFormat|✓|OAS2
172+
|CollectionFormatMulti|✓|OAS2
173+
|Enum|✓|OAS2,OAS3
174+
|ArrayOfEnum|✓|ToolingExtension
175+
|ArrayOfModel|✓|ToolingExtension
176+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
177+
|ArrayOfCollectionOfModel|✓|ToolingExtension
178+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
179+
|MapOfEnum|✓|ToolingExtension
180+
|MapOfModel|✓|ToolingExtension
181+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
182+
|MapOfCollectionOfModel|✓|ToolingExtension
183+
|MapOfCollectionOfEnum|✓|ToolingExtension
184+
185+
### Documentation Feature
186+
| Name | Supported | Defined By |
187+
| ---- | --------- | ---------- |
188+
|Readme|✗|ToolingExtension
189+
|Model|✓|ToolingExtension
190+
|Api|✓|ToolingExtension
191+
192+
### Global Feature
193+
| Name | Supported | Defined By |
194+
| ---- | --------- | ---------- |
195+
|Host|✓|OAS2,OAS3
196+
|BasePath|✓|OAS2,OAS3
197+
|Info|✓|OAS2,OAS3
198+
|Schemes|✗|OAS2,OAS3
199+
|PartialSchemes|✓|OAS2,OAS3
200+
|Consumes|✓|OAS2
201+
|Produces|✓|OAS2
202+
|ExternalDocumentation|✓|OAS2,OAS3
203+
|Examples|✓|OAS2,OAS3
204+
|XMLStructureDefinitions|✗|OAS2,OAS3
205+
|MultiServer|✗|OAS3
206+
|ParameterizedServer|✗|OAS3
207+
|ParameterStyling|✗|OAS3
208+
|Callbacks|✓|OAS3
209+
|LinkObjects|✗|OAS3
210+
211+
### Parameter Feature
212+
| Name | Supported | Defined By |
213+
| ---- | --------- | ---------- |
214+
|Path|✓|OAS2,OAS3
215+
|Query|✓|OAS2,OAS3
216+
|Header|✓|OAS2,OAS3
217+
|Body|✓|OAS2
218+
|FormUnencoded|✓|OAS2
219+
|FormMultipart|✓|OAS2
220+
|Cookie|✓|OAS3
221+
222+
### Schema Support Feature
223+
| Name | Supported | Defined By |
224+
| ---- | --------- | ---------- |
225+
|Simple|✓|OAS2,OAS3
226+
|Composite|✓|OAS2,OAS3
227+
|Polymorphism|✓|OAS2,OAS3
228+
|Union|✗|OAS3
229+
230+
### Security Feature
231+
| Name | Supported | Defined By |
232+
| ---- | --------- | ---------- |
233+
|BasicAuth|✓|OAS2,OAS3
234+
|ApiKey|✓|OAS2,OAS3
235+
|OpenIDConnect|✗|OAS3
236+
|BearerToken|✓|OAS3
237+
|OAuth2_Implicit|✓|OAS2,OAS3
238+
|OAuth2_Password|✓|OAS2,OAS3
239+
|OAuth2_ClientCredentials|✓|OAS2,OAS3
240+
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
241+
242+
### Wire Format Feature
243+
| Name | Supported | Defined By |
244+
| ---- | --------- | ---------- |
245+
|JSON|✓|OAS2,OAS3
246+
|XML|✓|OAS2,OAS3
247+
|PROTOBUF|✗|ToolingExtension
248+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)