Fix wrong include path in api-header template (#3062)

Change local json.hpp include path to correct value.

Update samples.
This commit is contained in:
Matthias Preu 2019-06-03 09:41:45 +02:00 committed by William Cheng
parent 8d9eb5ba54
commit 1eca97f738
6 changed files with 349 additions and 2 deletions

View File

@ -13,7 +13,7 @@
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
{{^hasModelImport}}#include "json.hpp"{{/hasModelImport}}
{{^hasModelImport}}#include <nlohmann/json.hpp>{{/hasModelImport}}
{{#imports}}{{{import}}}
{{/imports}}

View File

@ -1 +1 @@
4.0.1-SNAPSHOT
4.0.2-SNAPSHOT

View File

@ -0,0 +1,101 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Inline_object.h"
namespace org {
namespace openapitools {
namespace server {
namespace model {
Inline_object::Inline_object()
{
m_Name = "";
m_NameIsSet = false;
m_Status = "";
m_StatusIsSet = false;
}
Inline_object::~Inline_object()
{
}
void Inline_object::validate()
{
// TODO: implement validation
}
void to_json(nlohmann::json& j, const Inline_object& o)
{
j = nlohmann::json();
if(o.nameIsSet())
j["name"] = o.m_Name;
if(o.statusIsSet())
j["status"] = o.m_Status;
}
void from_json(const nlohmann::json& j, Inline_object& o)
{
if(j.contains("name"))
{
j.at("name").get_to(o.m_Name);
o.m_NameIsSet = true;
}
if(j.contains("status"))
{
j.at("status").get_to(o.m_Status);
o.m_StatusIsSet = true;
}
}
std::string Inline_object::getName() const
{
return m_Name;
}
void Inline_object::setName(std::string const& value)
{
m_Name = value;
m_NameIsSet = true;
}
bool Inline_object::nameIsSet() const
{
return m_NameIsSet;
}
void Inline_object::unsetName()
{
m_NameIsSet = false;
}
std::string Inline_object::getStatus() const
{
return m_Status;
}
void Inline_object::setStatus(std::string const& value)
{
m_Status = value;
m_StatusIsSet = true;
}
bool Inline_object::statusIsSet() const
{
return m_StatusIsSet;
}
void Inline_object::unsetStatus()
{
m_StatusIsSet = false;
}
}
}
}
}

View File

@ -0,0 +1,73 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Inline_object.h
*
*
*/
#ifndef Inline_object_H_
#define Inline_object_H_
#include <string>
#include <nlohmann/json.hpp>
namespace org {
namespace openapitools {
namespace server {
namespace model {
/// <summary>
///
/// </summary>
class Inline_object
{
public:
Inline_object();
virtual ~Inline_object();
void validate();
/////////////////////////////////////////////
/// Inline_object members
/// <summary>
/// Updated name of the pet
/// </summary>
std::string getName() const;
void setName(std::string const& value);
bool nameIsSet() const;
void unsetName();
/// <summary>
/// Updated status of the pet
/// </summary>
std::string getStatus() const;
void setStatus(std::string const& value);
bool statusIsSet() const;
void unsetStatus();
friend void to_json(nlohmann::json& j, const Inline_object& o);
friend void from_json(const nlohmann::json& j, Inline_object& o);
protected:
std::string m_Name;
bool m_NameIsSet;
std::string m_Status;
bool m_StatusIsSet;
};
}
}
}
}
#endif /* Inline_object_H_ */

View File

@ -0,0 +1,100 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Inline_object_1.h"
namespace org {
namespace openapitools {
namespace server {
namespace model {
Inline_object_1::Inline_object_1()
{
m_AdditionalMetadata = "";
m_AdditionalMetadataIsSet = false;
m_fileIsSet = false;
}
Inline_object_1::~Inline_object_1()
{
}
void Inline_object_1::validate()
{
// TODO: implement validation
}
void to_json(nlohmann::json& j, const Inline_object_1& o)
{
j = nlohmann::json();
if(o.additionalMetadataIsSet())
j["additionalMetadata"] = o.m_AdditionalMetadata;
if(o.fileIsSet())
j["file"] = o.m_file;
}
void from_json(const nlohmann::json& j, Inline_object_1& o)
{
if(j.contains("additionalMetadata"))
{
j.at("additionalMetadata").get_to(o.m_AdditionalMetadata);
o.m_AdditionalMetadataIsSet = true;
}
if(j.contains("file"))
{
j.at("file").get_to(o.m_file);
o.m_fileIsSet = true;
}
}
std::string Inline_object_1::getAdditionalMetadata() const
{
return m_AdditionalMetadata;
}
void Inline_object_1::setAdditionalMetadata(std::string const& value)
{
m_AdditionalMetadata = value;
m_AdditionalMetadataIsSet = true;
}
bool Inline_object_1::additionalMetadataIsSet() const
{
return m_AdditionalMetadataIsSet;
}
void Inline_object_1::unsetAdditionalMetadata()
{
m_AdditionalMetadataIsSet = false;
}
std::string Inline_object_1::getFile() const
{
return m_file;
}
void Inline_object_1::setFile(std::string const& value)
{
m_file = value;
m_fileIsSet = true;
}
bool Inline_object_1::fileIsSet() const
{
return m_fileIsSet;
}
void Inline_object_1::unsetfile()
{
m_fileIsSet = false;
}
}
}
}
}

View File

@ -0,0 +1,73 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Inline_object_1.h
*
*
*/
#ifndef Inline_object_1_H_
#define Inline_object_1_H_
#include <string>
#include <nlohmann/json.hpp>
namespace org {
namespace openapitools {
namespace server {
namespace model {
/// <summary>
///
/// </summary>
class Inline_object_1
{
public:
Inline_object_1();
virtual ~Inline_object_1();
void validate();
/////////////////////////////////////////////
/// Inline_object_1 members
/// <summary>
/// Additional data to pass to server
/// </summary>
std::string getAdditionalMetadata() const;
void setAdditionalMetadata(std::string const& value);
bool additionalMetadataIsSet() const;
void unsetAdditionalMetadata();
/// <summary>
/// file to upload
/// </summary>
std::string getFile() const;
void setFile(std::string const& value);
bool fileIsSet() const;
void unsetfile();
friend void to_json(nlohmann::json& j, const Inline_object_1& o);
friend void from_json(const nlohmann::json& j, Inline_object_1& o);
protected:
std::string m_AdditionalMetadata;
bool m_AdditionalMetadataIsSet;
std::string m_file;
bool m_fileIsSet;
};
}
}
}
}
#endif /* Inline_object_1_H_ */