Added hide to Endpoint::Info to hide endpoints from swagger (i.E. used in CORS-Macros for option-endpoints)

This commit is contained in:
Benedikt-Alexander Mokroß 2019-10-09 11:40:13 +02:00
parent 7cf4d9e769
commit 0013875b3b
3 changed files with 7 additions and 1 deletions

View File

@ -45,6 +45,7 @@ ENDPOINT_INTERCEPTOR(ENDPOINTNAME, CORS) { \
) \
return resp; \
} \
ENDPOINT_INFO(ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { info->hide = true; } \
ENDPOINT("OPTIONS", Z__ENDPOINT_##ENDPOINTNAME->info()->path, ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { \
auto resp = createResponse(Status::CODE_204, ""); \
OATPP_MACRO_API_CONTROLLER_ADDCORS_BODY( \
@ -67,6 +68,7 @@ ENDPOINT_INTERCEPTOR(ENDPOINTNAME, CORS) { \
) \
return resp; \
} \
ENDPOINT_INFO(ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { info->hide = true; } \
ENDPOINT("OPTIONS", Z__ENDPOINT_##ENDPOINTNAME->info()->path, ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { \
auto resp = createResponse(Status::CODE_204, ""); \
OATPP_MACRO_API_CONTROLLER_ADDCORS_BODY( \
@ -89,6 +91,7 @@ ENDPOINT_INTERCEPTOR(ENDPOINTNAME, CORS) { \
) \
return resp; \
} \
ENDPOINT_INFO(ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { info->hide = true; } \
ENDPOINT("OPTIONS", Z__ENDPOINT_##ENDPOINTNAME->info()->path, ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { \
auto resp = createResponse(Status::CODE_204, ""); \
OATPP_MACRO_API_CONTROLLER_ADDCORS_BODY( \
@ -111,6 +114,7 @@ ENDPOINT_INTERCEPTOR(ENDPOINTNAME, CORS) { \
) \
return resp; \
} \
ENDPOINT_INFO(ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { info->hide = true; } \
ENDPOINT("OPTIONS", Z__ENDPOINT_##ENDPOINTNAME->info()->path, ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { \
auto resp = createResponse(Status::CODE_204, ""); \
OATPP_MACRO_API_CONTROLLER_ADDCORS_BODY( \
@ -128,6 +132,7 @@ ENDPOINT_INTERCEPTOR(ENDPOINTNAME, CORS) { \
OATPP_MACRO_API_CONTROLLER_ADDCORS_BODY(ORIGIN, METHODS, HEADERS, MAX_AGE) \
return resp; \
} \
ENDPOINT_INFO(ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { info->hide = true; } \
ENDPOINT("OPTIONS", Z__ENDPOINT_##ENDPOINTNAME->info()->path, ZZ__CORS_OPTIONS_ENDPOINT_##ENDPOINTNAME) { \
auto resp = createResponse(Status::CODE_204, ""); \
OATPP_MACRO_API_CONTROLLER_ADDCORS_BODY(ORIGIN, METHODS, HEADERS, MAX_AGE) \

View File

@ -55,7 +55,7 @@ Endpoint::Info::Param& Endpoint::Info::Params::operator [](const oatpp::String&
return m_params[name];
}
Endpoint::Info::Info()
Endpoint::Info::Info() : hide(false)
{}
std::shared_ptr<Endpoint::Info> Endpoint::Info::createShared(){

View File

@ -128,6 +128,7 @@ public:
oatpp::String path;
oatpp::String method;
oatpp::String authorization;
oatpp::Boolean hide;
Param body;
oatpp::String bodyContentType;