|
16 | 16 | use cebe\openapi\ReferenceContext; |
17 | 17 | use cebe\openapi\spec\Reference; |
18 | 18 | use cebe\openapi\spec\Schema; |
| 19 | +use cebe\openapi\SpecBaseObject; |
19 | 20 | use cebe\openapi\SpecObjectInterface; |
20 | 21 | use cebe\yii2openapi\lib\exceptions\InvalidDefinitionException; |
21 | 22 | use cebe\yii2openapi\lib\items\Attribute; |
@@ -329,7 +330,9 @@ public function fakeForObject(SpecObjectInterface $items): string |
329 | 330 | if (!empty($prop->properties)) { // nested object |
330 | 331 | $result = $this->{__FUNCTION__}($prop); |
331 | 332 | } else { |
332 | | - $result = $this->aElementFaker(['items' => $prop->getSerializableData()], $name); |
| 333 | +// ($prop instanceof SpecBaseObject) && var_dump($prop->rawSpec); |
| 334 | +// $result = $this->aElementFaker(['items' => $prop->getSerializableData()], $name); |
| 335 | + $result = $this->aElementFaker(['items' => $prop->rawSpec], $name); |
333 | 336 | } |
334 | 337 | $props .= '\'' . $name . '\' => ' . $result . ',' . PHP_EOL; |
335 | 338 | } |
@@ -358,7 +361,7 @@ public function handleOneOf(SpecObjectInterface $items, int $count): string |
358 | 361 | foreach ($items->oneOf as $key => $aDataType) { |
359 | 362 | /** @var Schema|Reference $aDataType */ |
360 | 363 |
|
361 | | - $inp = $aDataType instanceof Reference ? $aDataType : ['items' => $aDataType->getSerializableData()]; |
| 364 | + $inp = $aDataType instanceof Reference ? $aDataType : ['items' => $aDataType->rawSpec]; |
362 | 365 | $aFaker = $this->aElementFaker($inp, $this->attribute->columnName); |
363 | 366 | $result .= '$dataType' . $key . ' = ' . $aFaker . ';'; |
364 | 367 | } |
@@ -403,7 +406,7 @@ public function aElementFaker($data, ?string $columnName = null): ?string |
403 | 406 | return '(new ' . $class . ')->generateModel()->attributes'; |
404 | 407 | } |
405 | 408 |
|
406 | | - $inp = $data instanceof SpecObjectInterface ? $data->getSerializableData() : $data; |
| 409 | + $inp = $data instanceof SpecObjectInterface ? $data->rawSpec : $data; |
407 | 410 | $aElementData = Json::decode(Json::encode($inp)); |
408 | 411 | $columnName = $columnName ?? 'unnamedProp'; |
409 | 412 | $compoSchemaData = [ |
|
0 commit comments