Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cpp boost beast client #12197

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
92d2e57
Add generator for boost beast client
LukasWoodtli Nov 22, 2021
c0580c7
Improve cpp-boost-beast client
LukasWoodtli Apr 13, 2022
0755fdb
Add tests for exception propagation
LukasWoodtli Apr 13, 2022
a17ab8c
Add media types (Content-Type and Accept) and x-www-form-urlencoded
LukasWoodtli Apr 14, 2022
d223a4a
Clean up and simplify
LukasWoodtli Apr 14, 2022
9bf7254
Fix query params and array responses
LukasWoodtli Apr 14, 2022
1db87c0
Add another test for query param with list
LukasWoodtli Apr 14, 2022
bd4f88b
Simplify code and cleanup
LukasWoodtli Apr 14, 2022
fe79525
Add more tests for Pet API
LukasWoodtli Apr 19, 2022
324b79c
Add store API tests and some improvements
LukasWoodtli Apr 19, 2022
1bbff6c
Add more tests for user API
LukasWoodtli Apr 19, 2022
406e964
Run imposter for API tests from CMake (CTest)
LukasWoodtli Apr 20, 2022
a3dca48
Add boost beast client tests to Maven project
LukasWoodtli Apr 20, 2022
3d7fe3a
Add tests to travis
LukasWoodtli Apr 20, 2022
3af1e2d
Add imposter to travis ci
LukasWoodtli Apr 20, 2022
27ef9c5
Sanitize model names
LukasWoodtli Apr 20, 2022
d061286
Add generated Markdown file with docs
LukasWoodtli Apr 21, 2022
b8f29ae
Fix problems after rebase with upstream master
LukasWoodtli Apr 22, 2022
8fab6ea
Fix logger
LukasWoodtli Apr 22, 2022
67e05fa
Commit changes in generated files
LukasWoodtli Apr 22, 2022
a1b5459
Update generated doc
LukasWoodtli Apr 22, 2022
4b48374
Decrease required CMake version for cpp-boost-beast-client example
LukasWoodtli May 2, 2022
dfe3297
Fix parsing of response
LukasWoodtli May 2, 2022
3a1812b
Partial fix for boost versions bigger than 1.71
LukasWoodtli May 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ before_install:
# install Qt5
- sudo apt install -y --no-install-recommends qt5-default
- cmake --version
# install boost
- sudo apt install -y --no-install-recommends qt5-default
# install imposter
- sudo curl -L https://raw.githubusercontent.com/gatehill/imposter-cli/main/install/install_imposter.sh | bash -
# -- skip perl test to shorten build time
# perl dep
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
Expand Down
6 changes: 6 additions & 0 deletions bin/configs/cpp-boost-beast-client-petstore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
generatorName: cpp-boost-beast-client
outputDir: samples/client/petstore/cpp-boost-beast/generated
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/cpp-boost-beast-client
additionalProperties:
hideGenerationTimestamp: "true"
1 change: 1 addition & 0 deletions docs/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The following generators are available:
* [bash](generators/bash.md)
* [c](generators/c.md)
* [clojure](generators/clojure.md)
* [cpp-boost-beast-client](generators/cpp-boost-beast-client.md)
* [cpp-qt-client](generators/cpp-qt-client.md)
* [cpp-restsdk](generators/cpp-restsdk.md)
* [cpp-tiny (beta)](generators/cpp-tiny.md)
Expand Down
261 changes: 261 additions & 0 deletions docs/generators/cpp-boost-beast-client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
---
title: Documentation for the cpp-boost-beast-client Generator
---

## METADATA

| Property | Value | Notes |
| -------- | ----- | ----- |
| generator name | cpp-boost-beast-client | pass this to the generate command after -g |
| generator stability | STABLE | |
| generator type | CLIENT | |
| generator language | C++ | |
| generator default templating engine | mustache | |
| helpTxt | Generates a cpp-boost-beast client. | |

## CONFIG OPTIONS
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.

| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|apiPackage|C++ namespace for apis (convention: name.space.api).| |org.openapitools.client.api|
|modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.client.model|

## IMPORT MAPPING

| Type/Alias | Imports |
| ---------- | ------- |
|int32_t|#include <cstdint>|
|int64_t|#include <cstdint>|
|std::map|#include <map>|
|std::string|#include <string>|
|std::vector|#include <vector>|


## INSTANTIATION TYPES

| Type/Alias | Instantiated By |
| ---------- | --------------- |


## LANGUAGE PRIMITIVES

<ul class="column-ul">
<li>bool</li>
<li>char</li>
<li>double</li>
<li>float</li>
<li>int</li>
<li>int32_t</li>
<li>int64_t</li>
<li>long</li>
</ul>

## RESERVED WORDS

<ul class="column-ul">
<li>alignas</li>
<li>alignof</li>
<li>and</li>
<li>and_eq</li>
<li>asm</li>
<li>auto</li>
<li>bitand</li>
<li>bitor</li>
<li>bool</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>char16_t</li>
<li>char32_t</li>
<li>class</li>
<li>compl</li>
<li>concept</li>
<li>const</li>
<li>const_cast</li>
<li>constexpr</li>
<li>continue</li>
<li>decltype</li>
<li>default</li>
<li>delete</li>
<li>do</li>
<li>double</li>
<li>dynamic_cast</li>
<li>else</li>
<li>enum</li>
<li>explicit</li>
<li>export</li>
<li>extern</li>
<li>false</li>
<li>float</li>
<li>for</li>
<li>friend</li>
<li>goto</li>
<li>if</li>
<li>inline</li>
<li>int</li>
<li>linux</li>
<li>long</li>
<li>mutable</li>
<li>namespace</li>
<li>new</li>
<li>noexcept</li>
<li>not</li>
<li>not_eq</li>
<li>nullptr</li>
<li>operator</li>
<li>or</li>
<li>or_eq</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>register</li>
<li>reinterpret_cast</li>
<li>requires</li>
<li>return</li>
<li>short</li>
<li>signed</li>
<li>sizeof</li>
<li>static</li>
<li>static_assert</li>
<li>static_cast</li>
<li>struct</li>
<li>switch</li>
<li>template</li>
<li>this</li>
<li>thread_local</li>
<li>throw</li>
<li>true</li>
<li>try</li>
<li>typedef</li>
<li>typeid</li>
<li>typename</li>
<li>union</li>
<li>unsigned</li>
<li>using</li>
<li>virtual</li>
<li>void</li>
<li>volatile</li>
<li>wchar_t</li>
<li>while</li>
<li>xor</li>
<li>xor_eq</li>
</ul>

## FEATURE SET


### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
|MockServer|✗|ToolingExtension

### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Uuid|✗|
|Array|✓|OAS2,OAS3
|Null|✗|OAS3
|AnyType|✗|OAS2,OAS3
|Object|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension

### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension

### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3

### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3

### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
|allOf|✗|OAS2,OAS3
|anyOf|✗|OAS3
|oneOf|✗|OAS3
|not|✗|OAS3

### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3

### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ public String toModelName(String type) {
|| languageSpecificPrimitives.contains(type)) {
return type;
} else {
return sanitizeName(modelNamePrefix + Character.toUpperCase(type.charAt(0)) + type.substring(1));
String sanitized = sanitizeName(modelNamePrefix + Character.toUpperCase(type.charAt(0)) + type.substring(1));
sanitized = sanitized.replaceFirst("^([0-9_])", "M$1");
return sanitized;
}
}

Expand Down
Loading