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