-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[C++][Pistache] Fixed #2643 #2653
Conversation
Refactored to/from json functions to use universal object serialization method.
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors. Let me know if you need help fixing it. |
modules/openapi-generator/src/main/resources/cpp-pistache-server/model-header.mustache
Outdated
Show resolved
Hide resolved
...api-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java
Show resolved
Hide resolved
@stkrwork Can I ask what the purpose of the helpers class is? It doesn't seems to be used for anything in generated APIs. |
Their purpose was to convert strings, or array in string to the correct datatype. with your new system, they should be redundant as well now. |
Should I delete it then? |
if they aren't referenced anywhere in the code, yes |
@etherealjoy as you made the helpers, can you check this as well? |
@SalDiAngelus |
Code does not compile anymore
|
I've tried nested arrays with non default types, but I haven't used maps. |
modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache
Show resolved
Hide resolved
ok, it compiles now |
I used this spec
|
modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/cpp-pistache-server/model-header.mustache
Show resolved
Hide resolved
This is up for discussion, but the deserialiation of array and map aliases is a little more complicated due to missing helpers. Just for discussion i dont have preferences. |
Nlohmann json had std container types built in. Using the yaml file you provided, the code below generates the json below.
|
Ok, good. |
* master: (40 commits) Remove quotation marks around {{paramName}} for header params in api-body.mustache (#2727) Add FiNC Technologies (#2728) fix missing parenthesis for http bearer auth (#2723) Add missing closing parenthesis (#2720) update perl test with correct body parameter (#2717) [Java][Spring] Fix template for reactive implementation with `interfaceOnly` parameter (#2437) Bugfix(Perl): Support nested primitive types in ARRARY or HASH for basic object (#2713) Remove `-XX:MaxPermSize` (#2712) Remove setting generateAliasAsModel in rust server generator (#2714) update rust server samples Revert "update rust samples" update rust samples update samples [Rust Server] Improve XML support (#2504) Improve CONTRIBUTING.md (#2699) [PHP][Lumen] Rename template folder (#2707) [aspnetcore] Support async tasks and some code cleanups (#2629) [C++][Pistache] Fixed #2643 (#2653) update petstore samples (#2697) [JAVA][Webclient]fix select body for url encoded media type. (#2686) ...
Refactored to/from json functions to use universal object serialization method.
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,. Default:3.4.x
,4.0.x
master
.@ravinikam, @stkrwork, @fvarose, @etherealjoy, @MartinDelille
Description of the PR
Purpose is to fix issue #2643. While I was in there, I saw the mustache file for serialization was more complex than it needed to be so I simplified it by using the to_json and from_json functions that nlohmann/json uses to find custom types to serialize. Removed the ModelBase class because the helper functions weren't needed anymore.