Skip to content

Commit 2aba9d1

Browse files
author
Jamie Hannaford
committed
fix swift param type
1 parent e3e48e9 commit 2aba9d1

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

doc/api-docs/template/sub_param_macros.twig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,8 @@
2626
{{ _self.iterate_sub_params(sub_param.properties, 'false', full_name) }}
2727
{% endif %}
2828
{% elseif sub_param.type == 'array' %}
29-
{% if sub_param.itemSchema is null %}
30-
{% set type = 'array' %}
31-
{% else %}
32-
{% set subType = sub_param.itemSchema.type %}
33-
{% set type = 'array of ' ~ subType ~ 's' %}
34-
{% endif %}
29+
{% set subType = sub_param.itemSchema.type %}
30+
{% set type = 'array of ' ~ subType ~ 's' %}
3531
{% elseif parent_is_array == 'true' %}
3632
{% set render = 'false' %}
3733
{% endif %}

src/Common/Api/Parameter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private function stockItemSchema(array $data)
155155
private function stockProperties(array $data)
156156
{
157157
if (isset($data['properties'])) {
158-
if (strpos(strtolower($this->name), 'metadata') !== false) {
158+
if (stripos($this->name, 'metadata') !== false) {
159159
$this->properties = new Parameter($data['properties']);
160160
} else {
161161
foreach ($data['properties'] as $name => $property) {
@@ -251,7 +251,7 @@ private function validateObject($userValues)
251251
*/
252252
private function getNestedProperty($key)
253253
{
254-
if ($this->name == 'metadata' && $this->properties instanceof Parameter) {
254+
if (stripos($this->name, 'metadata') !== false && $this->properties instanceof Parameter) {
255255
return $this->properties;
256256
} elseif (isset($this->properties[$key])) {
257257
return $this->properties[$key];

src/Common/Transport/RequestSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private function stockHeader(Parameter $schema, $paramValue, array &$options)
5757
{
5858
$paramName = $schema->getName();
5959

60-
if (strpos(strtolower($paramName), 'metadata') !== false) {
60+
if (stripos($paramName, 'metadata') !== false) {
6161
return $this->stockMetadataHeader($schema, $paramValue, $options);
6262
}
6363

src/ObjectStore/v1/Params.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ public function metadata($type, $remove = false)
162162

163163
return [
164164
'location' => self::HEADER,
165-
'type' => self::ARRAY_TYPE,
165+
'type' => self::OBJECT_TYPE,
166166
'prefix' => sprintf("X-%s-Meta-", ucfirst($type)),
167+
'properties' => [
168+
'type' => self::STRING_TYPE,
169+
],
167170
'description' => <<<EOT
168171
Human-readable key/value pairs that help describe and determine what type of resource it is. You can specify whichever
169172
key you like, but the values need to be in scalar form (since they will be translated to strings).

0 commit comments

Comments
 (0)