swagger-api / swagger-api/swagger-codegen

[C++][Restbed-server] Compilation error from missing header "ByteArray.h"

Open
#8,542 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

The Restbed server generated code includes a header file that does not exists (ByteArray.h):

/swagger-restbed/model/Frame.h:25:23: fatal error: ByteArray.h: No such file or directory

From Frame.h:

#ifndef Frame_H_
#define Frame_H_

#include <string>
#include "ByteArray.h"
#include "Event.h"
#include <map>
#include <vector>
#include <memory>
Swagger-codegen version

2.4.0

Swagger 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/swagger-codegen-cli/target/swagger-codegen-cli.jar generate /
-i deep-viss.json /
-l restbed /
-o ../swagger-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)

Where restbed/include is the folder with the header files of the Restbed library (https://github.com/Corvusoft/restbed).
You also need to copy json.hpp to model folder (inside generated code root).
The content of main.cpp file is not important as the compilation won't pass the missing header inside Frame.h file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce generation with the linked deep-viss.json and the shown Restbed command, then inspect the generated model/Frame.h and the CMake include paths. Trace where ByteArray.h is expected to come from and verify the generated Restbed C++ project builds successfully without the missing-header error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.