[C++][Restbed-server] Compilation error from missing header "ByteArray.h"
Description
The Restbed server generated code includes a header file that does not exists (ByteArray.h):
From Frame.h:
#ifndef Frame_H_
#define Frame_H_
#include <string>
#include "ByteArray.h"
#include "Event.h"
#include <map>
#include <vector>
#include <memory>
openapi-generator version
3.2.1 (cloned the master branch)
OpenAPI declaration file content or url
https://raw.githubusercontent.com/deepviss/deepviss-server-example/master/src/main/resources/deep-viss.json
Command line used for generation
Inside cloned repository, after mvn clean package command: java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate / -i deep-viss.json / -g cpp-restbed-server / -o ../openapi-restbed-server
Steps to reproduce
I used the following cmake file:
cmake_minimum_required(VERSION 3.10)
project(restbed_ex)
set(CMAKE_CXX_STANDARD 11)
file(GLOB_RECURSE src_files mode/*.cpp api/*.cpp)
add_executable(restbed_ex main.cpp ${src_files})
target_include_directories(restbed_ex PRIVATE /restbed/include/)
target_include_directories(restbed_ex PRIVATE model/)
target_include_directories(restbed_ex PRIVATE api/)
target_link_libraries(restbed_ex restbed)
Note: Assuming restbed/include is the folder with restbed include files (https://github.com/Corvusoft/restbed) and that you copied the json.hpp file from https://github.com/nlohmann/json to model folder
The content of main.cpp file is redundant as the compilation won't pass the line where "ByteArray.h" is included (that is model/Frame.cpp)
There is no remapping for ByteArray in RestBed yet. So we have to implement this.
@etherealjoy Can you suggest any work-around until this is implemented?
Sadly there is no workaround. I made an implementation for Pistache and REST SDK in this PR #497. We need to do something like this for Restbed
Could you please advise on how to make this work on Pistache? (We have no preference between Restbed and Pistache)
On Pistache it is already working. A defect was raised for it previously and was fixed. https://github.com/OpenAPITools/openapi-generator/issues/407
Restbed Generated code doesnt use the json.hpp file from nlohmann. It uses the boost library for the json handling.
Added the fix from pistache to restbed in #752, can you try with that version?
Ok, it looks like the ByteArray problem is gone but the compilation is not passing. The following error occurs: api/FrameApi.cpp:70:91: error: expected primary-expression before ‘)’ token const bool includePictureBase64 = request->get_query_parameter("includePictureBase64", ); As you can see the second parameter is missing from the function call. Shall I open a new Issue or just keep it here? Thanks for fixing the bug and for the quickness you responded :)
Make a new issue for it, it seems to be not connected to this issue