Skip to content

Commit f524ed6

Browse files
committed
ORD-1915 Improved Swagger documentation.
1 parent dba34b8 commit f524ed6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/ApiFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ private function getField(array $fieldData)
407407
$field->setFieldType($fieldData['field_type']);
408408
}
409409

410+
if (isset($fieldData['example'])) {
411+
$field->setExample($fieldData['example']);
412+
}
413+
410414
$required = isset($fieldData['required']) ? (bool) $fieldData['required'] : false;
411415
$field->setRequired($required);
412416

src/Field.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ class Field implements IteratorAggregate
3636
*/
3737
protected $fieldType = '';
3838

39+
/**
40+
* @var string
41+
*/
42+
protected $example;
43+
3944
/**
4045
* @param string $name
4146
*/
@@ -116,6 +121,18 @@ public function setFieldType($fieldType)
116121
$this->fieldType = $fieldType;
117122
}
118123

124+
public function getExample()
125+
{
126+
return $this->example;
127+
}
128+
129+
public function setExample($example)
130+
{
131+
$this->example = $example;
132+
133+
return $this;
134+
}
135+
119136
/**
120137
* Cast object to array
121138
*
@@ -127,6 +144,7 @@ public function toArray()
127144
'description' => $this->description,
128145
'required' => $this->required,
129146
'type' => $this->fieldType,
147+
'example' => $this->example,
130148
];
131149
}
132150

0 commit comments

Comments
 (0)