Skip to content

Commit 1eca97f

Browse files
mpreuwing328
authored andcommitted
Fix wrong include path in api-header template (#3062)
Change local json.hpp include path to correct value. Update samples.
1 parent 8d9eb5b commit 1eca97f

File tree

6 files changed

+349
-2
lines changed

6 files changed

+349
-2
lines changed

modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <pistache/router.h>
1414
#include <pistache/http_headers.h>
1515
#include <pistache/optional.h>
16-
{{^hasModelImport}}#include "json.hpp"{{/hasModelImport}}
16+
{{^hasModelImport}}#include <nlohmann/json.hpp>{{/hasModelImport}}
1717

1818
{{#imports}}{{{import}}}
1919
{{/imports}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.1-SNAPSHOT
1+
4.0.2-SNAPSHOT
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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 "Inline_object.h"
15+
16+
namespace org {
17+
namespace openapitools {
18+
namespace server {
19+
namespace model {
20+
21+
Inline_object::Inline_object()
22+
{
23+
m_Name = "";
24+
m_NameIsSet = false;
25+
m_Status = "";
26+
m_StatusIsSet = false;
27+
28+
}
29+
30+
Inline_object::~Inline_object()
31+
{
32+
}
33+
34+
void Inline_object::validate()
35+
{
36+
// TODO: implement validation
37+
}
38+
39+
void to_json(nlohmann::json& j, const Inline_object& o)
40+
{
41+
j = nlohmann::json();
42+
if(o.nameIsSet())
43+
j["name"] = o.m_Name;
44+
if(o.statusIsSet())
45+
j["status"] = o.m_Status;
46+
}
47+
48+
void from_json(const nlohmann::json& j, Inline_object& o)
49+
{
50+
if(j.contains("name"))
51+
{
52+
j.at("name").get_to(o.m_Name);
53+
o.m_NameIsSet = true;
54+
}
55+
if(j.contains("status"))
56+
{
57+
j.at("status").get_to(o.m_Status);
58+
o.m_StatusIsSet = true;
59+
}
60+
}
61+
62+
std::string Inline_object::getName() const
63+
{
64+
return m_Name;
65+
}
66+
void Inline_object::setName(std::string const& value)
67+
{
68+
m_Name = value;
69+
m_NameIsSet = true;
70+
}
71+
bool Inline_object::nameIsSet() const
72+
{
73+
return m_NameIsSet;
74+
}
75+
void Inline_object::unsetName()
76+
{
77+
m_NameIsSet = false;
78+
}
79+
std::string Inline_object::getStatus() const
80+
{
81+
return m_Status;
82+
}
83+
void Inline_object::setStatus(std::string const& value)
84+
{
85+
m_Status = value;
86+
m_StatusIsSet = true;
87+
}
88+
bool Inline_object::statusIsSet() const
89+
{
90+
return m_StatusIsSet;
91+
}
92+
void Inline_object::unsetStatus()
93+
{
94+
m_StatusIsSet = false;
95+
}
96+
97+
}
98+
}
99+
}
100+
}
101+
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+
* Inline_object.h
14+
*
15+
*
16+
*/
17+
18+
#ifndef Inline_object_H_
19+
#define Inline_object_H_
20+
21+
22+
#include <string>
23+
#include <nlohmann/json.hpp>
24+
25+
namespace org {
26+
namespace openapitools {
27+
namespace server {
28+
namespace model {
29+
30+
/// <summary>
31+
///
32+
/// </summary>
33+
class Inline_object
34+
{
35+
public:
36+
Inline_object();
37+
virtual ~Inline_object();
38+
39+
void validate();
40+
41+
/////////////////////////////////////////////
42+
/// Inline_object members
43+
44+
/// <summary>
45+
/// Updated name of the pet
46+
/// </summary>
47+
std::string getName() const;
48+
void setName(std::string const& value);
49+
bool nameIsSet() const;
50+
void unsetName();
51+
/// <summary>
52+
/// Updated status of the pet
53+
/// </summary>
54+
std::string getStatus() const;
55+
void setStatus(std::string const& value);
56+
bool statusIsSet() const;
57+
void unsetStatus();
58+
59+
friend void to_json(nlohmann::json& j, const Inline_object& o);
60+
friend void from_json(const nlohmann::json& j, Inline_object& o);
61+
protected:
62+
std::string m_Name;
63+
bool m_NameIsSet;
64+
std::string m_Status;
65+
bool m_StatusIsSet;
66+
};
67+
68+
}
69+
}
70+
}
71+
}
72+
73+
#endif /* Inline_object_H_ */
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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 "Inline_object_1.h"
15+
16+
namespace org {
17+
namespace openapitools {
18+
namespace server {
19+
namespace model {
20+
21+
Inline_object_1::Inline_object_1()
22+
{
23+
m_AdditionalMetadata = "";
24+
m_AdditionalMetadataIsSet = false;
25+
m_fileIsSet = false;
26+
27+
}
28+
29+
Inline_object_1::~Inline_object_1()
30+
{
31+
}
32+
33+
void Inline_object_1::validate()
34+
{
35+
// TODO: implement validation
36+
}
37+
38+
void to_json(nlohmann::json& j, const Inline_object_1& o)
39+
{
40+
j = nlohmann::json();
41+
if(o.additionalMetadataIsSet())
42+
j["additionalMetadata"] = o.m_AdditionalMetadata;
43+
if(o.fileIsSet())
44+
j["file"] = o.m_file;
45+
}
46+
47+
void from_json(const nlohmann::json& j, Inline_object_1& o)
48+
{
49+
if(j.contains("additionalMetadata"))
50+
{
51+
j.at("additionalMetadata").get_to(o.m_AdditionalMetadata);
52+
o.m_AdditionalMetadataIsSet = true;
53+
}
54+
if(j.contains("file"))
55+
{
56+
j.at("file").get_to(o.m_file);
57+
o.m_fileIsSet = true;
58+
}
59+
}
60+
61+
std::string Inline_object_1::getAdditionalMetadata() const
62+
{
63+
return m_AdditionalMetadata;
64+
}
65+
void Inline_object_1::setAdditionalMetadata(std::string const& value)
66+
{
67+
m_AdditionalMetadata = value;
68+
m_AdditionalMetadataIsSet = true;
69+
}
70+
bool Inline_object_1::additionalMetadataIsSet() const
71+
{
72+
return m_AdditionalMetadataIsSet;
73+
}
74+
void Inline_object_1::unsetAdditionalMetadata()
75+
{
76+
m_AdditionalMetadataIsSet = false;
77+
}
78+
std::string Inline_object_1::getFile() const
79+
{
80+
return m_file;
81+
}
82+
void Inline_object_1::setFile(std::string const& value)
83+
{
84+
m_file = value;
85+
m_fileIsSet = true;
86+
}
87+
bool Inline_object_1::fileIsSet() const
88+
{
89+
return m_fileIsSet;
90+
}
91+
void Inline_object_1::unsetfile()
92+
{
93+
m_fileIsSet = false;
94+
}
95+
96+
}
97+
}
98+
}
99+
}
100+
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+
* Inline_object_1.h
14+
*
15+
*
16+
*/
17+
18+
#ifndef Inline_object_1_H_
19+
#define Inline_object_1_H_
20+
21+
22+
#include <string>
23+
#include <nlohmann/json.hpp>
24+
25+
namespace org {
26+
namespace openapitools {
27+
namespace server {
28+
namespace model {
29+
30+
/// <summary>
31+
///
32+
/// </summary>
33+
class Inline_object_1
34+
{
35+
public:
36+
Inline_object_1();
37+
virtual ~Inline_object_1();
38+
39+
void validate();
40+
41+
/////////////////////////////////////////////
42+
/// Inline_object_1 members
43+
44+
/// <summary>
45+
/// Additional data to pass to server
46+
/// </summary>
47+
std::string getAdditionalMetadata() const;
48+
void setAdditionalMetadata(std::string const& value);
49+
bool additionalMetadataIsSet() const;
50+
void unsetAdditionalMetadata();
51+
/// <summary>
52+
/// file to upload
53+
/// </summary>
54+
std::string getFile() const;
55+
void setFile(std::string const& value);
56+
bool fileIsSet() const;
57+
void unsetfile();
58+
59+
friend void to_json(nlohmann::json& j, const Inline_object_1& o);
60+
friend void from_json(const nlohmann::json& j, Inline_object_1& o);
61+
protected:
62+
std::string m_AdditionalMetadata;
63+
bool m_AdditionalMetadataIsSet;
64+
std::string m_file;
65+
bool m_fileIsSet;
66+
};
67+
68+
}
69+
}
70+
}
71+
}
72+
73+
#endif /* Inline_object_1_H_ */

0 commit comments

Comments
 (0)