forked from loafle/openapi-generator-original
fix file type in qt5cpp
This commit is contained in:
parent
a4bcb3bc73
commit
409015461c
@ -1665,6 +1665,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
if (p instanceof ByteArraySchema || SchemaTypeUtil.BYTE_FORMAT.equals(p.getFormat())) {
|
||||
property.isByteArray = true;
|
||||
property.isFile = true; // in OAS3.0 "file" is 'byte' (format)
|
||||
}
|
||||
|
||||
if (p instanceof NumberSchema || SchemaTypeUtil.NUMBER_TYPE.equals(p.getType())) {
|
||||
@ -2313,6 +2314,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
r.isUuid = true;
|
||||
} else if (Boolean.TRUE.equals(cp.isByteArray)) {
|
||||
r.isByteArray = true;
|
||||
r.isFile = true; // in OAS3.0 "file" is 'byte' (format)
|
||||
} else if (Boolean.TRUE.equals(cp.isString)) {
|
||||
r.isString = true;
|
||||
} else if (Boolean.TRUE.equals(cp.isBoolean)) {
|
||||
@ -3552,6 +3554,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (Boolean.TRUE.equals(property.isByteArray)) {
|
||||
parameter.isByteArray = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
parameter.isFile = true; // in OAS3.0 "file" is 'byte' (format)
|
||||
} else if (Boolean.TRUE.equals(property.isBinary)) {
|
||||
parameter.isByteArray = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
parameter.isFile = true; // in OAS3.0 "file" is 'byte' (format)
|
||||
} else if (Boolean.TRUE.equals(property.isString)) {
|
||||
parameter.isString = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
@ -3573,9 +3580,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (Boolean.TRUE.equals(property.isNumber)) {
|
||||
parameter.isNumber = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isBinary)) {
|
||||
parameter.isByteArray = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isFile)) {
|
||||
parameter.isFile = true;
|
||||
} else if (Boolean.TRUE.equals(property.isDate)) {
|
||||
|
@ -127,8 +127,8 @@ public class CppQt5ClientCodegen extends AbstractCppCodegen implements CodegenCo
|
||||
typeMapping.put("file", "SWGHttpRequestInputFileElement");
|
||||
typeMapping.put("object", PREFIX + "Object");
|
||||
//TODO binary should be mapped to byte array
|
||||
// mapped to String as a workaround
|
||||
typeMapping.put("binary", "QString");
|
||||
// mapped as "file" type for OAS 3.0
|
||||
typeMapping.put("binary", "SWGHttpRequestInputFileElement");
|
||||
typeMapping.put("ByteArray", "QByteArray");
|
||||
// UUID support - possible enhancement : use QUuid instead of QString.
|
||||
// beware though that Serialisation/deserialisation of QUuid does not
|
||||
|
@ -66,7 +66,7 @@ void
|
||||
SWGBody_1::fromJsonObject(QJsonObject pJson) {
|
||||
::Swagger::setValue(&additional_metadata, pJson["additionalMetadata"], "QString", "QString");
|
||||
|
||||
::Swagger::setValue(&file, pJson["file"], "QString", "QString");
|
||||
::Swagger::setValue(&file, pJson["file"], "SWGHttpRequestInputFileElement", "SWGHttpRequestInputFileElement");
|
||||
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ SWGBody_1::asJsonObject() {
|
||||
toJsonValue(QString("additionalMetadata"), additional_metadata, obj, QString("QString"));
|
||||
}
|
||||
if((file != nullptr) && (file->isSet())){
|
||||
toJsonValue(QString("file"), file, obj, QString("QString"));
|
||||
toJsonValue(QString("file"), file, obj, QString("SWGHttpRequestInputFileElement"));
|
||||
}
|
||||
|
||||
return obj;
|
||||
@ -102,12 +102,12 @@ SWGBody_1::setAdditionalMetadata(QString* additional_metadata) {
|
||||
this->m_additional_metadata_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGHttpRequestInputFileElement*
|
||||
SWGBody_1::getFile() {
|
||||
return file;
|
||||
}
|
||||
void
|
||||
SWGBody_1::setFile(QString* file) {
|
||||
SWGBody_1::setFile(SWGHttpRequestInputFileElement* file) {
|
||||
this->file = file;
|
||||
this->m_file_isSet = true;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGHttpRequest.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
@ -44,8 +45,8 @@ public:
|
||||
QString* getAdditionalMetadata();
|
||||
void setAdditionalMetadata(QString* additional_metadata);
|
||||
|
||||
QString* getFile();
|
||||
void setFile(QString* file);
|
||||
SWGHttpRequestInputFileElement* getFile();
|
||||
void setFile(SWGHttpRequestInputFileElement* file);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
@ -54,7 +55,7 @@ private:
|
||||
QString* additional_metadata;
|
||||
bool m_additional_metadata_isSet;
|
||||
|
||||
QString* file;
|
||||
SWGHttpRequestInputFileElement* file;
|
||||
bool m_file_isSet;
|
||||
|
||||
};
|
||||
|
@ -514,7 +514,7 @@ SWGPetApi::updatePetWithFormCallback(SWGHttpRequestWorker * worker) {
|
||||
}
|
||||
|
||||
void
|
||||
SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, QString* file) {
|
||||
SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) {
|
||||
QString fullPath;
|
||||
fullPath.append(this->host).append(this->basePath).append("/pet/{petId}/uploadImage");
|
||||
|
||||
@ -529,7 +529,7 @@ SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, QString* file
|
||||
input.add_var("additionalMetadata", *additional_metadata);
|
||||
}
|
||||
if (file != nullptr) {
|
||||
input.add_var("file", *file);
|
||||
input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include "SWGApiResponse.h"
|
||||
#include "SWGHttpRequest.h"
|
||||
#include "SWGPet.h"
|
||||
|
||||
#include <QObject>
|
||||
@ -42,7 +43,7 @@ public:
|
||||
void getPetById(qint64 pet_id);
|
||||
void updatePet(SWGPet& pet);
|
||||
void updatePetWithForm(qint64 pet_id, QString* name, QString* status);
|
||||
void uploadFile(qint64 pet_id, QString* additional_metadata, QString* file);
|
||||
void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file);
|
||||
|
||||
private:
|
||||
void addPetCallback (SWGHttpRequestWorker * worker);
|
||||
|
Loading…
x
Reference in New Issue
Block a user