Skip to content

Commit 40f1f92

Browse files
MartinDelilleetherealjoy
authored andcommitted
qt5 client: use openapi 3 spec (#3400)
1 parent 5775813 commit 40f1f92

12 files changed

+437
-24
lines changed

bin/cpp-qt5-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g cpp-qt5-client -o samples/client/petstore/cpp-qt5 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/**
2+
* OpenAPI Petstore
3+
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
#include "OAIInline_object.h"
15+
16+
#include "OAIHelpers.h"
17+
18+
#include <QJsonDocument>
19+
#include <QJsonArray>
20+
#include <QObject>
21+
#include <QDebug>
22+
23+
namespace OpenAPI {
24+
25+
OAIInline_object::OAIInline_object(QString json) {
26+
this->init();
27+
this->fromJson(json);
28+
}
29+
30+
OAIInline_object::OAIInline_object() {
31+
this->init();
32+
}
33+
34+
OAIInline_object::~OAIInline_object() {
35+
36+
}
37+
38+
void
39+
OAIInline_object::init() {
40+
41+
m_name_isSet = false;
42+
m_name_isValid = false;
43+
44+
m_status_isSet = false;
45+
m_status_isValid = false;
46+
}
47+
48+
void
49+
OAIInline_object::fromJson(QString jsonString) {
50+
QByteArray array (jsonString.toStdString().c_str());
51+
QJsonDocument doc = QJsonDocument::fromJson(array);
52+
QJsonObject jsonObject = doc.object();
53+
this->fromJsonObject(jsonObject);
54+
}
55+
56+
void
57+
OAIInline_object::fromJsonObject(QJsonObject json) {
58+
59+
m_name_isValid = ::OpenAPI::fromJsonValue(name, json[QString("name")]);
60+
61+
62+
m_status_isValid = ::OpenAPI::fromJsonValue(status, json[QString("status")]);
63+
64+
65+
}
66+
67+
QString
68+
OAIInline_object::asJson () const {
69+
QJsonObject obj = this->asJsonObject();
70+
QJsonDocument doc(obj);
71+
QByteArray bytes = doc.toJson();
72+
return QString(bytes);
73+
}
74+
75+
QJsonObject
76+
OAIInline_object::asJsonObject() const {
77+
QJsonObject obj;
78+
if(m_name_isSet){
79+
obj.insert(QString("name"), ::OpenAPI::toJsonValue(name));
80+
}
81+
if(m_status_isSet){
82+
obj.insert(QString("status"), ::OpenAPI::toJsonValue(status));
83+
}
84+
return obj;
85+
}
86+
87+
88+
QString
89+
OAIInline_object::getName() const {
90+
return name;
91+
}
92+
void
93+
OAIInline_object::setName(const QString &name) {
94+
this->name = name;
95+
this->m_name_isSet = true;
96+
}
97+
98+
99+
QString
100+
OAIInline_object::getStatus() const {
101+
return status;
102+
}
103+
void
104+
OAIInline_object::setStatus(const QString &status) {
105+
this->status = status;
106+
this->m_status_isSet = true;
107+
}
108+
109+
bool
110+
OAIInline_object::isSet() const {
111+
bool isObjectUpdated = false;
112+
do{
113+
if(m_name_isSet){ isObjectUpdated = true; break;}
114+
115+
if(m_status_isSet){ isObjectUpdated = true; break;}
116+
}while(false);
117+
return isObjectUpdated;
118+
}
119+
120+
bool
121+
OAIInline_object::isValid() const {
122+
// only required properties are required for the object to be considered valid
123+
return true;
124+
}
125+
126+
}
127+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* OpenAPI Petstore
3+
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
/*
14+
* OAIInline_object.h
15+
*
16+
*
17+
*/
18+
19+
#ifndef OAIInline_object_H
20+
#define OAIInline_object_H
21+
22+
#include <QJsonObject>
23+
24+
25+
#include <QString>
26+
27+
#include "OAIObject.h"
28+
#include "OAIEnum.h"
29+
30+
namespace OpenAPI {
31+
32+
class OAIInline_object: public OAIObject {
33+
public:
34+
OAIInline_object();
35+
OAIInline_object(QString json);
36+
~OAIInline_object() override;
37+
38+
QString asJson () const override;
39+
QJsonObject asJsonObject() const override;
40+
void fromJsonObject(QJsonObject json) override;
41+
void fromJson(QString jsonString) override;
42+
43+
44+
QString getName() const;
45+
void setName(const QString &name);
46+
47+
48+
QString getStatus() const;
49+
void setStatus(const QString &status);
50+
51+
52+
53+
virtual bool isSet() const override;
54+
virtual bool isValid() const override;
55+
56+
private:
57+
void init();
58+
59+
QString name;
60+
bool m_name_isSet;
61+
bool m_name_isValid;
62+
63+
QString status;
64+
bool m_status_isSet;
65+
bool m_status_isValid;
66+
67+
};
68+
69+
}
70+
71+
Q_DECLARE_METATYPE(OpenAPI::OAIInline_object)
72+
73+
#endif // OAIInline_object_H
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/**
2+
* OpenAPI Petstore
3+
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
#include "OAIInline_object_1.h"
15+
16+
#include "OAIHelpers.h"
17+
18+
#include <QJsonDocument>
19+
#include <QJsonArray>
20+
#include <QObject>
21+
#include <QDebug>
22+
23+
namespace OpenAPI {
24+
25+
OAIInline_object_1::OAIInline_object_1(QString json) {
26+
this->init();
27+
this->fromJson(json);
28+
}
29+
30+
OAIInline_object_1::OAIInline_object_1() {
31+
this->init();
32+
}
33+
34+
OAIInline_object_1::~OAIInline_object_1() {
35+
36+
}
37+
38+
void
39+
OAIInline_object_1::init() {
40+
41+
m_additional_metadata_isSet = false;
42+
m_additional_metadata_isValid = false;
43+
44+
m_file_isSet = false;
45+
m_file_isValid = false;
46+
}
47+
48+
void
49+
OAIInline_object_1::fromJson(QString jsonString) {
50+
QByteArray array (jsonString.toStdString().c_str());
51+
QJsonDocument doc = QJsonDocument::fromJson(array);
52+
QJsonObject jsonObject = doc.object();
53+
this->fromJsonObject(jsonObject);
54+
}
55+
56+
void
57+
OAIInline_object_1::fromJsonObject(QJsonObject json) {
58+
59+
m_additional_metadata_isValid = ::OpenAPI::fromJsonValue(additional_metadata, json[QString("additionalMetadata")]);
60+
61+
62+
m_file_isValid = ::OpenAPI::fromJsonValue(file, json[QString("file")]);
63+
64+
65+
}
66+
67+
QString
68+
OAIInline_object_1::asJson () const {
69+
QJsonObject obj = this->asJsonObject();
70+
QJsonDocument doc(obj);
71+
QByteArray bytes = doc.toJson();
72+
return QString(bytes);
73+
}
74+
75+
QJsonObject
76+
OAIInline_object_1::asJsonObject() const {
77+
QJsonObject obj;
78+
if(m_additional_metadata_isSet){
79+
obj.insert(QString("additionalMetadata"), ::OpenAPI::toJsonValue(additional_metadata));
80+
}
81+
if(file.isSet()){
82+
obj.insert(QString("file"), ::OpenAPI::toJsonValue(file));
83+
}
84+
return obj;
85+
}
86+
87+
88+
QString
89+
OAIInline_object_1::getAdditionalMetadata() const {
90+
return additional_metadata;
91+
}
92+
void
93+
OAIInline_object_1::setAdditionalMetadata(const QString &additional_metadata) {
94+
this->additional_metadata = additional_metadata;
95+
this->m_additional_metadata_isSet = true;
96+
}
97+
98+
99+
OAIHttpRequestInputFileElement*
100+
OAIInline_object_1::getFile() const {
101+
return file;
102+
}
103+
void
104+
OAIInline_object_1::setFile(const OAIHttpRequestInputFileElement* &file) {
105+
this->file = file;
106+
this->m_file_isSet = true;
107+
}
108+
109+
bool
110+
OAIInline_object_1::isSet() const {
111+
bool isObjectUpdated = false;
112+
do{
113+
if(m_additional_metadata_isSet){ isObjectUpdated = true; break;}
114+
115+
if(file.isSet()){ isObjectUpdated = true; break;}
116+
}while(false);
117+
return isObjectUpdated;
118+
}
119+
120+
bool
121+
OAIInline_object_1::isValid() const {
122+
// only required properties are required for the object to be considered valid
123+
return true;
124+
}
125+
126+
}
127+

0 commit comments

Comments
 (0)