Merge pull request #25 from ackintosh/fix-collection-format-in-header-parameter

Fix collection format in header parameter
This commit is contained in:
William Cheng 2018-04-09 00:05:01 +08:00 committed by GitHub
commit b34f328e12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -3941,7 +3941,10 @@ public class DefaultCodegen implements CodegenConfig {
} }
protected String getCollectionFormat(Parameter parameter) { protected String getCollectionFormat(Parameter parameter) {
if (Parameter.StyleEnum.FORM.equals(parameter.getStyle())) { if (
Parameter.StyleEnum.FORM.equals(parameter.getStyle())
|| Parameter.StyleEnum.SIMPLE.equals(parameter.getStyle())
) {
if (parameter.getExplode() != null && parameter.getExplode()) { if (parameter.getExplode() != null && parameter.getExplode()) {
return "csv"; return "csv";
} else { } else {

View File

@ -580,6 +580,7 @@ paths:
parameters: parameters:
- name: enum_header_string_array - name: enum_header_string_array
in: header in: header
explode: true
description: Header parameter enum test (string array) description: Header parameter enum test (string array)
schema: schema:
type: array type: array

View File

@ -1933,6 +1933,9 @@ class FakeApi
$queryParams['enum_query_double'] = ObjectSerializer::toQueryValue($enum_query_double); $queryParams['enum_query_double'] = ObjectSerializer::toQueryValue($enum_query_double);
} }
// header params // header params
if (is_array($enum_header_string_array)) {
$enum_header_string_array = ObjectSerializer::serializeCollection($enum_header_string_array, 'csv');
}
if ($enum_header_string_array !== null) { if ($enum_header_string_array !== null) {
$headerParams['enum_header_string_array'] = ObjectSerializer::toHeaderValue($enum_header_string_array); $headerParams['enum_header_string_array'] = ObjectSerializer::toHeaderValue($enum_header_string_array);
} }