|
6 | 6 | use Illuminate\Http\Request; |
7 | 7 | use Illuminate\Http\Testing\File; |
8 | 8 | use Illuminate\Support\Arr; |
| 9 | +use Illuminate\Support\Facades\ParallelTesting; |
9 | 10 | use Illuminate\Support\Facades\URL; |
10 | 11 | use Illuminate\Support\Str; |
11 | 12 | use ReflectionClass; |
| 13 | +use RonasIT\AutoDoc\Contracts\SwaggerDriverContract; |
12 | 14 | use RonasIT\AutoDoc\Exceptions\DocFileNotExistsException; |
13 | 15 | use RonasIT\AutoDoc\Exceptions\EmptyContactEmailException; |
14 | 16 | use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; |
|
18 | 20 | use RonasIT\AutoDoc\Exceptions\SwaggerDriverClassNotFoundException; |
19 | 21 | use RonasIT\AutoDoc\Exceptions\UnsupportedDocumentationViewerException; |
20 | 22 | use RonasIT\AutoDoc\Exceptions\WrongSecurityConfigException; |
21 | | -use RonasIT\AutoDoc\Contracts\SwaggerDriverContract; |
22 | 23 | use RonasIT\AutoDoc\Traits\GetDependenciesTrait; |
23 | 24 | use RonasIT\AutoDoc\Validators\SwaggerSpecValidator; |
24 | 25 | use Symfony\Component\HttpFoundation\Response; |
@@ -75,12 +76,12 @@ public function __construct(Container $container) |
75 | 76 |
|
76 | 77 | $this->security = $this->config['security']; |
77 | 78 |
|
78 | | - $this->data = $this->driver->getTmpData(); |
| 79 | + $this->data = $this->driver->getProcessTmpData(); |
79 | 80 |
|
80 | 81 | if (empty($this->data)) { |
81 | 82 | $this->data = $this->generateEmptyData(); |
82 | 83 |
|
83 | | - $this->driver->saveTmpData($this->data); |
| 84 | + $this->driver->saveProcessTmpData($this->data); |
84 | 85 | } |
85 | 86 | } |
86 | 87 | } |
@@ -188,7 +189,7 @@ public function addData(Request $request, $response) |
188 | 189 | $this->parseRequest(); |
189 | 190 | $this->parseResponse($response); |
190 | 191 |
|
191 | | - $this->driver->saveTmpData($this->data); |
| 192 | + $this->driver->saveProcessTmpData($this->data); |
192 | 193 | } |
193 | 194 |
|
194 | 195 | protected function prepareItem() |
@@ -799,6 +800,18 @@ protected function saveTempData() |
799 | 800 |
|
800 | 801 | public function saveProductionData() |
801 | 802 | { |
| 803 | + if (ParallelTesting::token()) { |
| 804 | + $this->driver->appendProcessDataToTmpFile(function (array $sharedTmpData) { |
| 805 | + $resultDocContent = (empty($sharedTmpData)) |
| 806 | + ? $this->generateEmptyData() |
| 807 | + : $sharedTmpData; |
| 808 | + |
| 809 | + $this->mergeOpenAPIDocs($resultDocContent, $this->data); |
| 810 | + |
| 811 | + return $resultDocContent; |
| 812 | + }); |
| 813 | + } |
| 814 | + |
802 | 815 | $this->driver->saveData(); |
803 | 816 | } |
804 | 817 |
|
@@ -875,6 +888,8 @@ protected function getClassAnnotations($class): array |
875 | 888 |
|
876 | 889 | $annotations = $reflection->getDocComment(); |
877 | 890 |
|
| 891 | + $annotations = Str::of($annotations)->remove("\r"); |
| 892 | + |
878 | 893 | $blocks = explode("\n", $annotations); |
879 | 894 |
|
880 | 895 | $result = []; |
|
0 commit comments