-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpprest : Fix Eve Online ESI. #7571
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e462d1e
cpprest : Add toJson and toHttpContent array support.
2435ccb
petstore : Run script.
4867574
cpprest : Fix toHttpContent function header.
0f360da
petstore : Run script.
925ba71
cpprest : Add support for primitive response without enclosing item.
158ce7f
cpprest : Fix spaces.
eccd679
cpprest : Fix build if bodyParam is optional.
42abef5
cpprest : Fix vector of vector param.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
#include <cpprest/details/basic_types.h> | ||
#include <cpprest/json.h> | ||
|
||
#include <vector> | ||
|
||
{{#modelNamespaceDeclarations}} | ||
namespace {{this}} { | ||
{{/modelNamespaceDeclarations}} | ||
|
@@ -41,6 +43,8 @@ public: | |
static web::json::value toJson( int64_t value ); | ||
static web::json::value toJson( double value ); | ||
static web::json::value toJson( bool value ); | ||
template<class T> | ||
static web::json::value toJson(const std::vector<T>& value); | ||
|
||
static int64_t int64_tFromJson(web::json::value& val); | ||
static int32_t int32_tFromJson(web::json::value& val); | ||
|
@@ -58,6 +62,8 @@ public: | |
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
template <class T> | ||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
|
||
static int64_t int64_tFromHttpContent(std::shared_ptr<HttpContent> val); | ||
static int32_t int32_tFromHttpContent(std::shared_ptr<HttpContent> val); | ||
|
@@ -74,6 +80,29 @@ public: | |
static std::shared_ptr<std::istream> fromBase64( const utility::string_t& encoded ); | ||
}; | ||
|
||
template<class T> | ||
web::json::value ModelBase::toJson(const std::vector<T>& value) { | ||
std::vector<web::json::value> ret; | ||
for (auto& x : value) { | ||
ret.push_back(toJson(x)); | ||
} | ||
|
||
return web::json::value::array(ret); | ||
} | ||
|
||
template <class T> | ||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType ) { | ||
web::json::value json_array = ModelBase::toJson(value); | ||
std::shared_ptr<HttpContent> content( new HttpContent ); | ||
content->setName( name ); | ||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); | ||
content->setContentType( contentType ); | ||
std::stringstream* valueAsStringStream = new std::stringstream(); | ||
(*valueAsStringStream) << json_array; | ||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is missing the encoding conversion |
||
return content; | ||
} | ||
|
||
{{#modelNamespaceDeclarations}} | ||
} | ||
{{/modelNamespaceDeclarations}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.3.0-SNAPSHOT | ||
2.4.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* OpenAPI spec version: 1.0.0 | ||
* Contact: apiteam@swagger.io | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator 2.3.0-SNAPSHOT. | ||
* NOTE: This class is auto generated by the swagger code generator 2.4.0-SNAPSHOT. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
* Do not edit the class manually. | ||
*/ | ||
|
@@ -26,6 +26,8 @@ | |
#include <cpprest/details/basic_types.h> | ||
#include <cpprest/json.h> | ||
|
||
#include <vector> | ||
|
||
namespace io { | ||
namespace swagger { | ||
namespace client { | ||
|
@@ -53,6 +55,8 @@ class ModelBase | |
static web::json::value toJson( int64_t value ); | ||
static web::json::value toJson( double value ); | ||
static web::json::value toJson( bool value ); | ||
template<class T> | ||
static web::json::value toJson(const std::vector<T>& value); | ||
|
||
static int64_t int64_tFromJson(web::json::value& val); | ||
static int32_t int32_tFromJson(web::json::value& val); | ||
|
@@ -70,6 +74,8 @@ class ModelBase | |
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int32_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, int64_t value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, double value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
template <class T> | ||
static std::shared_ptr<HttpContent> toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType = utility::conversions::to_string_t("") ); | ||
|
||
static int64_t int64_tFromHttpContent(std::shared_ptr<HttpContent> val); | ||
static int32_t int32_tFromHttpContent(std::shared_ptr<HttpContent> val); | ||
|
@@ -86,6 +92,29 @@ class ModelBase | |
static std::shared_ptr<std::istream> fromBase64( const utility::string_t& encoded ); | ||
}; | ||
|
||
template<class T> | ||
web::json::value ModelBase::toJson(const std::vector<T>& value) { | ||
std::vector<web::json::value> ret; | ||
for (auto& x : value) { | ||
ret.push_back(toJson(x)); | ||
} | ||
|
||
return web::json::value::array(ret); | ||
} | ||
|
||
template <class T> | ||
std::shared_ptr<HttpContent> ModelBase::toHttpContent( const utility::string_t& name, const std::vector<T>& value, const utility::string_t& contentType ) { | ||
web::json::value json_array = ModelBase::toJson(value); | ||
std::shared_ptr<HttpContent> content( new HttpContent ); | ||
content->setName( name ); | ||
content->setContentDisposition( utility::conversions::to_string_t("form-data") ); | ||
content->setContentType( contentType ); | ||
std::stringstream* valueAsStringStream = new std::stringstream(); | ||
(*valueAsStringStream) << json_array; | ||
content->setData( std::shared_ptr<std::istream>( valueAsStringStream ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is missing the encoding conversion |
||
return content; | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if({{^required}}{{paramName}} && {{/required}}{{paramName}}.get())
isn't paramName a pointer here? when ^required?