[C++][Restbed/Pistache] Added fix for byte array (#752)

* Added fix for byte array

* Fix spacing

* Adapted default value for ByteArray

* Adapted default value for ByteArray in Pistache Server
This commit is contained in:
stkrwork
2018-08-07 17:07:05 +02:00
committed by GitHub
parent baf16cf834
commit 0809d8f527
21 changed files with 25 additions and 20 deletions

View File

@@ -341,7 +341,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen {
return "0"; return "0";
} }
else if (ModelUtils.isByteArraySchema(p)) { else if (ModelUtils.isByteArraySchema(p)) {
return ""; return "\"\"";
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
String inner = getSchemaType((Schema) p.getAdditionalProperties()); String inner = getSchemaType((Schema) p.getAdditionalProperties());
return "std::map<std::string, " + inner + ">()"; return "std::map<std::string, " + inner + ">()";

View File

@@ -90,6 +90,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
typeMapping.put("binary", "restbed::Bytes"); typeMapping.put("binary", "restbed::Bytes");
typeMapping.put("number", "double"); typeMapping.put("number", "double");
typeMapping.put("UUID", "std::string"); typeMapping.put("UUID", "std::string");
typeMapping.put("ByteArray", "std::string");
super.importMapping = new HashMap<String, String>(); super.importMapping = new HashMap<String, String>();
importMapping.put("std::vector", "#include <vector>"); importMapping.put("std::vector", "#include <vector>");
@@ -271,6 +272,8 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties(); Schema inner = (Schema) p.getAdditionalProperties();
return getSchemaType(p) + "<std::string, " + getTypeDeclaration(inner) + ">"; return getSchemaType(p) + "<std::string, " + getTypeDeclaration(inner) + ">";
} else if (ModelUtils.isByteArraySchema(p)) {
return "std::string";
} else if (ModelUtils.isStringSchema(p) } else if (ModelUtils.isStringSchema(p)
|| ModelUtils.isDateSchema(p) || ModelUtils.isDateSchema(p)
|| ModelUtils.isDateTimeSchema(p) || ModelUtils.isFileSchema(p) || ModelUtils.isDateTimeSchema(p) || ModelUtils.isFileSchema(p)
@@ -301,6 +304,8 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen {
return "0L"; return "0L";
} }
return "0"; return "0";
} else if (ModelUtils.isByteArraySchema(p)) {
return "\"\"";
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
String inner = getSchemaType((Schema) p.getAdditionalProperties()); String inner = getSchemaType((Schema) p.getAdditionalProperties());
return "std::map<std::string, " + inner + ">()"; return "std::map<std::string, " + inner + ">()";

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT 3.2.1-SNAPSHOT

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */

View File

@@ -5,7 +5,7 @@
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
* *
* *
* NOTE: This class is auto generated by OpenAPI-Generator 3.0.0-SNAPSHOT. * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech * https://openapi-generator.tech
* Do not edit the class manually. * Do not edit the class manually.
*/ */