Skip to content

Commit 344690e

Browse files
authored
Merge branch 'master' into issue-9926
2 parents 3dd0743 + 968d876 commit 344690e

File tree

74 files changed

+555
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+555
-91
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for addit
9999
- [Docker](#docker)
100100
- [Development in Docker](#development-in-docker)
101101
- [Run docker in Vagrant](#run-docker-in-vagrant)
102-
- [Public Docker image](#public-docker-image)
102+
- [Public pre-built Docker images](#public-pre-built-docker-images)
103103
- [Homebrew](#homebrew)
104104
- [Getting Started](#getting-started)
105105
- Generators

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private void postProcessEnumRefs(final Map<String, Object> models) {
408408
// This is different in C# than most other generators, because enums in C# are compiled to integral types,
409409
// while enums in many other languages are true objects.
410410
CodegenModel refModel = enumRefs.get(var.datatype);
411-
var.allowableValues = refModel.allowableValues;
411+
var.allowableValues = new HashMap<>(refModel.allowableValues);
412412
var.isEnum = true;
413413

414414
updateCodegenPropertyEnum(var);

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift4Codegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
6060
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
6161
protected static final String LIBRARY_RX_SWIFT = "RxSwift";
6262
protected static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT};
63+
protected static final String MODEL_CLASSES = "modelClasses";
6364
protected String projectName = "SwaggerClient";
6465
protected boolean unwrapRequired;
6566
protected boolean objcCompatible = false;
@@ -302,6 +303,10 @@ public void processOpts() {
302303
additionalProperties.put(POD_AUTHORS, DEFAULT_POD_AUTHORS);
303304
}
304305

306+
if (additionalProperties.containsKey(MODEL_CLASSES)) {
307+
additionalProperties.put("useModelClasses", true);
308+
}
309+
305310
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
306311

307312
supportingFiles.add(new SupportingFile("Podspec.mustache",

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/Swift5Codegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public class Swift5Codegen extends DefaultCodegen implements CodegenConfig {
4747
private static final String LIBRARY_PROMISE_KIT = "PromiseKit";
4848
private static final String LIBRARY_RX_SWIFT = "RxSwift";
4949
private static final String[] RESPONSE_LIBRARIES = {LIBRARY_PROMISE_KIT, LIBRARY_RX_SWIFT};
50+
protected static final String MODEL_CLASSES = "modelClasses";
5051
protected String projectName = "SwaggerClient";
5152
private boolean unwrapRequired;
5253
private boolean objcCompatible = false;
@@ -289,6 +290,10 @@ public void processOpts() {
289290
additionalProperties.put(POD_AUTHORS, DEFAULT_POD_AUTHORS);
290291
}
291292

293+
if (additionalProperties.containsKey(MODEL_CLASSES)) {
294+
additionalProperties.put("useModelClasses", true);
295+
}
296+
292297
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
293298

294299
supportingFiles.add(new SupportingFile("Podspec.mustache",

modules/swagger-codegen/src/main/resources/Java/libraries/jersey2/build.gradle.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,18 @@ dependencies {
127127
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
128128
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
129129
{{#joda}}
130-
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version",
130+
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
131131
{{/joda}}
132132
{{#java8}}
133133
compile "org.glassfish.jersey.inject:jersey-hk2:$jersey_version"
134-
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
134+
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
135135
{{/java8}}
136136
{{#supportJava6}}
137137
compile "commons-io:commons-io:$commons_io_version"
138138
compile "org.apache.commons:commons-lang3:$commons_lang3_version"
139139
{{/supportJava6}}
140140
{{#threetenbp}}
141-
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version",
141+
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version"
142142
{{/threetenbp}}
143143
{{^java8}}
144144
compile "com.brsanthu:migbase64:2.2"

modules/swagger-codegen/src/main/resources/cpprest/apiclient-header.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public:
3636
void setConfiguration(std::shared_ptr<ApiConfiguration> configuration);
3737
3838
static utility::string_t parameterToString(utility::string_t value);
39+
static utility::string_t parameterToString(bool value);
3940
static utility::string_t parameterToString(int32_t value);
4041
static utility::string_t parameterToString(int64_t value);
4142
static utility::string_t parameterToString(float value);

modules/swagger-codegen/src/main/resources/cpprest/apiclient-source.mustache

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ utility::string_t ApiClient::parameterToString(utility::string_t value)
3131
{
3232
return value;
3333
}
34+
35+
utility::string_t ApiClient::parameterToString(bool value)
36+
{
37+
std::stringstream valueAsStringStream;
38+
valueAsStringStream << (value ? "true" : "false");
39+
return utility::conversions::to_string_t(valueAsStringStream.str());
40+
}
41+
3442
utility::string_t ApiClient::parameterToString(int64_t value)
3543
{
3644
std::stringstream valueAsStringStream;
@@ -132,7 +140,20 @@ pplx::task<web::http::http_response> ApiClient::callApi(
132140
if (!formParams.empty())
133141
{
134142
request.set_body(body_data);
135-
}
143+
}
144+
}
145+
else if (contentType == utility::conversions::to_string_t("multipart/form-data"))
146+
{
147+
MultipartFormData uploadData;
148+
for (auto& kvp : formParams)
149+
{
150+
uploadData.add(ModelBase::toHttpContent(kvp.first, kvp.second));
151+
}
152+
std::stringstream data;
153+
uploadData.writeTo(data);
154+
auto bodyString = data.str();
155+
auto length = bodyString.size();
156+
request.set_body(concurrency::streams::bytestream::open_istream(std::move(bodyString)), length, utility::conversions::to_string_t("multipart/form-data; boundary=") + uploadData.getBoundary());
136157
}
137158
else
138159
{

modules/swagger-codegen/src/main/resources/cpprest/multipart-source.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void MultipartFormData::writeTo( std::ostream& target )
5959
std::shared_ptr<HttpContent> content = m_Contents[i];
6060
6161
// boundary
62-
target << "\r\n" << "--" << utility::conversions::to_utf8string( m_Boundary ) << "\r\n";
62+
target << (i > 0 ? "\r\n" : "") << "--" << utility::conversions::to_utf8string( m_Boundary ) << "\r\n";
6363
6464
// headers
6565
target << "Content-Disposition: " << utility::conversions::to_utf8string( content->getContentDisposition() );

modules/swagger-codegen/src/main/resources/go/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
148148
{{#hasFormParams}}
149149
{{#formParams}}
150150
{{#isFile}}
151-
{{^required}}
152151
var localVarFile {{dataType}}
152+
{{^required}}
153153
if localVarOptionals != nil && localVarOptionals.{{vendorExtensions.x-exportParamName}}.IsSet() {
154154
localVarFileOk := false
155155
localVarFile, localVarFileOk = localVarOptionals.{{vendorExtensions.x-exportParamName}}.Value().({{dataType}})

modules/swagger-codegen/src/main/resources/php/api.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,12 @@ use {{invokerPackage}}\ObjectSerializer;
472472
$headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
473473
}
474474
{{/isBasic}}
475+
{{#isBearer}}
476+
// this endpoint requires Bearer token
477+
if ($this->config->getAccessToken() !== null) {
478+
$headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
479+
}
480+
{{/isBearer}}
475481
{{#isOAuth}}
476482
// this endpoint requires OAuth (access token)
477483
if ($this->config->getAccessToken() !== null) {

0 commit comments

Comments
 (0)