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