-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
feat(cpp-boost-beast-server): add HTTP/1.1 server generator #24783
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
Open
bold84
wants to merge
25
commits into
OpenAPITools:master
Choose a base branch
from
bold84:pr/cpp-boost-beast-server
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8a6eaa0
refactor(cpp-boost-beast): share model pipeline between client and se…
bold84 f5375d3
feat(cpp-boost-beast-server): generator, runtime, and API templates
bold84 5db096e
test(cpp-boost-beast-server): rejection, surface, and loopback runtim…
bold84 2f49df3
feat(cpp-boost-beast-server): petstore sample, generator docs, and CI
bold84 bbfadb1
docs(cpp-boost-beast-server): list generator in index
bold84 6850eda
fix(cpp-boost-beast-server): harden runtime, gate, and constraint cov…
bold84 99775fa
fix(cpp-boost-beast-server): close review gaps in gate, runtime, and …
bold84 486145b
fix(cpp-boost-beast-server): degrade unsupported media types and secu…
bold84 5ab0756
docs(cpp-boost-beast-server): correct form-parameter feature claims
bold84 43e7172
fix(cpp-boost-beast-server): shared IR chunks, freeform type mapping,…
bold84 d437af6
fix(cpp-boost-beast-server): degrade undecodable params, recover mixe…
bold84 1f253c4
fix(cpp-boost-beast-server): include optional for variant bodies, nam…
bold84 9301e6c
fix(cpp-boost-beast-server): non-static assembler logger for ArchUnit…
bold84 e2cd273
fix(cpp-boost-beast-server): close review gaps in gate, runtime, and …
bold84 9c7dd22
chore(cpp-boost-beast-server): regenerate sample and generator docs
bold84 5d7b9a7
fix(cpp-boost-beast-server): build reactor deps before sample runtime…
bold84 7aff9ca
fix(cpp-boost-beast-server): response-side variant serialization, fai…
bold84 3ba8b82
chore(cpp-boost-beast-server): regenerate sample and generator docs
bold84 35cfd26
fix(cpp-boost-beast): close review round on pipeline, runtime, and te…
bold84 645affb
test(cpp-boost-beast): regressions for the review-round fixes
bold84 1e545bd
chore(cpp-boost-beast): regenerate petstore samples
bold84 e2f286f
fix(cpp-boost-beast-server): correct witness merge under-reporting
bold84 24df69c
test(cpp-boost-beast-server): cover the review-round claims
bold84 1833cbe
fix(cpp-boost-beast-server): count() for Boost <1.85 compatibility
bold84 e7272ea
fix(cpp-boost-beast-server): close round-two review gaps
bold84 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| name: Samples cpp boost beast server | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - "samples/server/petstore/cpp-boost-beast-server/**" | ||
| - ".github/workflows/samples-cpp-boost-beast-server.yaml" | ||
| - "modules/openapi-generator/src/main/resources/cpp-boost-beast-server/**" | ||
| - "modules/openapi-generator/src/main/resources/cpp-boost-beast-common/**" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastServer*.java" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastModelCodegen.java" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastClientCodegen.java" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastOperationFacts.java" | ||
| - "modules/openapi-generator/src/test/resources/3_1/cpp-boost-beast-server/**" | ||
| - "modules/openapi-generator/src/test/java/org/openapitools/codegen/cppboostbeastserver/**" | ||
| pull_request: | ||
| paths: | ||
| - "samples/server/petstore/cpp-boost-beast-server/**" | ||
| - ".github/workflows/samples-cpp-boost-beast-server.yaml" | ||
| - "modules/openapi-generator/src/main/resources/cpp-boost-beast-server/**" | ||
| - "modules/openapi-generator/src/main/resources/cpp-boost-beast-common/**" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastServer*.java" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastModelCodegen.java" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastClientCodegen.java" | ||
| - "modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppBoostBeastOperationFacts.java" | ||
| - "modules/openapi-generator/src/test/resources/3_1/cpp-boost-beast-server/**" | ||
| - "modules/openapi-generator/src/test/java/org/openapitools/codegen/cppboostbeastserver/**" | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build cpp boost beast server | ||
| strategy: | ||
| matrix: | ||
| sample: | ||
| - samples/server/petstore/cpp-boost-beast-server | ||
| os: | ||
| - ubuntu-latest | ||
| - macOS-latest | ||
| - windows-latest | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Install dependencies (Linux) | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential cmake libboost-dev libboost-json-dev libboost-url-dev | ||
|
|
||
| - name: Install dependencies (macOS) | ||
| if: matrix.os == 'macOS-latest' | ||
| run: | | ||
| brew install boost cmake | ||
|
|
||
| - name: Install dependencies (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: | | ||
| vcpkg install boost-asio:x64-windows boost-beast:x64-windows boost-json:x64-windows boost-url:x64-windows boost-multiprecision:x64-windows | ||
| shell: cmd | ||
| timeout-minutes: 30 | ||
|
|
||
| - name: Build | ||
| working-directory: ${{ matrix.sample }} | ||
| run: | | ||
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
| cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" | ||
| else | ||
| cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=1 | ||
| fi | ||
| cmake --build build | ||
| shell: bash | ||
|
|
||
| - name: Set up JDK 17 | ||
| if: matrix.os == 'ubuntu-latest' | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
|
|
||
| # The loopback runtime regression compiles the generated contract code | ||
| # against the Boost installed above and asserts wire behavior. With the | ||
| # require flag set, missing Boost/compilers fail the job instead of | ||
| # silently skipping — this leg is the guaranteed execution of that suite. | ||
| - name: Run server runtime regression (Linux) | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| ./mvnw -pl modules/openapi-generator -am test \ | ||
| -Dtest=CppBoostBeastServerRuntimeTest \ | ||
| -Dsurefire.failIfNoSpecifiedTests=false \ | ||
| -Dcpp.boost.beast.require=true -q | ||
| shell: bash | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| generatorName: cpp-boost-beast-server | ||
| outputDir: samples/server/petstore/cpp-boost-beast-server | ||
| inputSpec: modules/openapi-generator/src/test/resources/3_1/cpp-boost-beast-server/petstore.yaml | ||
| templateDir: modules/openapi-generator/src/main/resources/cpp-boost-beast-server | ||
| additionalProperties: | ||
| hideGenerationTimestamp: "true" | ||
| packageName: CppBoostBeastPetstoreServer | ||
| addApiImplStubs: "true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,277 @@ | ||
| --- | ||
| title: Documentation for the cpp-boost-beast-server Generator | ||
| --- | ||
|
|
||
| ## METADATA | ||
|
|
||
| | Property | Value | Notes | | ||
| | -------- | ----- | ----- | | ||
| | generator name | cpp-boost-beast-server | pass this to the generate command after -g | | ||
| | generator stability | BETA | | | ||
| | generator type | SERVER | | | ||
| | generator language | C++ | | | ||
| | generator default templating engine | mustache | | | ||
| | helpTxt | Generates a C++ Boost.Beast HTTP server. | | | ||
|
|
||
| ## 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 | | ||
| | ------ | ----------- | ------ | ------- | | ||
| |addApiImplStubs|Generate API implementation stubs that answer 501 problem+json and a sample main.cpp for quick start| |false| | ||
| |apiPackage|C++ namespace for apis (convention: name.space.api).| |org.openapitools.server.api| | ||
| |compileWithValidation|Emit schema-validation IR and kValidateOnDecode=true in generated ValidationTypes.h (default). Set to false to omit the IR.| |true| | ||
| |modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.server.model| | ||
| |packageName|C++ package and library name.| |CppBoostBeastServer| | ||
| |preserveAdditionalProperties|Retain undeclared JSON object members in generated object models and re-emit them; set to false for strict handling.| |false| | ||
| |tolerateNonNullableNulls|Treat explicit JSON null values as absent for generated model properties whose schemas do not allow null. Enabled by default; set to false for strict schema decoding.| |true| | ||
|
|
||
| ## IMPORT MAPPING | ||
|
|
||
| | Type/Alias | Imports | | ||
| | ---------- | ------- | | ||
| |AnyType|#include "AnyType.h"| | ||
| |Null|#include <cstddef>| | ||
| |boost::json::value|#include <boost/json.hpp>| | ||
| |int32_t|#include <cstdint>| | ||
| |int64_t|#include <cstdint>| | ||
| |std::map|#include <map>| | ||
| |std::monostate|#include <variant>| | ||
| |std::nullptr_t|#include <cstddef>| | ||
| |std::optional|#include <optional>| | ||
| |std::shared_ptr|#include <memory>| | ||
| |std::string|#include <string>| | ||
| |std::variant|#include <variant>| | ||
| |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>long</li> | ||
| <li>std::int32_t</li> | ||
| <li>std::int64_t</li> | ||
| </ul> | ||
|
|
||
| ## RESERVED WORDS | ||
|
|
||
| <ul class="column-ul"> | ||
| <li>NULL</li> | ||
| <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 | ||
| |SignatureAuth|✗|OAS3 | ||
| |AWSV4Signature|✗|ToolingExtension | ||
|
|
||
| ### Wire Format Feature | ||
| | Name | Supported | Defined By | | ||
| | ---- | --------- | ---------- | | ||
| |JSON|✓|OAS2,OAS3 | ||
| |XML|✗|OAS2,OAS3 | ||
| |PROTOBUF|✗|ToolingExtension | ||
| |Custom|✗|OAS2,OAS3 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.