forked from loafle/openapi-generator-original
Add ref support inside fromProperty (#1235)
This commit is contained in:
@@ -38,6 +38,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -154,7 +155,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
typeMapping.put("map", "std::map");
|
||||
typeMapping.put("file", "HttpContent");
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("binary", "std::string");
|
||||
typeMapping.put("binary", "utility::string_t");
|
||||
typeMapping.put("number", "double");
|
||||
typeMapping.put("UUID", "utility::string_t");
|
||||
typeMapping.put("ByteArray", "utility::string_t");
|
||||
@@ -249,6 +250,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
|
||||
if (methodResponse != null) {
|
||||
Schema response = ModelUtils.getSchemaFromResponse(methodResponse);
|
||||
response = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), response);
|
||||
if (response != null) {
|
||||
CodegenProperty cm = fromProperty("response", response);
|
||||
op.vendorExtensions.put("x-codegen-response", cm);
|
||||
@@ -276,6 +278,24 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
for(String hdr : op.imports) {
|
||||
if(importMapping.containsKey(hdr)) {
|
||||
continue;
|
||||
}
|
||||
operations.put("hasModelImport", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
protected boolean isFileSchema(CodegenProperty property) {
|
||||
return property.baseType.equals("HttpContent");
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
{{#imports}}{{{import}}}
|
||||
{{/imports}}
|
||||
{{^hasModelImport}}#include "../ModelBase.h"{{/hasModelImport}}
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Pet.h"
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <map>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <vector>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
|
||||
Reference in New Issue
Block a user