Skip to content

Commit 8e4a5d3

Browse files
committed
Update to the latest oatpp API version
1 parent 3faaf21 commit 8e4a5d3

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
55
## use these variables to configure module installation
66

77
set(OATPP_THIS_MODULE_NAME oatpp-swagger) ## name of the module (also name of folders in installation dirs)
8-
set(OATPP_THIS_MODULE_VERSION "0.19.12") ## version of the module (also sufix of folders in installation dirs)
8+
set(OATPP_THIS_MODULE_VERSION "1.0.0") ## version of the module (also sufix of folders in installation dirs)
99
set(OATPP_THIS_MODULE_LIBRARIES oatpp-swagger) ## list of libraries to find when find_package is called
1010
set(OATPP_THIS_MODULE_TARGETS oatpp-swagger) ## list of targets to install
1111
set(OATPP_THIS_MODULE_DIRECTORIES oatpp-swagger) ## list of directories to install

src/oatpp-swagger/oas3/Generator.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -74,44 +74,44 @@ Schema::ObjectWrapper Generator::generateSchemaForType(const oatpp::data::mappin
7474

7575
OATPP_ASSERT(type && "[oatpp-swagger::oas3::Generator::generateSchemaForType()]: Error. Type should not be null.");
7676

77-
auto typeName = type->name;
78-
if(typeName == oatpp::data::mapping::type::__class::String::CLASS_NAME){
77+
auto classId = type->classId.id;
78+
if(classId == oatpp::data::mapping::type::__class::String::CLASS_ID.id){
7979
auto result = Schema::createShared();
8080
result->type = "string";
8181
return result;
82-
} else if(typeName == oatpp::data::mapping::type::__class::Int32::CLASS_NAME){
82+
} else if(classId == oatpp::data::mapping::type::__class::Int32::CLASS_ID.id){
8383
auto result = Schema::createShared();
8484
result->type = "integer";
8585
result->format = "int32";
8686
return result;
87-
} else if(typeName == oatpp::data::mapping::type::__class::Int64::CLASS_NAME){
87+
} else if(classId == oatpp::data::mapping::type::__class::Int64::CLASS_ID.id){
8888
auto result = Schema::createShared();
8989
result->type = "integer";
9090
result->format = "int64";
9191
return result;
92-
} else if(typeName == oatpp::data::mapping::type::__class::Float32::CLASS_NAME){
92+
} else if(classId == oatpp::data::mapping::type::__class::Float32::CLASS_ID.id){
9393
auto result = Schema::createShared();
9494
result->type = "number";
9595
result->format = "float";
9696
return result;
97-
} else if(typeName == oatpp::data::mapping::type::__class::Float64::CLASS_NAME){
97+
} else if(classId == oatpp::data::mapping::type::__class::Float64::CLASS_ID.id){
9898
auto result = Schema::createShared();
9999
result->type = "number";
100100
result->format = "double";
101101
return result;
102-
} else if(typeName == oatpp::data::mapping::type::__class::Boolean::CLASS_NAME){
102+
} else if(classId == oatpp::data::mapping::type::__class::Boolean::CLASS_ID.id){
103103
auto result = Schema::createShared();
104104
result->type = "boolean";
105105
return result;
106-
} else if(typeName == oatpp::data::mapping::type::__class::AbstractObject::CLASS_NAME){
106+
} else if(classId == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id){
107107
return generateSchemaForTypeObject(type, linkSchema, usedTypes);
108-
} else if(typeName == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME){
108+
} else if(classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id){
109109
return generateSchemaForTypeList(type, linkSchema, usedTypes);
110-
} else if(typeName == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_NAME){
110+
} else if(classId == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_ID.id){
111111
// TODO
112112
} else {
113113
auto result = Schema::createShared();
114-
result->type = type->name;
114+
result->type = type->classId.name;
115115
if(type->nameQualifier) {
116116
result->format = type->nameQualifier;
117117
}
@@ -181,11 +181,11 @@ RequestBody::ObjectWrapper Generator::generateRequestBody(const Endpoint::Info&
181181

182182
OATPP_ASSERT(endpointInfo.body.type && "[oatpp-swagger::oas3::Generator::generateRequestBody()]: Error. Type should not be null.");
183183

184-
if(endpointInfo.body.type->name == oatpp::data::mapping::type::__class::AbstractObject::CLASS_NAME) {
184+
if(endpointInfo.body.type->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id) {
185185
body->content->put("application/json", mediaType);
186-
} else if(endpointInfo.body.type->name == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME) {
186+
} else if(endpointInfo.body.type->classId.id == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id) {
187187
body->content->put("application/json", mediaType);
188-
} else if(endpointInfo.body.type->name == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_NAME) {
188+
} else if(endpointInfo.body.type->classId.id == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_ID.id) {
189189
body->content->put("application/json", mediaType);
190190
} else {
191191
body->content->put("text/plain", mediaType);
@@ -397,12 +397,12 @@ void Generator::decomposeMap(const oatpp::data::mapping::type::Type* type, UsedT
397397

398398
void Generator::decomposeType(const oatpp::data::mapping::type::Type* type, UsedTypes& decomposedTypes) {
399399
OATPP_ASSERT(type && "[oatpp-swagger::oas3::Generator::decomposeType()]: Error. Type should not be null.");
400-
auto typeName = type->name;
401-
if(typeName == oatpp::data::mapping::type::__class::AbstractObject::CLASS_NAME){
400+
auto classId = type->classId.id;
401+
if(classId == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id){
402402
decomposeObject(type, decomposedTypes);
403-
} else if(typeName == oatpp::data::mapping::type::__class::AbstractList::CLASS_NAME){
403+
} else if(classId == oatpp::data::mapping::type::__class::AbstractList::CLASS_ID.id){
404404
decomposeList(type, decomposedTypes);
405-
} else if(typeName == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_NAME){
405+
} else if(classId == oatpp::data::mapping::type::__class::AbstractListMap::CLASS_ID.id){
406406
decomposeMap(type, decomposedTypes);
407407
}
408408
}

0 commit comments

Comments
 (0)