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

undefined SWAGGER_ROOT_PATH #22

Open
zeyuanxy opened this issue Apr 27, 2022 · 4 comments
Open

undefined SWAGGER_ROOT_PATH #22

zeyuanxy opened this issue Apr 27, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@zeyuanxy
Copy link

Hi, when I was trying to build this example project. I got this error:

[2/3] Building CXX object CMakeFiles/crud-exe.dir/src/App.cpp.o
FAILED: CMakeFiles/crud-exe.dir/src/App.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DDATABASE_FILE=\"/Users/zeyuan.shang/Coding/web/example-crud/db.sqlite\" -DDATABASE_MIGRATIONS=\"/Users/zeyuan.shang/Coding/web/example-crud/sql\" -DOATPP_SWAGGER_RES_PATH=\"/usr/local/include/oatpp-1.3.0/oatpp-swagger//../bin/oatpp-swagger/res\" -DTESTDATABASE_FILE=\"/Users/zeyuan.shang/Coding/web/example-crud/test-db.sqlite\" -I/Users/zeyuan.shang/Coding/web/example-crud/src -isystem /usr/local/include/oatpp-1.3.0/oatpp -isystem /usr/local/include/oatpp-1.3.0/oatpp-swagger -isystem /usr/local/include/oatpp-1.3.0/oatpp-sqlite -isystem /usr/local/include/oatpp-1.3.0/oatpp-sqlite/sqlite -g -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -std=gnu++11 -MD -MT CMakeFiles/crud-exe.dir/src/App.cpp.o -MF CMakeFiles/crud-exe.dir/src/App.cpp.o.d -o CMakeFiles/crud-exe.dir/src/App.cpp.o -c /Users/zeyuan.shang/Coding/web/example-crud/src/App.cpp
In file included from /Users/zeyuan.shang/Coding/web/example-crud/src/App.cpp:7:
/usr/local/include/oatpp-1.3.0/oatpp-swagger/oatpp-swagger/Controller.hpp:104:37: error: expected ':'
  ENDPOINT("GET", SWAGGER_ROOT_PATH SWAGGER_UI_PATH, getUIRoot) {

It seems that SWAGGER_ROOT_PATH is undefined? Any idea on how to fix this would be appreciated, thanks!

@bamkrs
Copy link
Member

bamkrs commented Apr 28, 2022

This seems to be a regression introduced by oatpp/oatpp-swagger@652f95c

Those variables were not introduced to the module-cmake.
We'll fix it asap. Please use the previous commit in the meantime.

@roqerxz
Copy link

roqerxz commented May 10, 2022

set(SWAGGER_ROOT_PATH "/swagger" CACHE STRING "Default root path to the Swagger") set(SWAGGER_UI_PATH "/ui" CACHE STRING "Default path suffix to the Swagger UI") add_compile_definitions( SWAGGER_ROOT_PATH="${SWAGGER_ROOT_PATH}" SWAGGER_UI_PATH="${SWAGGER_UI_PATH}" )

quick fix in cmake ^

@LShuXin
Copy link

LShuXin commented May 15, 2022

set(SWAGGER_ROOT_PATH "/swagger" CACHE STRING "Default root path to the Swagger") set(SWAGGER_UI_PATH "/ui" CACHE STRING "Default path suffix to the Swagger UI") add_compile_definitions( SWAGGER_ROOT_PATH="${SWAGGER_ROOT_PATH}" SWAGGER_UI_PATH="${SWAGGER_UI_PATH}" )

quick fix in cmake ^

Same Problem, Can you show me the specific path? I am new to C++,should me write the path as follows(CMakeLists.txt of oatpp-swagger)? this not work.

set(SWAGGER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Default root path to the Swagger")
set(SWAGGER_UI_PATH "/res" CACHE STRING "Default path suffix to the Swagger UI")

Here are some information about my PC:

apples-Mac-mini:oatpp-swagger apple$ pwd
/usr/local/include/oatpp-1.3.0/oatpp-swagger
apples-Mac-mini:oatpp-swagger apple$ tree -L 3
.
└── oatpp-swagger
    ├── AsyncController.hpp
    ├── Controller.hpp
    ├── Generator.hpp
    ├── Model.hpp
    ├── Resources.hpp
    ├── Types.hpp
    └── oas3
        └── Model.hpp

2 directories, 7 files


apples-Mac-mini:example-crud apple$ pwd
/Users/apple/Documents/Repositories/Oatpp/examples/example-crud
apples-Mac-mini:example-crud apple$ tree -L 2
.
├── CMakeLists.txt
├── Dockerfile
├── LICENSE
├── README.md
├── azure-pipelines.yml
├── build
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   ├── CTestTestfile.cmake
│   ├── Makefile
│   ├── cmake_install.cmake
│   ├── crud-test
│   └── libcrud-lib.a
├── cmake-build-debug
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   ├── CTestTestfile.cmake
│   ├── Makefile
│   ├── cmake_install.cmake
│   └── crud.cbp
├── oatpp-sqlite
│   ├── CMakeLists.txt
│   ├── LICENSE
│   ├── README.md
│   ├── azure-pipelines.yml
│   ├── build
│   ├── cmake
│   ├── src
│   └── test
├── oatpp-swagger
│   ├── CMakeLists.txt
│   ├── LICENSE
│   ├── README.md
│   ├── azure-pipelines.yml
│   ├── build
│   ├── cmake
│   ├── res
│   ├── src
│   ├── test
│   └── utility
├── sql
│   └── 001_init.sql
├── src
│   ├── App.cpp
│   ├── AppComponent.hpp
│   ├── DatabaseComponent.hpp
│   ├── ErrorHandler.cpp
│   ├── ErrorHandler.hpp
│   ├── SwaggerComponent.hpp
│   ├── controller
│   ├── db
│   ├── dto
│   └── service
├── test
│   ├── UserControllerTest.cpp
│   ├── UserControllerTest.hpp
│   ├── app
│   └── tests.cpp
├── tmp
│   └── build
└── utility
    └── install-oatpp-modules.sh

9 directories, 5 files

@LShuXin
Copy link

LShuXin commented May 22, 2022

here solved the problem #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants