From dee3246bc57b95049440cbc00daa4017fec1cd18 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 2 Jul 2025 15:35:50 +0300 Subject: [PATCH 01/62] refactor: display throwable errors too --- resources/views/error.blade.php | 2 +- src/Services/SwaggerService.php | 6 +- tests/SwaggerServiceTest.php | 6 +- ...rrect_documentation_structure_request.json | 400 ++++++++++++++++++ ...rrect_documentation_structure_request.html | 1 + 5 files changed, 410 insertions(+), 5 deletions(-) create mode 100644 tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json create mode 100644 tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html diff --git a/resources/views/error.blade.php b/resources/views/error.blade.php index 0b9291cb..e352a8c9 100644 --- a/resources/views/error.blade.php +++ b/resources/views/error.blade.php @@ -1 +1 @@ -{{ $message }} \ No newline at end of file +### **{{ $message }}** \ No newline at end of file diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index b81eeff3..19b3e476 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -23,7 +23,7 @@ use RonasIT\AutoDoc\Traits\GetDependenciesTrait; use RonasIT\AutoDoc\Validators\SwaggerSpecValidator; use Symfony\Component\HttpFoundation\Response; -use Exception; +use Throwable; /** * @property SwaggerDriverContract $driver @@ -831,7 +831,7 @@ public function getDocFileContent() $documentation = $this->driver->getDocumentation(); $this->openAPIValidator->validate($documentation); - } catch (Exception $exception) { + } catch (Throwable $exception) { return $this->generateEmptyData($this->config['defaults']['error'], ['message' => $exception->getMessage()]); } @@ -973,7 +973,7 @@ protected function prepareInfo(?string $view = null, array $viewData = [], array if (!empty($view)) { $info['description'] = view($view, $viewData)->render(); } - + return array_merge($this->config['info'], $info); } diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index bd6bc03d..6e7205d6 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -222,6 +222,10 @@ public static function getConstructorInvalidTmpData(): array 'tmpDoc' => 'documentation/invalid_format__response__invalid_items', 'fixture' => 'invalid_format_response_invalid_items.html', ], + [ + 'tmpDoc' => 'documentation/tmp_data_incorrect_documentation_structure_request', + 'fixture' => 'invalid_format_incorrect_documentation_structure_request.html', + ], ]; } @@ -234,7 +238,7 @@ public function testGetDocFileContentInvalidTmpData( $content = app(SwaggerService::class)->getDocFileContent(); - $this->assertEqualsFixture($fixture, $content['info']['description']); + $this->assertStringContainsString($this->getFixture($fixture), $content['info']['description']); } public function testEmptyContactEmail() diff --git a/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json b/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json new file mode 100644 index 00000000..df9611dd --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json @@ -0,0 +1,400 @@ +{ + "openapi": "3.1.0", + "servers": [ + { + "url": "https:\/\/localhost" + } + ], + "paths": { + "\/v{version}\/media": { + "post": { + "tags": [ + "v{version}" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [ + { + "in": "path", + "name": "version", + "description": "in: 0.1,0.2", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "201": { + "description": "Created", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/postV{version}media201ResponseObject" + }, + "example": { + "id": 20, + "link": "https:\/\/localhost\/v0.2\/media\/20\/content", + "created_at": "2018-11-11T11:11:11.000000Z", + "preview": { + "id": 19, + "link": "https:\/\/localhost\/v0.2\/media\/19\/content", + "created_at": "2018-11-11T11:11:11.000000Z", + "blur_hash": null + }, + "blur_hash": "L00000fQfQfQfQfQfQfQfQfQfQfQ" + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/postV{version}media401ResponseObject" + }, + "example": { + "message": "Unauthenticated." + } + } + } + } + }, + "security": [], + "description": "", + "deprecated": false, + "requestBody": { + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/v{version}mediaObject" + } + } + }, + "description": "", + "required": true + }, + "summary": "create media" + } + }, + "\/v{version}\/media\/{id}\/content": { + "get": { + "tags": [ + "v{version}" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "image\/jpeg", + "application\/json" + ], + "parameters": [ + { + "in": "path", + "name": "version", + "description": "in: 0.1,0.2", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "id", + "description": "regexp: [0-9]+", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "image\/jpeg": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/getV{version}media{id}content200ResponseObject" + }, + "example": "[]" + } + } + }, + "429": { + "description": "Too Many Requests", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/getV{version}media{id}content429ResponseObject" + }, + "example": { + "message": "Too Many Attempts." + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/getV{version}media{id}content403ResponseObject" + }, + "example": { + "message": "This action is unauthorized." + } + } + } + }, + "404": { + "description": "This entity not found", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/getV{version}media{id}content404ResponseObject" + }, + "example": { + "message": "Media does not exist" + } + } + } + } + }, + "security": [], + "description": "", + "deprecated": false, + "summary": "get content" + } + }, + "\/media\/{id}": { + "delete": { + "tags": [ + "media" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [ + { + "in": "path", + "name": "id", + "description": "", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "404": { + "description": "This entity not found", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/deleteMedia{id}404ResponseObject" + }, + "example": { + "message": "Not found." + } + } + } + } + }, + "security": [], + "description": "", + "deprecated": false, + "summary": "delete media" + } + }, + "\/media\/bulk": { + "post": { + "tags": [ + "media" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "responses": { + "404": { + "description": "This entity not found", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/postMediabulk404ResponseObject" + }, + "example": { + "message": "Not found." + } + } + } + } + }, + "security": [], + "description": "", + "deprecated": false, + "requestBody": { + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/mediabulkObject" + } + } + }, + "description": "", + "required": true + }, + "summary": "bulk create media" + } + }, + "\/media": { + "get": { + "tags": [ + "media" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [ + { + "in": "query", + "name": "page", + "description": "integer", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "per_page", + "description": "integer", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "all", + "description": "integer", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "query", + "description": "string", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "order_by", + "description": "string, in:link,name", + "schema": { + "type": "string" + } + }, + { + "in": "query", + "name": "desc", + "description": "boolean", + "schema": { + "type": "boolean" + } + }, + { + "in": "query", + "name": "name", + "description": "string", + "schema": { + "type": "string" + } + } + ], + "responses": { + "404": { + "description": "This entity not found", + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/getMedia404ResponseObject" + }, + "example": { + "message": "Not found." + } + } + } + } + }, + "security": [], + "description": "", + "deprecated": false, + "summary": "search media" + }, + "post": { + "tags": [ + "media" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "content": { + "application\/json": { + "schema": { + "type": "object", + "$ref": "#\/components\/schemas\/postMedia404ResponseObject" + }, + "example": { + "message": "Not found." + } + } + } + } + }, + "security": [], + "description": "", + "deprecated": false, + "requestBody": { + "content": { + "application\/json": { + "schema": { + "$ref": "#\/components\/schemas\/mediaObject" + } + } + }, + "description": "", + "required": true + }, + "summary": "create media" + } +}}, "components": {"schemas": {"v{version}mediaObject": {"type": "object", "properties": {"file": {"type": "string", "description": "file, max:5120, mimes:jpg,jpeg,bmp,png,heic"}, "meta": {"type": "object", "description": ""}, "is_public": {"type": "boolean", "description":""}, "type": {"type": "string","description": "in:avatar,cover"}}, "required":["file"], "example": {"file": "[uploaded_file]"}},"postV{version}media201ResponseObject": {"type": "object", "properties": {"id": {"type": "integer"}, "link":{"type": "string"}, "created_at": {"type": "string"}, "preview": {"type": "array", "nullable": true}, "blur_hash": {"type": "string"}}}, "postV{version}media401ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "getV{version}media{id}content200ResponseObject": {"type": "object", "properties":[]}, "getV{version}media{id}content429ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "getV{version}media{id}content403ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "getV{version}media{id}content404ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "deleteMedia{id}404ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "mediabulkObject": {"type": "object", "properties": {"media": {"type": "object", "description": ""}, "media.*": {"type": "object", "description": ""}, "media.*.file": {"type": "string", "description": "file, max:5120, mimes:jpg,jpeg,bmp,png,heic"}, "media.*.meta":{"type": "object", "description": ""},"media.*.is_public": {"type": "boolean", "description": ""}}, "required":["media", "media.*.file"], "example": {"media":[{"meta":["test1"], "file": "[uploaded_file]"}, {"meta":["test2"], "file": "[uploaded_file]"}]}}, "postMediabulk404ResponseObject": {"type": "object","properties": {"message": {"type": "string"}}}, "getMedia404ResponseObject": {"type": "object","properties": {"message": {"type": "string"}}}, "mediaObject": {"type": "object","properties": {"file": {"type": "string","description": "file, max:5120, mimes:jpg,jpeg,bmp,png,heic"}, "meta": {"type":"object", "description": ""}, "is_public": {"type": "boolean", "description": ""}, "type": {"type": "string", "description": "in:avatar,cover"}}, "required":["file"], "example": {"file": "[uploaded_file]"}},"postMedia404ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}}}, "info": {"description": "This is automatically collected documentation", "version": "0.0.0", "title": "Laravel", "termsOfService": "", "contact": {"email": "azabolotnikov@ronasit.com"}}} \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html new file mode 100644 index 00000000..aa91da31 --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -0,0 +1 @@ +Return value must be of type array, null returned \ No newline at end of file From 1c7dfcfeccd0f0ca28ccddb79223b6eaaad22061 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Thu, 3 Jul 2025 17:00:57 +0300 Subject: [PATCH 02/62] refactor: set empty array for not exception errors --- resources/views/error.blade.php | 12 +++++++++++- src/Services/SwaggerService.php | 9 +++++++-- tests/SwaggerServiceTest.php | 2 +- tests/TestCase.php | 2 +- .../invalid_format_array_parameter_no_items.html | 12 +++++++++++- .../invalid_format_array_response_body_no_items.html | 12 +++++++++++- ...nvalid_format_array_response_header_no_items.html | 12 +++++++++++- .../invalid_format_body_and_form_params.html | 12 +++++++++++- .../invalid_format_duplicate_header_params.html | 12 +++++++++++- .../invalid_format_duplicate_operation_id.html | 12 +++++++++++- .../invalid_format_duplicate_path_params.html | 12 +++++++++++- .../invalid_format_duplicate_path_placeholders.html | 12 +++++++++++- .../invalid_format_duplicate_tag.html | 12 +++++++++++- .../invalid_format_file_invalid_consumes.html | 12 +++++++++++- .../invalid_format_file_no_consumes.html | 12 +++++++++++- ...at_incorrect_documentation_structure_request.html | 12 +++++++++++- .../invalid_format_invalid_schema_type.html | 12 +++++++++++- .../invalid_format_invalid_value_parameter_in.html | 12 +++++++++++- .../invalid_format_invalid_value_path.html | 12 +++++++++++- .../invalid_format_invalid_value_status_code.html | 12 +++++++++++- .../invalid_format_missing_external_ref.html | 12 +++++++++++- ...invalid_format_missing_field_definition_type.html | 12 +++++++++++- .../invalid_format_missing_field_header_type.html | 12 +++++++++++- .../invalid_format_missing_field_info_version.html | 12 +++++++++++- .../invalid_format_missing_field_items_type.html | 12 +++++++++++- ...lid_format_missing_field_operation_responses.html | 12 +++++++++++- .../invalid_format_missing_field_parameter_in.html | 12 +++++++++++- .../invalid_format_missing_field_paths.html | 12 +++++++++++- ...id_format_missing_field_response_description.html | 12 +++++++++++- .../invalid_format_missing_field_tag_name.html | 12 +++++++++++- .../invalid_format_missing_local_ref.html | 12 +++++++++++- .../invalid_format_missing_path_parameter.html | 12 +++++++++++- .../invalid_format_missing_ref_file.html | 12 +++++++++++- .../invalid_format_multiple_body_params.html | 12 +++++++++++- .../invalid_format_no_path_params.html | 12 +++++++++++- .../invalid_format_path_param_no_placeholder.html | 12 +++++++++++- .../invalid_format_request_body_invalid_content.html | 12 +++++++++++- .../invalid_format_response_invalid_items.html | 12 +++++++++++- .../invalid_format_security_definition_flow.html | 12 +++++++++++- .../invalid_format_security_definition_in.html | 12 +++++++++++- .../invalid_format_security_definition_type.html | 12 +++++++++++- .../fixtures/SwaggerServiceTest/invalid_version.html | 12 +++++++++++- 42 files changed, 438 insertions(+), 43 deletions(-) diff --git a/resources/views/error.blade.php b/resources/views/error.blade.php index e352a8c9..9e1b884a 100644 --- a/resources/views/error.blade.php +++ b/resources/views/error.blade.php @@ -1 +1,11 @@ -### **{{ $message }}** \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 {{$type}} 🚨🚨 + +--- + +### **Details:** + +{{$message}} + +--- \ No newline at end of file diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 83da0fa0..5a718701 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -24,7 +24,7 @@ use RonasIT\AutoDoc\Validators\SwaggerSpecValidator; use Symfony\Component\HttpFoundation\Response; use Throwable; - +use Exception; /** * @property SwaggerDriverContract $driver */ @@ -832,7 +832,12 @@ public function getDocFileContent() $this->openAPIValidator->validate($documentation); } catch (Throwable $exception) { - return $this->generateEmptyData($this->config['defaults']['error'], ['message' => $exception->getMessage()]); + $message = $exception instanceof Exception ? $exception->getMessage() : '[]'; + + return $this->generateEmptyData($this->config['defaults']['error'], [ + 'message' => $message, + 'type' => $exception::class, + ]); } $additionalDocs = config('auto-doc.additional_paths', []); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 6e7205d6..5dfeab85 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -238,7 +238,7 @@ public function testGetDocFileContentInvalidTmpData( $content = app(SwaggerService::class)->getDocFileContent(); - $this->assertStringContainsString($this->getFixture($fixture), $content['info']['description']); + $this->assertEqualsFixture($fixture, $content['info']['description']); } public function testEmptyContactEmail() diff --git a/tests/TestCase.php b/tests/TestCase.php index 13242929..4c528394 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -87,7 +87,7 @@ public function assertEqualsJsonFixture(string $fixtureName, $data, bool $export public function assertEqualsFixture(string $fixtureName, $data, bool $exportMode = false): void { if ($exportMode || $this->globalExportMode) { - $this->exportContent($fixtureName, $data); + $this->exportContent($data, $fixtureName); } $this->assertEquals($this->getFixture($fixtureName), $data); diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index 5ee5a195..b3b59d1d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -1 +1,11 @@ -Validation failed. paths./users.post.parameters.0 is an array, so it must include an 'items' field. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. paths./users.post.parameters.0 is an array, so it must include an 'items' field. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index daf4fee1..f6990d54 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -1 +1,11 @@ -Validation failed. paths./users.get.responses.200.schema is an array, so it must include an 'items' field. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. paths./users.get.responses.200.schema is an array, so it must include an 'items' field. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index caf830c0..3a8acca3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -1 +1,11 @@ -Validation failed. paths./users.get.responses.default.headers.Last-Modified is an array, so it must include an 'items' field. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. paths./users.get.responses.default.headers.Last-Modified is an array, so it must include an 'items' field. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index 389e03a0..903c06d5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}.post' has body and formData parameters. Only one or the other is allowed. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}.post' has body and formData parameters. Only one or the other is allowed. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index 0a770041..750b70b8 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}.get' has multiple in:header parameters with name:foo. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\DuplicateParamException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}.get' has multiple in:header parameters with name:foo. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index 25dbb9bc..f3e281d5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -1 +1,11 @@ -Validation failed. Found multiple fields 'paths.*.*.operationId' with values: addPet. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\DuplicateFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Found multiple fields 'paths.*.*.operationId' with values: addPet. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index a03ed69e..1bae9f4c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}.get' has multiple in:path parameters with name:username. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\DuplicateParamException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}.get' has multiple in:path parameters with name:username. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index 5e443501..98bdd8f2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -1 +1,11 @@ -Validation failed. Path '/users/{username}/profile/{username}/image/{img_id}' has multiple path placeholders with name: username. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\DuplicatePathPlaceholderException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Path '/users/{username}/profile/{username}/image/{img_id}' has multiple path placeholders with name: username. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index 99344580..000b18e2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -1 +1,11 @@ -Validation failed. Found multiple fields 'tags.*.name' with values: user. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\DuplicateFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Found multiple fields 'tags.*.name' with values: user. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index 22b966e5..a2bb572b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}/profile/image.post' has body and formData parameters. Only one or the other is allowed. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}/profile/image.post' has body and formData parameters. Only one or the other is allowed. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index 22b966e5..a2bb572b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}/profile/image.post' has body and formData parameters. Only one or the other is allowed. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}/profile/image.post' has body and formData parameters. Only one or the other is allowed. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index aa91da31..e2690929 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -1 +1,11 @@ -Return value must be of type array, null returned \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 TypeError 🚨🚨 + +--- + +### **Details:** + +[] + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index a6c49ec3..9bd8cf18 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -1 +1,11 @@ -Validation failed. Field 'paths./users.get.responses.200.schema.type' has an invalid value: something. Allowed values: array, boolean, integer, number, string, object, null, undefined, file. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidFieldValueException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Field 'paths./users.get.responses.200.schema.type' has an invalid value: something. Allowed values: array, boolean, integer, number, string, object, null, undefined, file. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index 68a11aac..420049e2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -1 +1,11 @@ -Validation failed. Field 'paths./auth/login.post.parameters.0.in' has an invalid value: invalid_in. Allowed values: body, formData, query, path, header. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidFieldValueException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Field 'paths./auth/login.post.parameters.0.in' has an invalid value: invalid_in. Allowed values: body, formData, query, path, header. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index 96de275c..5652180b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -1 +1,11 @@ -Validation failed. Incorrect 'paths.users'. Paths should only have path names that starts with `/`. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidPathException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Incorrect 'paths.users'. Paths should only have path names that starts with `/`. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index 07d68cac..e00f8f6d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -1 +1,11 @@ -Validation failed. Operation at 'paths./users.get.responses.8888' should only have three-digit status codes, `default`, and vendor extensions (`x-*`) as properties. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidStatusCodeException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation at 'paths./users.get.responses.8888' should only have three-digit status codes, `default`, and vendor extensions (`x-*`) as properties. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html index 2eace1cf..03ed7df9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html @@ -1 +1,11 @@ -Validation failed. Ref 'authloginObject' is used in $ref but not defined in 'tests/fixtures/SwaggerServiceTest/documentation/with_definitions.json' file. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingExternalRefException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Ref 'authloginObject' is used in $ref but not defined in 'tests/fixtures/SwaggerServiceTest/documentation/with_definitions.json' file. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index e2bd233c..1bd47469 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -1 +1,11 @@ -Validation failed. 'components.schemas.authloginObject' should have required fields: type. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'components.schemas.authloginObject' should have required fields: type. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index 28a5c4ff..f81aacb3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -1 +1,11 @@ -Validation failed. 'paths./user/login.get.responses.200.headers.X-Rate-Limit' should have required fields: type. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'paths./user/login.get.responses.200.headers.X-Rate-Limit' should have required fields: type. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index dc3dac19..f17fbeb5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -1 +1,11 @@ -Validation failed. 'info' should have required fields: version. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'info' should have required fields: version. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index 0e470070..67ab26af 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -1 +1,11 @@ -Validation failed. 'paths./pet/findByStatus.get.parameters.0.schema.items' should have required fields: type. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'paths./pet/findByStatus.get.parameters.0.schema.items' should have required fields: type. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index 5ebd060b..eca8a087 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -1 +1,11 @@ -Validation failed. 'paths./auth/login.post' should have required fields: responses. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'paths./auth/login.post' should have required fields: responses. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 996315fa..3c5488be 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -1 +1,11 @@ -Validation failed. 'paths./auth/login.post.parameters.0' should have required fields: in. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'paths./auth/login.post.parameters.0' should have required fields: in. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index c68f537e..640f4c70 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -1 +1,11 @@ -Validation failed. '' should have required fields: paths. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. '' should have required fields: paths. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index c272c3d5..7bbd9bb1 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -1 +1,11 @@ -Validation failed. 'paths./auth/login.post.responses.200' should have required fields: description. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'paths./auth/login.post.responses.200' should have required fields: description. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index 54dece06..8cecf072 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -1 +1,11 @@ -Validation failed. 'tags.0' should have required fields: name. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'tags.0' should have required fields: name. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html index 13d8fc9a..e990dbf6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html @@ -1 +1,11 @@ -Validation failed. Ref 'loginObject' is used in $ref but not defined in 'definitions' field. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingLocalRefException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Ref 'loginObject' is used in $ref but not defined in 'definitions' field. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index 46a71416..e8b8f597 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -1 +1,11 @@ -Validation failed. Path parameters cannot be optional. Set required=true for the 'username' parameters at operation 'paths./users.get'. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Path parameters cannot be optional. Set required=true for the 'username' parameters at operation 'paths./users.get'. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html index a7794cf8..dde77bcf 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html @@ -1 +1,11 @@ -Validation failed. Filename 'invalid-filename.json' is used in $ref but file doesn't exist. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingRefFileException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Filename 'invalid-filename.json' is used in $ref but file doesn't exist. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index 3eaab7d4..8d22c659 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}.get' has 2 body parameters. Only one is allowed. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}.get' has 2 body parameters. Only one is allowed. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index 543b42ff..0bb9a5b2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}/{foo}.get' has no params for placeholders: username, foo. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingPathParamException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}/{foo}.get' has no params for placeholders: username, foo. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index 1e350309..69a05e87 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{username}.post' has no placeholders for params: foo. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingPathPlaceholderException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{username}.post' has no placeholders for params: foo. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index 0884fddc..fa9ecd17 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -1 +1,11 @@ -Validation failed. Operation 'paths./users/{id}.post' has invalid content types: image/png. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerSpecException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Operation 'paths./users/{id}.post' has invalid content types: image/png. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index 8e42aa1f..203ba2d1 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -1 +1,11 @@ -Validation failed. 'paths./users/{id}.post.responses.200.schema.items' should have required fields: type. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingFieldException 🚨🚨 + +--- + +### **Details:** + +Validation failed. 'paths./users/{id}.post.responses.200.schema.items' should have required fields: type. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index 3e0fc9b6..4e895c16 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -1 +1,11 @@ -Validation failed. Field 'securityDefinitions.0.flow' has an invalid value: invalid. Allowed values: implicit, password, application, accessCode. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidFieldValueException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Field 'securityDefinitions.0.flow' has an invalid value: invalid. Allowed values: implicit, password, application, accessCode. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index 241f6946..3b9674ab 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -1 +1,11 @@ -Validation failed. Field 'securityDefinitions.0.in' has an invalid value: invalid. Allowed values: query, header. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidFieldValueException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Field 'securityDefinitions.0.in' has an invalid value: invalid. Allowed values: query, header. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index 33a2c0a9..698cbf07 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -1 +1,11 @@ -Validation failed. Field 'securityDefinitions.0.type' has an invalid value: invalid. Allowed values: basic, apiKey, oauth2. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidFieldValueException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Field 'securityDefinitions.0.type' has an invalid value: invalid. Allowed values: basic, apiKey, oauth2. + +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index 581fef92..a205d576 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -1 +1,11 @@ -Validation failed. Unrecognized Swagger version '1.0'. Expected 3.1.0. \ No newline at end of file +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\InvalidSwaggerVersionException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Unrecognized Swagger version '1.0'. Expected 3.1.0. + +--- \ No newline at end of file From fe96b4b80b1c770e713f9767e1d912e263967fe8 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 9 Jul 2025 17:04:12 +0300 Subject: [PATCH 03/62] refactor: add empty email exception message to view --- src/Services/SwaggerService.php | 7 ++++++- tests/SwaggerServiceTest.php | 4 +++- .../SwaggerServiceTest/invalid_config_email.html | 11 +++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/SwaggerServiceTest/invalid_config_email.html diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 5a718701..76793862 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -137,7 +137,12 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], // client must enter at least `contact.email` to generate a default `info` block // otherwise an exception will be called if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { - throw new EmptyContactEmailException(); + $exception = new EmptyContactEmailException(); + + $viewData = [ + 'message' => $exception->getMessage(), + 'type' => $exception::class, + ]; } if (empty($view) && !empty($this->config['info'])) { diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 5dfeab85..5c476ef1 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -245,7 +245,9 @@ public function testEmptyContactEmail() { config(['auto-doc.info.contact.email' => null]); - $this->expectException(EmptyContactEmailException::class); + $content = app(SwaggerService::class)->getDocFileContent(); + + $this->assertEqualsFixture('invalid_config_email.html', $content['info']['description'], true); app(SwaggerService::class); } diff --git a/tests/fixtures/SwaggerServiceTest/invalid_config_email.html b/tests/fixtures/SwaggerServiceTest/invalid_config_email.html new file mode 100644 index 00000000..8162a684 --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/invalid_config_email.html @@ -0,0 +1,11 @@ +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\EmptyContactEmailException 🚨🚨 + +--- + +### **Details:** + +Please fill the `info.contact.email` field in the app-doc.php config file. + +--- \ No newline at end of file From 241a8f70222df9f03ad4c8cb926b67adc0294780 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 9 Jul 2025 18:03:18 +0300 Subject: [PATCH 04/62] fix: remove useless --- tests/SwaggerServiceTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 5c476ef1..2bf57f74 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -4,7 +4,6 @@ use Illuminate\Http\Testing\File; use PHPUnit\Framework\Attributes\DataProvider; -use RonasIT\AutoDoc\Exceptions\EmptyContactEmailException; use RonasIT\AutoDoc\Exceptions\InvalidDriverClassException; use RonasIT\AutoDoc\Exceptions\LegacyConfigException; use RonasIT\AutoDoc\Exceptions\SwaggerDriverClassNotFoundException; From 6624b40e02497e666918610d5910725ea574288a Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 1 Sep 2025 13:45:29 +0300 Subject: [PATCH 05/62] refactor: add defaul unhandled error message --- config/auto-doc.php | 2 ++ src/Services/SwaggerService.php | 4 +++- tests/SwaggerServiceTest.php | 2 -- ...alid_format_incorrect_documentation_structure_request.html | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/auto-doc.php b/config/auto-doc.php index 4245ad74..dfebfc75 100644 --- a/config/auto-doc.php +++ b/config/auto-doc.php @@ -110,6 +110,8 @@ | You can use your custom description view for errors. */ 'error' => 'auto-doc::error', + + 'unhandled_error_message' => 'Documentation file is empty or have bad format', ], /* diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 76793862..fb8772fb 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -837,7 +837,9 @@ public function getDocFileContent() $this->openAPIValidator->validate($documentation); } catch (Throwable $exception) { - $message = $exception instanceof Exception ? $exception->getMessage() : '[]'; + $message = ($exception instanceof Exception) + ? $exception->getMessage() + : config('auto-doc.defaults.unhandled_error_message'); return $this->generateEmptyData($this->config['defaults']['error'], [ 'message' => $message, diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 2bf57f74..05d119d8 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -247,8 +247,6 @@ public function testEmptyContactEmail() $content = app(SwaggerService::class)->getDocFileContent(); $this->assertEqualsFixture('invalid_config_email.html', $content['info']['description'], true); - - app(SwaggerService::class); } public static function getAddEmptyData(): array diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index e2690929..625b3c12 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -6,6 +6,6 @@ ### **Details:** -[] +Documentation file is empty or have bad format --- \ No newline at end of file From 79d523c60b563c36c656c0397d49b62f3ec37df9 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Thu, 11 Sep 2025 17:10:04 +0300 Subject: [PATCH 06/62] refactor: use try catch --- src/Services/SwaggerService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index fb8772fb..4eed6b6f 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -136,9 +136,11 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], { // client must enter at least `contact.email` to generate a default `info` block // otherwise an exception will be called - if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { - $exception = new EmptyContactEmailException(); - + try { + if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { + throw new EmptyContactEmailException(); + } + } catch (EmptyContactEmailException $exception) { $viewData = [ 'message' => $exception->getMessage(), 'type' => $exception::class, From 66d348a4d318f9929a177f15e918c31ce783d399 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Fri, 12 Sep 2025 18:05:12 +0300 Subject: [PATCH 07/62] refactor: use try catch in correct place --- src/Services/SwaggerService.php | 69 +++++++++++++++++---------------- tests/SwaggerServiceTest.php | 6 ++- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 4eed6b6f..5861df96 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -136,22 +136,28 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], { // client must enter at least `contact.email` to generate a default `info` block // otherwise an exception will be called - try { - if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { - throw new EmptyContactEmailException(); - } - } catch (EmptyContactEmailException $exception) { - $viewData = [ - 'message' => $exception->getMessage(), - 'type' => $exception::class, - ]; + if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { + throw new EmptyContactEmailException(); } if (empty($view) && !empty($this->config['info'])) { $view = $this->config['info']['description']; } - $data = [ + $data = $this->prepareEmptyData($view, $viewData, $license); + + $securityDefinitions = $this->generateSecurityDefinition(); + + if (!empty($securityDefinitions)) { + $data['securityDefinitions'] = $securityDefinitions; + } + + return $data; + } + + protected function prepareEmptyData(?string $view = null, array $viewData = [], array $license = []): array + { + return [ 'openapi' => self::OPEN_API_VERSION, 'servers' => [ ['url' => URL::query($this->config['basePath'])], @@ -162,14 +168,6 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], ], 'info' => $this->prepareInfo($view, $viewData, $license), ]; - - $securityDefinitions = $this->generateSecurityDefinition(); - - if (!empty($securityDefinitions)) { - $data['securityDefinitions'] = $securityDefinitions; - } - - return $data; } protected function generateSecurityDefinition(): ?array @@ -803,18 +801,6 @@ protected function getActionName($uri): string return Str::camel($action); } - /** - * @deprecated method is not in use - * @codeCoverageIgnore - */ - protected function saveTempData() - { - $exportFile = Arr::get($this->config, 'files.temporary'); - $data = json_encode($this->data); - - file_put_contents($exportFile, $data); - } - public function saveProductionData() { if (ParallelTesting::token()) { @@ -843,10 +829,7 @@ public function getDocFileContent() ? $exception->getMessage() : config('auto-doc.defaults.unhandled_error_message'); - return $this->generateEmptyData($this->config['defaults']['error'], [ - 'message' => $message, - 'type' => $exception::class, - ]); + return $this->generateDataWithExceptionHandling($message, $exception); } $additionalDocs = config('auto-doc.additional_paths', []); @@ -866,6 +849,24 @@ public function getDocFileContent() return $documentation; } + protected function generateDataWithExceptionHandling(string $message, Throwable $exception): array + { + try { + return $this->generateEmptyData($this->config['defaults']['error'], [ + 'message' => $message, + 'type' => $exception::class, + ]); + } catch (EmptyContactEmailException $emptyEmailException) { + return $this->prepareEmptyData( + $this->config['defaults']['error'], + [ + 'message' => $emptyEmailException->getMessage(), + 'type' => $emptyEmailException::class, + ], + ); + } + } + protected function camelCaseToUnderScore($input): string { preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 05d119d8..3b32a981 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -15,6 +15,7 @@ use RonasIT\AutoDoc\Tests\Support\Mock\TestRequest; use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceMockTrait; use stdClass; +use RonasIT\AutoDoc\Exceptions\EmptyContactEmailException; class SwaggerServiceTest extends TestCase { @@ -246,7 +247,10 @@ public function testEmptyContactEmail() $content = app(SwaggerService::class)->getDocFileContent(); - $this->assertEqualsFixture('invalid_config_email.html', $content['info']['description'], true); + $this->assertEqualsFixture('invalid_config_email.html', $content['info']['description']); + + $this->expectException(EmptyContactEmailException::class); + $this->expectExceptionMessage('Please fill the `info.contact.email` field in the app-doc.php config file.'); } public static function getAddEmptyData(): array From c48e7f2dfb25b9bce7b726224761f13440d3cdbd Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 17 Sep 2025 15:53:42 +0300 Subject: [PATCH 08/62] fix: tests --- src/Services/SwaggerService.php | 13 ++++++++--- tests/SwaggerServiceTest.php | 23 +++++++++++++++---- ...html => invalid_contact_email_format.html} | 0 3 files changed, 29 insertions(+), 7 deletions(-) rename tests/fixtures/SwaggerServiceTest/{invalid_config_email.html => invalid_contact_email_format.html} (100%) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 5861df96..38ee799e 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -136,9 +136,7 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], { // client must enter at least `contact.email` to generate a default `info` block // otherwise an exception will be called - if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { - throw new EmptyContactEmailException(); - } + $this->checkEmail(); if (empty($view) && !empty($this->config['info'])) { $view = $this->config['info']['description']; @@ -155,6 +153,13 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], return $data; } + protected function checkEmail(): void + { + if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { + throw new EmptyContactEmailException(); + } + } + protected function prepareEmptyData(?string $view = null, array $viewData = [], array $license = []): array { return [ @@ -821,6 +826,8 @@ public function saveProductionData() public function getDocFileContent() { try { + $this->checkEmail(); + $documentation = $this->driver->getDocumentation(); $this->openAPIValidator->validate($documentation); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 3b32a981..99dee1a8 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -245,12 +245,27 @@ public function testEmptyContactEmail() { config(['auto-doc.info.contact.email' => null]); - $content = app(SwaggerService::class)->getDocFileContent(); - - $this->assertEqualsFixture('invalid_config_email.html', $content['info']['description']); - $this->expectException(EmptyContactEmailException::class); $this->expectExceptionMessage('Please fill the `info.contact.email` field in the app-doc.php config file.'); + + app(SwaggerService::class)->getDocFileContent(); + } + + public function testGetJSONDocumentationEmailIsNull() + { + config( + [ + 'auto-doc.info.contact.email' => null, + 'app.env' => 'development', + ], + ); + + $content = app(SwaggerService::class)->getDocFileContent(); + + $this->assertEqualsFixture( + 'invalid_contact_email_format.html', + $content['info']['description'] + ); } public static function getAddEmptyData(): array diff --git a/tests/fixtures/SwaggerServiceTest/invalid_config_email.html b/tests/fixtures/SwaggerServiceTest/invalid_contact_email_format.html similarity index 100% rename from tests/fixtures/SwaggerServiceTest/invalid_config_email.html rename to tests/fixtures/SwaggerServiceTest/invalid_contact_email_format.html From 86a3613ebd660f4f7d5ef40a5e6c2104efc96a2b Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 17 Sep 2025 15:57:50 +0300 Subject: [PATCH 09/62] refactor: remove useless --- src/Services/SwaggerService.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 38ee799e..5861df96 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -136,7 +136,9 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], { // client must enter at least `contact.email` to generate a default `info` block // otherwise an exception will be called - $this->checkEmail(); + if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { + throw new EmptyContactEmailException(); + } if (empty($view) && !empty($this->config['info'])) { $view = $this->config['info']['description']; @@ -153,13 +155,6 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], return $data; } - protected function checkEmail(): void - { - if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { - throw new EmptyContactEmailException(); - } - } - protected function prepareEmptyData(?string $view = null, array $viewData = [], array $license = []): array { return [ @@ -826,8 +821,6 @@ public function saveProductionData() public function getDocFileContent() { try { - $this->checkEmail(); - $documentation = $this->driver->getDocumentation(); $this->openAPIValidator->validate($documentation); From 2d6f29429b6e15586a675c04439d35681c002730 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 24 Sep 2025 16:29:30 +0300 Subject: [PATCH 10/62] style:fix --- config/auto-doc.php | 2 -- lang/en/validation.php | 5 +++++ resources/views/error.blade.php | 2 +- src/AutoDocServiceProvider.php | 2 ++ src/Services/SwaggerService.php | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 lang/en/validation.php diff --git a/config/auto-doc.php b/config/auto-doc.php index dfebfc75..4245ad74 100644 --- a/config/auto-doc.php +++ b/config/auto-doc.php @@ -110,8 +110,6 @@ | You can use your custom description view for errors. */ 'error' => 'auto-doc::error', - - 'unhandled_error_message' => 'Documentation file is empty or have bad format', ], /* diff --git a/lang/en/validation.php b/lang/en/validation.php new file mode 100644 index 00000000..3a271245 --- /dev/null +++ b/lang/en/validation.php @@ -0,0 +1,5 @@ + 'Documentation file is empty or have bad format', +]; \ No newline at end of file diff --git a/resources/views/error.blade.php b/resources/views/error.blade.php index 9e1b884a..b10f9681 100644 --- a/resources/views/error.blade.php +++ b/resources/views/error.blade.php @@ -6,6 +6,6 @@ ### **Details:** -{{$message}} +{{ $message }} --- \ No newline at end of file diff --git a/src/AutoDocServiceProvider.php b/src/AutoDocServiceProvider.php index fafd6bcb..672c6fe3 100644 --- a/src/AutoDocServiceProvider.php +++ b/src/AutoDocServiceProvider.php @@ -11,6 +11,8 @@ public function boot() { $this->mergeConfigFrom(__DIR__ . '/../config/auto-doc.php', 'auto-doc'); + $this->loadTranslationsFrom(__DIR__ . '/../lang', 'auto-doc'); + $this->publishes([ __DIR__ . '/../config/auto-doc.php' => config_path('auto-doc.php'), ], 'config'); diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 5861df96..a18f7351 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -827,7 +827,7 @@ public function getDocFileContent() } catch (Throwable $exception) { $message = ($exception instanceof Exception) ? $exception->getMessage() - : config('auto-doc.defaults.unhandled_error_message'); + : __('validation.unhandled_error_message'); return $this->generateDataWithExceptionHandling($message, $exception); } From 2baa6e40387356290f42f812b8c1d9b544be4e51 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 28 Sep 2025 22:43:36 +0300 Subject: [PATCH 11/62] refactor: remove generateDataWithExceptionHandling --- src/Services/SwaggerService.php | 47 ++++++++++--------- tests/AutoDocControllerTest.php | 16 +++++++ .../documentation_without_email.json | 25 ++++++++++ 3 files changed, 66 insertions(+), 22 deletions(-) create mode 100644 tests/fixtures/AutoDocControllerTest/documentation_without_email.json diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index a18f7351..ab5222e1 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -136,9 +136,7 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], { // client must enter at least `contact.email` to generate a default `info` block // otherwise an exception will be called - if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { - throw new EmptyContactEmailException(); - } + $this->checkEmail(); if (empty($view) && !empty($this->config['info'])) { $view = $this->config['info']['description']; @@ -155,6 +153,13 @@ protected function generateEmptyData(?string $view = null, array $viewData = [], return $data; } + protected function checkEmail(): void + { + if (!empty($this->config['info']) && !Arr::get($this->config, 'info.contact.email')) { + throw new EmptyContactEmailException(); + } + } + protected function prepareEmptyData(?string $view = null, array $viewData = [], array $license = []): array { return [ @@ -821,15 +826,31 @@ public function saveProductionData() public function getDocFileContent() { try { + $this->checkEmail(); + $documentation = $this->driver->getDocumentation(); $this->openAPIValidator->validate($documentation); + } catch (EmptyContactEmailException $exception) { + return $this->prepareEmptyData( + $this->config['defaults']['error'], + [ + 'message' => $exception->getMessage(), + 'type' => $exception::class, + ], + ); } catch (Throwable $exception) { $message = ($exception instanceof Exception) ? $exception->getMessage() : __('validation.unhandled_error_message'); - return $this->generateDataWithExceptionHandling($message, $exception); + return $this->generateEmptyData( + $this->config['defaults']['error'], + [ + 'message' => $message, + 'type' => $exception::class, + ] + ); } $additionalDocs = config('auto-doc.additional_paths', []); @@ -849,24 +870,6 @@ public function getDocFileContent() return $documentation; } - protected function generateDataWithExceptionHandling(string $message, Throwable $exception): array - { - try { - return $this->generateEmptyData($this->config['defaults']['error'], [ - 'message' => $message, - 'type' => $exception::class, - ]); - } catch (EmptyContactEmailException $emptyEmailException) { - return $this->prepareEmptyData( - $this->config['defaults']['error'], - [ - 'message' => $emptyEmailException->getMessage(), - 'type' => $emptyEmailException::class, - ], - ); - } - } - protected function camelCaseToUnderScore($input): string { preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index cf9141d8..ddb0e0af 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -40,6 +40,22 @@ public function testGetJSONDocumentation() $response->assertJson(self::$documentation); } + public function testGetJSONWithoutEmailDocumentation() + { + config( + [ + 'auto-doc.info.contact.email' => null, + 'app.env' => 'development', + ], + ); + + $response = $this->json('get', '/auto-doc/documentation'); + + $response->assertStatus(Response::HTTP_OK); + + $this->assertEqualsJsonFixture('documentation_without_email', $response->json()); + } + public function testGetJSONDocumentationWithAdditionalPaths() { config([ diff --git a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json new file mode 100644 index 00000000..49c4d4e9 --- /dev/null +++ b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json @@ -0,0 +1,25 @@ +{ + "openapi": "3.1.0", + "servers": [ + { + "url": "http:\/\/localhost" + } + ], + "paths": [], + "components": { + "schemas": [] + }, + "info": { + "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n---", + "version": "0.0.0", + "title": "Name of Your Application", + "termsOfService": "", + "contact": { + "email": null + }, + "license": { + "name": "", + "url": "" + } + } +} \ No newline at end of file From b8c8e88593aa04ba1bdabc6f5c9a64cf646ca9c7 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 29 Sep 2025 14:13:53 +0300 Subject: [PATCH 12/62] style:fix --- lang/en/validation.php | 2 +- tests/AutoDocControllerTest.php | 10 ++++------ tests/SwaggerServiceTest.php | 19 +------------------ 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/lang/en/validation.php b/lang/en/validation.php index 3a271245..18eeb1f3 100644 --- a/lang/en/validation.php +++ b/lang/en/validation.php @@ -2,4 +2,4 @@ return [ 'unhandled_error_message' => 'Documentation file is empty or have bad format', -]; \ No newline at end of file +]; diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index ddb0e0af..bb7ab7c9 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -42,12 +42,10 @@ public function testGetJSONDocumentation() public function testGetJSONWithoutEmailDocumentation() { - config( - [ - 'auto-doc.info.contact.email' => null, - 'app.env' => 'development', - ], - ); + config([ + 'auto-doc.info.contact.email' => null, + 'app.env' => 'development', + ]); $response = $this->json('get', '/auto-doc/documentation'); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 99dee1a8..e627bc61 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -250,24 +250,7 @@ public function testEmptyContactEmail() app(SwaggerService::class)->getDocFileContent(); } - - public function testGetJSONDocumentationEmailIsNull() - { - config( - [ - 'auto-doc.info.contact.email' => null, - 'app.env' => 'development', - ], - ); - - $content = app(SwaggerService::class)->getDocFileContent(); - - $this->assertEqualsFixture( - 'invalid_contact_email_format.html', - $content['info']['description'] - ); - } - + public static function getAddEmptyData(): array { return [ From c779d3382326705a2e52a5fdd5f9286d26be0c2a Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 6 Oct 2025 17:11:15 +0300 Subject: [PATCH 13/62] refactor: mock getTraceMethod --- resources/views/error.blade.php | 5 +- src/Services/SwaggerService.php | 76 +++++++++------- tests/SwaggerServiceTest.php | 4 +- .../documentation__non_json.txt | 90 ------------------- .../documentation_without_email.json | 2 +- ...valid_format_array_parameter_no_items.html | 3 + ...d_format_array_response_body_no_items.html | 3 + ...format_array_response_header_no_items.html | 3 + .../invalid_format_body_and_form_params.html | 3 + ...nvalid_format_duplicate_header_params.html | 3 + ...invalid_format_duplicate_operation_id.html | 3 + .../invalid_format_duplicate_path_params.html | 3 + ...id_format_duplicate_path_placeholders.html | 3 + .../invalid_format_duplicate_tag.html | 3 + .../invalid_format_file_invalid_consumes.html | 3 + .../invalid_format_file_no_consumes.html | 3 + ...rrect_documentation_structure_request.html | 3 + .../invalid_format_invalid_schema_type.html | 3 + ...lid_format_invalid_value_parameter_in.html | 3 + .../invalid_format_invalid_value_path.html | 3 + ...alid_format_invalid_value_status_code.html | 3 + .../invalid_format_missing_external_ref.html | 3 + ..._format_missing_field_definition_type.html | 3 + ...alid_format_missing_field_header_type.html | 3 + ...lid_format_missing_field_info_version.html | 3 + ...valid_format_missing_field_items_type.html | 3 + ...mat_missing_field_operation_responses.html | 3 + ...lid_format_missing_field_parameter_in.html | 3 + .../invalid_format_missing_field_paths.html | 3 + ...at_missing_field_response_description.html | 3 + ...invalid_format_missing_field_tag_name.html | 3 + .../invalid_format_missing_local_ref.html | 3 + ...invalid_format_missing_path_parameter.html | 3 + .../invalid_format_missing_ref_file.html | 3 + .../invalid_format_multiple_body_params.html | 3 + .../invalid_format_no_path_params.html | 3 + ...alid_format_path_param_no_placeholder.html | 3 + ...d_format_request_body_invalid_content.html | 3 + ...invalid_format_response_invalid_items.html | 3 + ...valid_format_security_definition_flow.html | 3 + ...invalid_format_security_definition_in.html | 3 + ...valid_format_security_definition_type.html | 3 + .../SwaggerServiceTest/invalid_version.html | 3 + .../Traits/SwaggerServiceMockTrait.php | 49 ++++++++++ 44 files changed, 217 insertions(+), 123 deletions(-) delete mode 100644 tests/fixtures/AutoDocControllerTest/documentation__non_json.txt diff --git a/resources/views/error.blade.php b/resources/views/error.blade.php index b10f9681..de4ceeb3 100644 --- a/resources/views/error.blade.php +++ b/resources/views/error.blade.php @@ -1,6 +1,6 @@ # ❗️ **ERROR** ❗️ -## 🚨🚨 {{$type}} 🚨🚨 +## 🚨🚨 {{ $type }} 🚨🚨 --- @@ -8,4 +8,7 @@ {{ $message }} +### **Error place:** + +{{ $error_place }} --- \ No newline at end of file diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index ab5222e1..715e5721 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -25,6 +25,7 @@ use Symfony\Component\HttpFoundation\Response; use Throwable; use Exception; + /** * @property SwaggerDriverContract $driver */ @@ -73,6 +74,10 @@ public function __construct(Container $container) $this->setDriver(); if (config('app.env') === 'testing') { + // client must enter at least `contact.email` to generate a default `info` block + // otherwise an exception will be called + $this->checkEmail(); + $this->container = $container; $this->security = $this->config['security']; @@ -84,6 +89,23 @@ public function __construct(Container $container) $this->driver->saveProcessTmpData($this->data); } + } else { + try { + $this->checkEmail(); + } catch (EmptyContactEmailException $exception) { + $this->data = $this->generateEmptyData( + $this->config['defaults']['error'], + [ + 'message' => $exception->getMessage(), + 'type' => $exception::class, + 'error_place' => $this->getErrorPlace($exception), + ], + ); + + $this->driver->saveProcessTmpData($this->data); + + $this->driver->saveData(); + } } } @@ -134,15 +156,21 @@ protected function setDriver() protected function generateEmptyData(?string $view = null, array $viewData = [], array $license = []): array { - // client must enter at least `contact.email` to generate a default `info` block - // otherwise an exception will be called - $this->checkEmail(); - if (empty($view) && !empty($this->config['info'])) { $view = $this->config['info']['description']; } - $data = $this->prepareEmptyData($view, $viewData, $license); + $data = [ + 'openapi' => self::OPEN_API_VERSION, + 'servers' => [ + ['url' => URL::query($this->config['basePath'])], + ], + 'paths' => [], + 'components' => [ + 'schemas' => $this->config['definitions'], + ], + 'info' => $this->prepareInfo($view, $viewData, $license), + ]; $securityDefinitions = $this->generateSecurityDefinition(); @@ -160,21 +188,6 @@ protected function checkEmail(): void } } - protected function prepareEmptyData(?string $view = null, array $viewData = [], array $license = []): array - { - return [ - 'openapi' => self::OPEN_API_VERSION, - 'servers' => [ - ['url' => URL::query($this->config['basePath'])], - ], - 'paths' => [], - 'components' => [ - 'schemas' => $this->config['definitions'], - ], - 'info' => $this->prepareInfo($view, $viewData, $license), - ]; - } - protected function generateSecurityDefinition(): ?array { if (empty($this->security)) { @@ -826,19 +839,9 @@ public function saveProductionData() public function getDocFileContent() { try { - $this->checkEmail(); - $documentation = $this->driver->getDocumentation(); $this->openAPIValidator->validate($documentation); - } catch (EmptyContactEmailException $exception) { - return $this->prepareEmptyData( - $this->config['defaults']['error'], - [ - 'message' => $exception->getMessage(), - 'type' => $exception::class, - ], - ); } catch (Throwable $exception) { $message = ($exception instanceof Exception) ? $exception->getMessage() @@ -849,6 +852,7 @@ public function getDocFileContent() [ 'message' => $message, 'type' => $exception::class, + 'error_place' => $this->getErrorPlace($exception), ] ); } @@ -870,6 +874,18 @@ public function getDocFileContent() return $documentation; } + protected function getErrorPlace(Throwable $exception): string + { + $errorPlaceInTrace = Arr::first($exception->getTrace()); + + $errorPlaceInTrace = implode(', ', Arr::map( + $errorPlaceInTrace, + fn ($value, $key) => $key . '=' . (is_array($value) ? json_encode($value) : $value), + )); + + return $errorPlaceInTrace; + } + protected function camelCaseToUnderScore($input): string { preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index e627bc61..d6d5edd6 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -238,6 +238,8 @@ public function testGetDocFileContentInvalidTmpData( $content = app(SwaggerService::class)->getDocFileContent(); + $this->mockGetTrace($content['info']['description']); + $this->assertEqualsFixture($fixture, $content['info']['description']); } @@ -250,7 +252,7 @@ public function testEmptyContactEmail() app(SwaggerService::class)->getDocFileContent(); } - + public static function getAddEmptyData(): array { return [ diff --git a/tests/fixtures/AutoDocControllerTest/documentation__non_json.txt b/tests/fixtures/AutoDocControllerTest/documentation__non_json.txt deleted file mode 100644 index ba9562d7..00000000 --- a/tests/fixtures/AutoDocControllerTest/documentation__non_json.txt +++ /dev/null @@ -1,90 +0,0 @@ -openapi: "3.1.0", -info: - description: "This is a sample server Petstore server." - version: "1.0.0" - title: "Swagger Petstore 2.0" - termsOfService: "http://swagger.io/terms/" - contact: - email: "apiteam@swagger.io" - license: - name: "Apache 2.0" - url: "http://www.apache.org/licenses/LICENSE-2.0.html" -host: "petstore.swagger.io" -basePath: "/v2" -tags: -- name: "pet" - description: "Everything about your Pets" - externalDocs: - description: "Find out more" - url: "http://swagger.io" -- name: "store" - description: "Access to Petstore orders" -- name: "user" - description: "Operations about user" - externalDocs: - description: "Find out more about our store" - url: "http://swagger.io" -schemes: -- "https" -- "http" -paths: - /pet: - post: - tags: - - "pet" - summary: "Add a new pet to the store" - description: "" - operationId: "addPet" - - parameters: - - in: "body" - name: "body" - description: "Pet object that needs to be added to the store" - required: true - schema: - $ref: "#/definitions/Pet" - responses: - "405": - description: "Invalid input" - security: - - petstore_auth: - - "write:pets" - - "read:pets" -definitions: - Pet: - type: "object" - required: - - "name" - - "photoUrls" - properties: - id: - type: "integer" - format: "int64" - category: - $ref: "#/definitions/Category" - name: - type: "string" - example: "doggie" - photoUrls: - type: "array" - xml: - name: "photoUrl" - wrapped: true - items: - type: "string" - tags: - type: "array" - xml: - name: "tag" - wrapped: true - items: - $ref: "#/definitions/Tag" - status: - type: "string" - description: "pet status in the store" - enum: - - "available" - - "pending" - - "sold" - xml: - name: "Pet" diff --git a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json index 49c4d4e9..ebfed48d 100644 --- a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json +++ b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json @@ -10,7 +10,7 @@ "schemas": [] }, "info": { - "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n---", + "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n### **Error place:**\n\nfile=\/app\/src\/Services\/SwaggerService.php, line=94, function=checkEmail, class=RonasIT\\AutoDoc\\Services\\SwaggerService, type=->, args=[]\n---", "version": "0.0.0", "title": "Name of Your Application", "termsOfService": "", diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index b3b59d1d..754c82ce 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -8,4 +8,7 @@ Validation failed. paths./users.post.parameters.0 is an array, so it must include an 'items' field. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index f6990d54..12f50651 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -8,4 +8,7 @@ Validation failed. paths./users.get.responses.200.schema is an array, so it must include an 'items' field. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index 3a8acca3..ccbdfb47 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -8,4 +8,7 @@ Validation failed. paths./users.get.responses.default.headers.Last-Modified is an array, so it must include an 'items' field. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index 903c06d5..6a3709d0 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}.post' has body and formData parameters. Only one or the other is allowed. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index 750b70b8..87dd8675 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}.get' has multiple in:header parameters with name:foo. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index f3e281d5..e45159da 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -8,4 +8,7 @@ Validation failed. Found multiple fields 'paths.*.*.operationId' with values: addPet. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index 1bae9f4c..7efb2b92 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}.get' has multiple in:path parameters with name:username. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index 98bdd8f2..df82a5dc 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -8,4 +8,7 @@ Validation failed. Path '/users/{username}/profile/{username}/image/{img_id}' has multiple path placeholders with name: username. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index 000b18e2..09f6161e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -8,4 +8,7 @@ Validation failed. Found multiple fields 'tags.*.name' with values: user. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index a2bb572b..53eed4a0 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}/profile/image.post' has body and formData parameters. Only one or the other is allowed. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index a2bb572b..31690a7d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}/profile/image.post' has body and formData parameters. Only one or the other is allowed. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 625b3c12..34024aed 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -8,4 +8,7 @@ Documentation file is empty or have bad format +### **Error place:** + +file=/app/src/Services/SwaggerService.php, 999, function=getDocumentation, MockClass, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index 9bd8cf18..e9b26f5d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -8,4 +8,7 @@ Validation failed. Field 'paths./users.get.responses.200.schema.type' has an invalid value: something. Allowed values: array, boolean, integer, number, string, object, null, undefined, file. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index 420049e2..0f76d47a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -8,4 +8,7 @@ Validation failed. Field 'paths./auth/login.post.parameters.0.in' has an invalid value: invalid_in. Allowed values: body, formData, query, path, header. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index 5652180b..5ac7e76d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -8,4 +8,7 @@ Validation failed. Incorrect 'paths.users'. Paths should only have path names that starts with `/`. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index e00f8f6d..2058d69f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -8,4 +8,7 @@ Validation failed. Operation at 'paths./users.get.responses.8888' should only have three-digit status codes, `default`, and vendor extensions (`x-*`) as properties. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html index 03ed7df9..602f5aed 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_external_ref.html @@ -8,4 +8,7 @@ Validation failed. Ref 'authloginObject' is used in $ref but not defined in 'tests/fixtures/SwaggerServiceTest/documentation/with_definitions.json' file. +### **Error place:** + +function=RonasIT\AutoDoc\Validators\{closure}, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["tests\/fixtures\/SwaggerServiceTest\/documentation\/with_definitions.json#\/definitions\/authloginObject","$ref"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index 1bd47469..26bf95fd 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -8,4 +8,7 @@ Validation failed. 'components.schemas.authloginObject' should have required fields: type. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index f81aacb3..d2632e33 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -8,4 +8,7 @@ Validation failed. 'paths./user/login.get.responses.200.headers.X-Rate-Limit' should have required fields: type. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index f17fbeb5..5e9da536 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -8,4 +8,7 @@ Validation failed. 'info' should have required fields: version. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index 67ab26af..b4dd942c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -8,4 +8,7 @@ Validation failed. 'paths./pet/findByStatus.get.parameters.0.schema.items' should have required fields: type. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index eca8a087..81aabcf6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -8,4 +8,7 @@ Validation failed. 'paths./auth/login.post' should have required fields: responses. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 3c5488be..5dcca334 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -8,4 +8,7 @@ Validation failed. 'paths./auth/login.post.parameters.0' should have required fields: in. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index 640f4c70..d3c9dfe9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -8,4 +8,7 @@ Validation failed. '' should have required fields: paths. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index 7bbd9bb1..1aec013c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -8,4 +8,7 @@ Validation failed. 'paths./auth/login.post.responses.200' should have required fields: description. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index 8cecf072..c0b68fb6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -8,4 +8,7 @@ Validation failed. 'tags.0' should have required fields: name. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html index e990dbf6..30a369f9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_local_ref.html @@ -8,4 +8,7 @@ Validation failed. Ref 'loginObject' is used in $ref but not defined in 'definitions' field. +### **Error place:** + +function=RonasIT\AutoDoc\Validators\{closure}, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["#\/definitions\/loginObject","$ref"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index e8b8f597..5ec89ce7 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -8,4 +8,7 @@ Validation failed. Path parameters cannot be optional. Set required=true for the 'username' parameters at operation 'paths./users.get'. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html index dde77bcf..e9a773e7 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_ref_file.html @@ -8,4 +8,7 @@ Validation failed. Filename 'invalid-filename.json' is used in $ref but file doesn't exist. +### **Error place:** + +function=RonasIT\AutoDoc\Validators\{closure}, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["invalid-filename.json","$ref"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index 8d22c659..b6a02dc4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}.get' has 2 body parameters. Only one is allowed. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index 0bb9a5b2..697fcf6f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}/{foo}.get' has no params for placeholders: username, foo. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index 69a05e87..10c3b9cb 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{username}.post' has no placeholders for params: foo. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index fa9ecd17..82fc865d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -8,4 +8,7 @@ Validation failed. Operation 'paths./users/{id}.post' has invalid content types: image/png. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index 203ba2d1..3c68fce3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -8,4 +8,7 @@ Validation failed. 'paths./users/{id}.post.responses.200.schema.items' should have required fields: type. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index 4e895c16..d53751e0 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -8,4 +8,7 @@ Validation failed. Field 'securityDefinitions.0.flow' has an invalid value: invalid. Allowed values: implicit, password, application, accessCode. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index 3b9674ab..d78a9e65 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -8,4 +8,7 @@ Validation failed. Field 'securityDefinitions.0.in' has an invalid value: invalid. Allowed values: query, header. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index 698cbf07..0f096224 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -8,4 +8,7 @@ Validation failed. Field 'securityDefinitions.0.type' has an invalid value: invalid. Allowed values: basic, apiKey, oauth2. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index a205d576..ba5ff471 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -8,4 +8,7 @@ Validation failed. Unrecognized Swagger version '1.0'. Expected 3.1.0. +### **Error place:** + +file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 8c47d2bb..9d155148 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -4,6 +4,14 @@ use RonasIT\AutoDoc\Drivers\LocalDriver; use RonasIT\Support\Traits\MockTrait; +use RonasIT\AutoDoc\Services\SwaggerService; +use Illuminate\Container\Container; +use Mockery; +use Mockery\MockInterface; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; + +use function PHPUnit\Framework\callback; trait SwaggerServiceMockTrait { @@ -68,4 +76,45 @@ protected function mockDriverSaveData($driverClass = LocalDriver::class): void $this->functionCall('saveData'), ]); } + + protected function mockGetTrace(string &$content): void + { + $contentInArray = explode(PHP_EOL, $content); + + $traceInfo = Arr::first( + array: $contentInArray, + callback: fn ($value, $key) => Str::containsAll($value, ['args', 'class']) + ); + + $traceInfoInArray = $this->gerTraceInfoInArray($traceInfo); + + $mockedContent = Arr::set( + array: $contentInArray, + key: array_search($traceInfo, $contentInArray), + value: implode(', ', $traceInfoInArray) + ); + + $content = implode(PHP_EOL, $mockedContent); + } + + protected function gerTraceInfoInArray(string $traceInfo): array + { + $errorPlaceInArray = explode(', ', $traceInfo); + $errorPlaceInArray = array_combine( + keys: Arr::map($errorPlaceInArray, fn ($value, $key) => Str::before($value, '=')), + values: $errorPlaceInArray + ); + + foreach ($errorPlaceInArray as $key => $value) { + if ($key === 'line') { + $errorPlaceInArray[$key] = 999; + } + + if ($key === 'class' && Str::contains($value, 'MockObject')) { + $errorPlaceInArray[$key] = 'MockClass'; + } + } + + return $errorPlaceInArray; + } } From b5f10584e34c03ea82c6238a8867872704e45157 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 6 Oct 2025 17:23:10 +0300 Subject: [PATCH 14/62] fix: make correct trace format --- .../invalid_format_array_parameter_no_items.html | 2 +- .../invalid_format_array_response_body_no_items.html | 2 +- .../invalid_format_array_response_header_no_items.html | 2 +- .../invalid_format_body_and_form_params.html | 2 +- .../invalid_format_duplicate_header_params.html | 2 +- .../invalid_format_duplicate_operation_id.html | 2 +- .../invalid_format_duplicate_path_params.html | 2 +- .../invalid_format_duplicate_path_placeholders.html | 2 +- .../SwaggerServiceTest/invalid_format_duplicate_tag.html | 2 +- .../invalid_format_file_invalid_consumes.html | 2 +- .../SwaggerServiceTest/invalid_format_file_no_consumes.html | 2 +- ...alid_format_incorrect_documentation_structure_request.html | 2 +- .../invalid_format_invalid_schema_type.html | 2 +- .../invalid_format_invalid_value_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_value_path.html | 2 +- .../invalid_format_invalid_value_status_code.html | 2 +- .../invalid_format_missing_field_definition_type.html | 2 +- .../invalid_format_missing_field_header_type.html | 2 +- .../invalid_format_missing_field_info_version.html | 2 +- .../invalid_format_missing_field_items_type.html | 2 +- .../invalid_format_missing_field_operation_responses.html | 2 +- .../invalid_format_missing_field_parameter_in.html | 2 +- .../invalid_format_missing_field_paths.html | 2 +- .../invalid_format_missing_field_response_description.html | 2 +- .../invalid_format_missing_field_tag_name.html | 2 +- .../invalid_format_missing_path_parameter.html | 2 +- .../invalid_format_multiple_body_params.html | 2 +- .../SwaggerServiceTest/invalid_format_no_path_params.html | 2 +- .../invalid_format_path_param_no_placeholder.html | 2 +- .../invalid_format_request_body_invalid_content.html | 2 +- .../invalid_format_response_invalid_items.html | 2 +- .../invalid_format_security_definition_flow.html | 2 +- .../invalid_format_security_definition_in.html | 2 +- .../invalid_format_security_definition_type.html | 2 +- tests/fixtures/SwaggerServiceTest/invalid_version.html | 2 +- tests/support/Traits/SwaggerServiceMockTrait.php | 4 ++-- 36 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index 754c82ce..a4efb182 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index 12f50651..283f9288 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index ccbdfb47..97bda741 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index 6a3709d0..24e9b137 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index 87dd8675..aeac17b4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index e45159da..777704ae 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index 7efb2b92..5cd58a07 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index df82a5dc..fd840cb1 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index 09f6161e..8bc521ad 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index 53eed4a0..75c8b8ee 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index 31690a7d..c6e36708 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 34024aed..7ee61ea5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Services/SwaggerService.php, 999, function=getDocumentation, MockClass, type=->, args=[] +file=/app/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=MockClass, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index e9b26f5d..a8af1bf6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index 0f76d47a..3b6771c9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index 5ac7e76d..a780b7c0 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index 2058d69f..5a7cabf9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index 26bf95fd..66ced634 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index d2632e33..8eac3285 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index 5e9da536..9336bbea 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index b4dd942c..e80ebda9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index 81aabcf6..de59ebb8 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 5dcca334..7e5fe86e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index d3c9dfe9..24170790 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index 1aec013c..7274f18c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index c0b68fb6..6d33da78 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index 5ec89ce7..641df7c6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index b6a02dc4..bc2dbdb3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index 697fcf6f..bf317e29 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index 10c3b9cb..2a70611d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index 82fc865d..0db80265 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index 3c68fce3..e3d72f11 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index d53751e0..719073a9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index d78a9e65..7c1bbc77 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index 0f096224..e33b2902 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index ba5ff471..ed0f59cd 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, 999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 9d155148..7ed4d852 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -107,11 +107,11 @@ protected function gerTraceInfoInArray(string $traceInfo): array foreach ($errorPlaceInArray as $key => $value) { if ($key === 'line') { - $errorPlaceInArray[$key] = 999; + $errorPlaceInArray[$key] = 'line=999'; } if ($key === 'class' && Str::contains($value, 'MockObject')) { - $errorPlaceInArray[$key] = 'MockClass'; + $errorPlaceInArray[$key] = 'class=MockClass'; } } From e91f3c75dbdac69501f176106756a74d76c3db96 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 6 Oct 2025 17:50:18 +0300 Subject: [PATCH 15/62] refactor: make TraceMockTrait --- tests/AutoDocControllerTest.php | 8 ++- tests/SwaggerServiceTest.php | 2 + .../documentation_without_email.json | 2 +- .../Traits/SwaggerServiceMockTrait.php | 49 ------------------ tests/support/Traits/TraceMockTrait.php | 50 +++++++++++++++++++ 5 files changed, 60 insertions(+), 51 deletions(-) create mode 100644 tests/support/Traits/TraceMockTrait.php diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index bb7ab7c9..ab8534c2 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -4,10 +4,12 @@ use Illuminate\Http\Response; use phpmock\phpunit\PHPMock; +use RonasIT\AutoDoc\Tests\Support\Traits\TraceMockTrait; class AutoDocControllerTest extends TestCase { use PHPMock; + use TraceMockTrait; protected static array $documentation; protected static string $localDriverFilePath; @@ -51,7 +53,11 @@ public function testGetJSONWithoutEmailDocumentation() $response->assertStatus(Response::HTTP_OK); - $this->assertEqualsJsonFixture('documentation_without_email', $response->json()); + $content = $response->json(); + + $this->mockGetTrace($content['info']['description']); + + $this->assertEqualsJsonFixture('documentation_without_email', $content); } public function testGetJSONDocumentationWithAdditionalPaths() diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index d6d5edd6..5c28b59d 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -16,10 +16,12 @@ use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceMockTrait; use stdClass; use RonasIT\AutoDoc\Exceptions\EmptyContactEmailException; +use RonasIT\AutoDoc\Tests\Support\Traits\TraceMockTrait; class SwaggerServiceTest extends TestCase { use SwaggerServiceMockTrait; + use TraceMockTrait; public function testConstructorInvalidConfigVersion() { diff --git a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json index ebfed48d..7c27cb3c 100644 --- a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json +++ b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json @@ -10,7 +10,7 @@ "schemas": [] }, "info": { - "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n### **Error place:**\n\nfile=\/app\/src\/Services\/SwaggerService.php, line=94, function=checkEmail, class=RonasIT\\AutoDoc\\Services\\SwaggerService, type=->, args=[]\n---", + "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n### **Error place:**\n\nfile=\/app\/src\/Services\/SwaggerService.php, line=999, function=checkEmail, class=RonasIT\\AutoDoc\\Services\\SwaggerService, type=->, args=[]\n---", "version": "0.0.0", "title": "Name of Your Application", "termsOfService": "", diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 7ed4d852..8c47d2bb 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -4,14 +4,6 @@ use RonasIT\AutoDoc\Drivers\LocalDriver; use RonasIT\Support\Traits\MockTrait; -use RonasIT\AutoDoc\Services\SwaggerService; -use Illuminate\Container\Container; -use Mockery; -use Mockery\MockInterface; -use Illuminate\Support\Arr; -use Illuminate\Support\Str; - -use function PHPUnit\Framework\callback; trait SwaggerServiceMockTrait { @@ -76,45 +68,4 @@ protected function mockDriverSaveData($driverClass = LocalDriver::class): void $this->functionCall('saveData'), ]); } - - protected function mockGetTrace(string &$content): void - { - $contentInArray = explode(PHP_EOL, $content); - - $traceInfo = Arr::first( - array: $contentInArray, - callback: fn ($value, $key) => Str::containsAll($value, ['args', 'class']) - ); - - $traceInfoInArray = $this->gerTraceInfoInArray($traceInfo); - - $mockedContent = Arr::set( - array: $contentInArray, - key: array_search($traceInfo, $contentInArray), - value: implode(', ', $traceInfoInArray) - ); - - $content = implode(PHP_EOL, $mockedContent); - } - - protected function gerTraceInfoInArray(string $traceInfo): array - { - $errorPlaceInArray = explode(', ', $traceInfo); - $errorPlaceInArray = array_combine( - keys: Arr::map($errorPlaceInArray, fn ($value, $key) => Str::before($value, '=')), - values: $errorPlaceInArray - ); - - foreach ($errorPlaceInArray as $key => $value) { - if ($key === 'line') { - $errorPlaceInArray[$key] = 'line=999'; - } - - if ($key === 'class' && Str::contains($value, 'MockObject')) { - $errorPlaceInArray[$key] = 'class=MockClass'; - } - } - - return $errorPlaceInArray; - } } diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php new file mode 100644 index 00000000..3ffa1158 --- /dev/null +++ b/tests/support/Traits/TraceMockTrait.php @@ -0,0 +1,50 @@ + Str::containsAll($value, ['args', 'class']) + ); + + $traceInfoInArray = $this->gerTraceInfoInArray($traceInfo); + + $mockedContent = Arr::set( + array: $contentInArray, + key: array_search($traceInfo, $contentInArray), + value: implode(', ', $traceInfoInArray) + ); + + $content = implode(PHP_EOL, $mockedContent); + } + + protected function gerTraceInfoInArray(string $traceInfo): array + { + $errorPlaceInArray = explode(', ', $traceInfo); + $errorPlaceInArray = array_combine( + keys: Arr::map($errorPlaceInArray, fn ($value, $key) => Str::before($value, '=')), + values: $errorPlaceInArray + ); + + foreach ($errorPlaceInArray as $key => $value) { + if ($key === 'line') { + $errorPlaceInArray[$key] = 'line=999'; + } + + if ($key === 'class' && Str::contains($value, 'MockObject')) { + $errorPlaceInArray[$key] = 'class=MockClass'; + } + } + + return $errorPlaceInArray; + } +} \ No newline at end of file From 500b9dfc40ae1b1342ef644ffc4311145fb4498e Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 6 Oct 2025 17:55:34 +0300 Subject: [PATCH 16/62] style:fix --- tests/AutoDocControllerTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index ab8534c2..8a39cd95 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -8,8 +8,7 @@ class AutoDocControllerTest extends TestCase { - use PHPMock; - use TraceMockTrait; + use PHPMock, TraceMockTrait; protected static array $documentation; protected static string $localDriverFilePath; From 9cc86e5b98e1efd6c339ed37399fbda4386d491f Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 6 Oct 2025 18:08:01 +0300 Subject: [PATCH 17/62] style:fix --- tests/support/Traits/TraceMockTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 3ffa1158..40a9ee15 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -16,7 +16,7 @@ protected function mockGetTrace(string &$content): void callback: fn ($value, $key) => Str::containsAll($value, ['args', 'class']) ); - $traceInfoInArray = $this->gerTraceInfoInArray($traceInfo); + $traceInfoInArray = $this->getTraceInfoInArray($traceInfo); $mockedContent = Arr::set( array: $contentInArray, @@ -27,7 +27,7 @@ protected function mockGetTrace(string &$content): void $content = implode(PHP_EOL, $mockedContent); } - protected function gerTraceInfoInArray(string $traceInfo): array + protected function getTraceInfoInArray(string $traceInfo): array { $errorPlaceInArray = explode(', ', $traceInfo); $errorPlaceInArray = array_combine( From 9bc0e270c247a3f3ca1724da82af621fa973ccad Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 6 Oct 2025 18:08:01 +0300 Subject: [PATCH 18/62] style:fix --- tests/support/Traits/TraceMockTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 3ffa1158..9497f615 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -13,10 +13,10 @@ protected function mockGetTrace(string &$content): void $traceInfo = Arr::first( array: $contentInArray, - callback: fn ($value, $key) => Str::containsAll($value, ['args', 'class']) + callback: fn ($value, $key) => Str::containsAll($value, ['arg', 'class']) ); - $traceInfoInArray = $this->gerTraceInfoInArray($traceInfo); + $traceInfoInArray = $this->getTraceInfoInArray($traceInfo); $mockedContent = Arr::set( array: $contentInArray, @@ -27,7 +27,7 @@ protected function mockGetTrace(string &$content): void $content = implode(PHP_EOL, $mockedContent); } - protected function gerTraceInfoInArray(string $traceInfo): array + protected function getTraceInfoInArray(string $traceInfo): array { $errorPlaceInArray = explode(', ', $traceInfo); $errorPlaceInArray = array_combine( From 0d5d70e2831d111710109c41e3d91c49a1cdbdce Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 7 Oct 2025 16:10:51 +0300 Subject: [PATCH 19/62] fix: correct find trace info in response content --- tests/support/Traits/TraceMockTrait.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 9497f615..61c49181 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -13,7 +13,7 @@ protected function mockGetTrace(string &$content): void $traceInfo = Arr::first( array: $contentInArray, - callback: fn ($value, $key) => Str::containsAll($value, ['arg', 'class']) + callback: fn ($value, $key) => Str::contains($value, 'function=') ); $traceInfoInArray = $this->getTraceInfoInArray($traceInfo); @@ -36,13 +36,11 @@ protected function getTraceInfoInArray(string $traceInfo): array ); foreach ($errorPlaceInArray as $key => $value) { - if ($key === 'line') { - $errorPlaceInArray[$key] = 'line=999'; - } - - if ($key === 'class' && Str::contains($value, 'MockObject')) { - $errorPlaceInArray[$key] = 'class=MockClass'; - } + $errorPlaceInArray[$key] = match ($key) { + 'line' => 'line=999', + 'class' => Str::contains($value, 'MockObject') ? 'class=MockClass' : $value, + default => $value, + }; } return $errorPlaceInArray; From 99e0fc5ed150e9173e954fde47e26e8662c7dd2a Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 7 Oct 2025 17:46:24 +0300 Subject: [PATCH 20/62] refactor: make tests for github ci env --- .github/workflows/run-tests-with-coverage.yml | 2 +- tests/support/Traits/TraceMockTrait.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests-with-coverage.yml b/.github/workflows/run-tests-with-coverage.yml index 4d4ab568..204e51c4 100644 --- a/.github/workflows/run-tests-with-coverage.yml +++ b/.github/workflows/run-tests-with-coverage.yml @@ -24,7 +24,7 @@ jobs: - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist - name: Execute unit tests via PHPUnit with coverage - run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml + run: php -d zend.exception_ignore_args=0 -d xdebug.collect_params=4 vendor/bin/phpunit --coverage-clover build/logs/clover.xml - name: Export coverage report if: ${{ matrix.php-version == '8.4' }} uses: actions/upload-artifact@v4 diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 61c49181..33e93943 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -39,10 +39,20 @@ protected function getTraceInfoInArray(string $traceInfo): array $errorPlaceInArray[$key] = match ($key) { 'line' => 'line=999', 'class' => Str::contains($value, 'MockObject') ? 'class=MockClass' : $value, + 'file' => $this->normalizeFilePath($value), default => $value, }; } return $errorPlaceInArray; } + + protected function normalizeFilePath(string $filePath): string + { + if (!str_starts_with($filePath, '/app')) { + return Str::after($filePath, base_path() . DIRECTORY_SEPARATOR); + } + + return $filePath; + } } \ No newline at end of file From 986846577d2b80aec7fd22dac08f5abded34301f Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 7 Oct 2025 18:04:52 +0300 Subject: [PATCH 21/62] fix:tests --- .../AutoDocControllerTest/documentation_without_email.json | 2 +- .../invalid_format_array_parameter_no_items.html | 2 +- .../invalid_format_array_response_body_no_items.html | 2 +- .../invalid_format_array_response_header_no_items.html | 2 +- .../SwaggerServiceTest/invalid_format_body_and_form_params.html | 2 +- .../invalid_format_duplicate_header_params.html | 2 +- .../invalid_format_duplicate_operation_id.html | 2 +- .../invalid_format_duplicate_path_params.html | 2 +- .../invalid_format_duplicate_path_placeholders.html | 2 +- .../SwaggerServiceTest/invalid_format_duplicate_tag.html | 2 +- .../invalid_format_file_invalid_consumes.html | 2 +- .../SwaggerServiceTest/invalid_format_file_no_consumes.html | 2 +- ...nvalid_format_incorrect_documentation_structure_request.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_schema_type.html | 2 +- .../invalid_format_invalid_value_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_value_path.html | 2 +- .../invalid_format_invalid_value_status_code.html | 2 +- .../invalid_format_missing_field_definition_type.html | 2 +- .../invalid_format_missing_field_header_type.html | 2 +- .../invalid_format_missing_field_info_version.html | 2 +- .../invalid_format_missing_field_items_type.html | 2 +- .../invalid_format_missing_field_operation_responses.html | 2 +- .../invalid_format_missing_field_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_missing_field_paths.html | 2 +- .../invalid_format_missing_field_response_description.html | 2 +- .../invalid_format_missing_field_tag_name.html | 2 +- .../invalid_format_missing_path_parameter.html | 2 +- .../SwaggerServiceTest/invalid_format_multiple_body_params.html | 2 +- .../SwaggerServiceTest/invalid_format_no_path_params.html | 2 +- .../invalid_format_path_param_no_placeholder.html | 2 +- .../invalid_format_request_body_invalid_content.html | 2 +- .../invalid_format_response_invalid_items.html | 2 +- .../invalid_format_security_definition_flow.html | 2 +- .../invalid_format_security_definition_in.html | 2 +- .../invalid_format_security_definition_type.html | 2 +- tests/fixtures/SwaggerServiceTest/invalid_version.html | 2 +- tests/support/Traits/TraceMockTrait.php | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json index 7c27cb3c..382b20c2 100644 --- a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json +++ b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json @@ -10,7 +10,7 @@ "schemas": [] }, "info": { - "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n### **Error place:**\n\nfile=\/app\/src\/Services\/SwaggerService.php, line=999, function=checkEmail, class=RonasIT\\AutoDoc\\Services\\SwaggerService, type=->, args=[]\n---", + "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n### **Error place:**\n\nfile=\/src\/Services\/SwaggerService.php, line=999, function=checkEmail, class=RonasIT\\AutoDoc\\Services\\SwaggerService, type=->, args=[]\n---", "version": "0.0.0", "title": "Name of Your Application", "termsOfService": "", diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index a4efb182..497ab12d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index 283f9288..ca505eae 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index 97bda741..f7edcb4a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index 24e9b137..4260f82c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index aeac17b4..d97ab16a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index 777704ae..27cb7ff9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index 5cd58a07..b30a1771 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index fd840cb1..43432d5b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index 8bc521ad..cb8ba38a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index 75c8b8ee..0bf41111 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index c6e36708..4cae7ff3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 7ee61ea5..51d4f69d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=MockClass, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=MockClass, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index a8af1bf6..855ad952 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index 3b6771c9..e3085d3f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index a780b7c0..1c19c7f3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index 5a7cabf9..d332bd91 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index 66ced634..a71f2c82 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index 8eac3285..16511e5e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index 9336bbea..f577df16 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index e80ebda9..347e99c6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index de59ebb8..51f44d2a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 7e5fe86e..228657f6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index 24170790..8c3f08cc 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index 7274f18c..5b10e3df 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index 6d33da78..782ca34b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index 641df7c6..be45334f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index bc2dbdb3..a40ab989 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index bf317e29..d1450f4c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index 2a70611d..bbe5b4bd 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index 0db80265..ebfd7c9a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index e3d72f11..5c0f44cd 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index 719073a9..771a4b12 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index 7c1bbc77..338b923f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index e33b2902..2ecc341b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index ed0f59cd..06889e32 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/app/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 33e93943..5c4026be 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -39,7 +39,7 @@ protected function getTraceInfoInArray(string $traceInfo): array $errorPlaceInArray[$key] = match ($key) { 'line' => 'line=999', 'class' => Str::contains($value, 'MockObject') ? 'class=MockClass' : $value, - 'file' => $this->normalizeFilePath($value), + 'file' => 'file=/src' . Str::after($value, '/src'), default => $value, }; } From a48313b124277994c1d99a71bce9a6aed1776811 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 8 Oct 2025 14:26:22 +0300 Subject: [PATCH 22/62] fix:tests --- tests/SwaggerServiceTest.php | 11 ++++++++++- ...hp_8.4_invalid_format_missing_external_ref.html | 14 ++++++++++++++ .../php_8.4_invalid_format_missing_local_ref.html | 14 ++++++++++++++ .../php_8.4_invalid_format_missing_ref_file.html | 14 ++++++++++++++ tests/support/Traits/TraceMockTrait.php | 14 ++++++++++++++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_external_ref.html create mode 100644 tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_local_ref.html create mode 100644 tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_ref_file.html diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 0ca3028e..78df94a2 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -187,14 +187,17 @@ public static function getConstructorInvalidTmpData(): array [ 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', 'fixture' => 'invalid_format_missing_local_ref.html', + 'eight_dot_four_fixture' => 'php_8.4_invalid_format_missing_local_ref.html' ], [ 'tmpDoc' => 'documentation/invalid_format__missing_external_ref', 'fixture' => 'invalid_format_missing_external_ref.html', + 'eight_dot_four_fixture' => 'php_8.4_invalid_format_missing_external_ref.html' ], [ 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', 'fixture' => 'invalid_format_missing_ref_file.html', + 'eight_dot_four_fixture' => 'php_8.4_invalid_format_missing_ref_file.html' ], [ 'tmpDoc' => 'documentation/invalid_format__invalid_schema_type', @@ -235,6 +238,7 @@ public static function getConstructorInvalidTmpData(): array public function testGetDocFileContentInvalidTmpData( string $tmpDoc, string $fixture, + ?string $eight_dot_four_fixture = null, ) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); @@ -242,7 +246,12 @@ public function testGetDocFileContentInvalidTmpData( $this->mockGetTrace($content['info']['description']); - $this->assertEqualsFixture($fixture, $content['info']['description']); + if (!empty($eight_dot_four_fixture) + && version_compare(PHP_VERSION, '8.4.0', '>=')) { + $this->assertEqualsFixture($eight_dot_four_fixture, $content['info']['description']); + } else { + $this->assertEqualsFixture($fixture, $content['info']['description']); + } } public function testEmptyContactEmail() diff --git a/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_external_ref.html b/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_external_ref.html new file mode 100644 index 00000000..1b2206de --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_external_ref.html @@ -0,0 +1,14 @@ +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingExternalRefException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Ref 'authloginObject' is used in $ref but not defined in 'tests/fixtures/SwaggerServiceTest/documentation/with_definitions.json' file. + +### **Error place:** + +function={closure:RonasIT\AutoDoc\Validators\SwaggerSpecValidator::validateRefs():1}, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["tests\/fixtures\/SwaggerServiceTest\/documentation\/with_definitions.json#\/definitions\/authloginObject","$ref"] +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_local_ref.html b/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_local_ref.html new file mode 100644 index 00000000..227d8633 --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_local_ref.html @@ -0,0 +1,14 @@ +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingLocalRefException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Ref 'loginObject' is used in $ref but not defined in 'definitions' field. + +### **Error place:** + +function={closure:RonasIT\AutoDoc\Validators\SwaggerSpecValidator::validateRefs():1}, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["#\/definitions\/loginObject","$ref"] +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_ref_file.html b/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_ref_file.html new file mode 100644 index 00000000..5ce8effe --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/php_8.4_invalid_format_missing_ref_file.html @@ -0,0 +1,14 @@ +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\SpecValidation\MissingRefFileException 🚨🚨 + +--- + +### **Details:** + +Validation failed. Filename 'invalid-filename.json' is used in $ref but file doesn't exist. + +### **Error place:** + +function={closure:RonasIT\AutoDoc\Validators\SwaggerSpecValidator::validateRefs():1}, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["invalid-filename.json","$ref"] +--- \ No newline at end of file diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 5c4026be..13d39633 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -40,6 +40,7 @@ protected function getTraceInfoInArray(string $traceInfo): array 'line' => 'line=999', 'class' => Str::contains($value, 'MockObject') ? 'class=MockClass' : $value, 'file' => 'file=/src' . Str::after($value, '/src'), + 'function' => $this->normalizeClosureFormat($value), default => $value, }; } @@ -55,4 +56,17 @@ protected function normalizeFilePath(string $filePath): string return $filePath; } + + protected function normalizeClosureFormat(string $function): string + { + if (Str::contains($function, 'closure:')) { + $functionInArray = explode(':', $function); + + Arr::set($functionInArray, array_key_last($functionInArray), '1}'); + + return implode(':', $functionInArray); + } + + return $function; + } } \ No newline at end of file From 66d89d1bb60989ef373d140037a786869d0759d3 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 8 Oct 2025 14:28:06 +0300 Subject: [PATCH 23/62] chore: add todo --- tests/SwaggerServiceTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 78df94a2..332e31d5 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -184,6 +184,7 @@ public static function getConstructorInvalidTmpData(): array 'tmpDoc' => 'documentation/invalid_format__missing_field__tag_name', 'fixture' => 'invalid_format_missing_field_tag_name.html', ], + // TODO: Remove 8.4 fixture after php update [ 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', 'fixture' => 'invalid_format_missing_local_ref.html', From b36f48e3763879f896839306fed641602963c91d Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 8 Oct 2025 14:32:23 +0300 Subject: [PATCH 24/62] style: fix --- tests/support/Traits/TraceMockTrait.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 13d39633..57f82765 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -62,7 +62,11 @@ protected function normalizeClosureFormat(string $function): string if (Str::contains($function, 'closure:')) { $functionInArray = explode(':', $function); - Arr::set($functionInArray, array_key_last($functionInArray), '1}'); + Arr::set( + array: $functionInArray, + key: Str::between(array_key_last($functionInArray), ':', '}'), + value: '1' + ); return implode(':', $functionInArray); } From 3a761392f96743af73a14f756aec31560dbd3a6a Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 8 Oct 2025 14:34:21 +0300 Subject: [PATCH 25/62] fix: remove last changes --- tests/support/Traits/TraceMockTrait.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 57f82765..13d39633 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -62,11 +62,7 @@ protected function normalizeClosureFormat(string $function): string if (Str::contains($function, 'closure:')) { $functionInArray = explode(':', $function); - Arr::set( - array: $functionInArray, - key: Str::between(array_key_last($functionInArray), ':', '}'), - value: '1' - ); + Arr::set($functionInArray, array_key_last($functionInArray), '1}'); return implode(':', $functionInArray); } From 8c953470541ef458279c7c4ce3bcd115a54f25e6 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 8 Oct 2025 14:46:49 +0300 Subject: [PATCH 26/62] style: fix --- tests/support/Traits/TraceMockTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index 13d39633..a549c50e 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -13,7 +13,7 @@ protected function mockGetTrace(string &$content): void $traceInfo = Arr::first( array: $contentInArray, - callback: fn ($value, $key) => Str::contains($value, 'function=') + callback: fn ($value) => Str::contains($value, 'function=') ); $traceInfoInArray = $this->getTraceInfoInArray($traceInfo); @@ -31,7 +31,7 @@ protected function getTraceInfoInArray(string $traceInfo): array { $errorPlaceInArray = explode(', ', $traceInfo); $errorPlaceInArray = array_combine( - keys: Arr::map($errorPlaceInArray, fn ($value, $key) => Str::before($value, '=')), + keys: Arr::map($errorPlaceInArray, fn ($value) => Str::before($value, '=')), values: $errorPlaceInArray ); From 88a7aee745ecd41cd26e92ae91584af26badb8f7 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 8 Oct 2025 15:08:20 +0300 Subject: [PATCH 27/62] style:fix --- tests/support/Traits/TraceMockTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php index a549c50e..2191ed6d 100644 --- a/tests/support/Traits/TraceMockTrait.php +++ b/tests/support/Traits/TraceMockTrait.php @@ -13,7 +13,7 @@ protected function mockGetTrace(string &$content): void $traceInfo = Arr::first( array: $contentInArray, - callback: fn ($value) => Str::contains($value, 'function=') + callback: fn ($value) => Str::contains($value, 'function='), ); $traceInfoInArray = $this->getTraceInfoInArray($traceInfo); @@ -21,7 +21,7 @@ protected function mockGetTrace(string &$content): void $mockedContent = Arr::set( array: $contentInArray, key: array_search($traceInfo, $contentInArray), - value: implode(', ', $traceInfoInArray) + value: implode(', ', $traceInfoInArray), ); $content = implode(PHP_EOL, $mockedContent); @@ -32,7 +32,7 @@ protected function getTraceInfoInArray(string $traceInfo): array $errorPlaceInArray = explode(', ', $traceInfo); $errorPlaceInArray = array_combine( keys: Arr::map($errorPlaceInArray, fn ($value) => Str::before($value, '=')), - values: $errorPlaceInArray + values: $errorPlaceInArray, ); foreach ($errorPlaceInArray as $key => $value) { From 247de392647a0d88821bf138d558dec91579f3cd Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Thu, 9 Oct 2025 16:02:58 +0300 Subject: [PATCH 28/62] fix: remove useless --- src/Services/SwaggerService.php | 17 ------------- tests/AutoDocControllerTest.php | 21 +--------------- .../documentation_without_email.json | 25 ------------------- .../invalid_contact_email_format.html | 11 -------- 4 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 tests/fixtures/AutoDocControllerTest/documentation_without_email.json delete mode 100644 tests/fixtures/SwaggerServiceTest/invalid_contact_email_format.html diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 50ca44bd..e125da55 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -89,23 +89,6 @@ public function __construct(Container $container) $this->driver->saveProcessTmpData($this->data); } - } else { - try { - $this->checkEmail(); - } catch (EmptyContactEmailException $exception) { - $this->data = $this->generateEmptyData( - $this->config['defaults']['error'], - [ - 'message' => $exception->getMessage(), - 'type' => $exception::class, - 'error_place' => $this->getErrorPlace($exception), - ], - ); - - $this->driver->saveProcessTmpData($this->data); - - $this->driver->saveData(); - } } } diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index 8a39cd95..cf9141d8 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -4,11 +4,10 @@ use Illuminate\Http\Response; use phpmock\phpunit\PHPMock; -use RonasIT\AutoDoc\Tests\Support\Traits\TraceMockTrait; class AutoDocControllerTest extends TestCase { - use PHPMock, TraceMockTrait; + use PHPMock; protected static array $documentation; protected static string $localDriverFilePath; @@ -41,24 +40,6 @@ public function testGetJSONDocumentation() $response->assertJson(self::$documentation); } - public function testGetJSONWithoutEmailDocumentation() - { - config([ - 'auto-doc.info.contact.email' => null, - 'app.env' => 'development', - ]); - - $response = $this->json('get', '/auto-doc/documentation'); - - $response->assertStatus(Response::HTTP_OK); - - $content = $response->json(); - - $this->mockGetTrace($content['info']['description']); - - $this->assertEqualsJsonFixture('documentation_without_email', $content); - } - public function testGetJSONDocumentationWithAdditionalPaths() { config([ diff --git a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json b/tests/fixtures/AutoDocControllerTest/documentation_without_email.json deleted file mode 100644 index 382b20c2..00000000 --- a/tests/fixtures/AutoDocControllerTest/documentation_without_email.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "openapi": "3.1.0", - "servers": [ - { - "url": "http:\/\/localhost" - } - ], - "paths": [], - "components": { - "schemas": [] - }, - "info": { - "description": "# ❗️ **ERROR** ❗️\n\n## 🚨🚨 RonasIT\\AutoDoc\\Exceptions\\EmptyContactEmailException 🚨🚨\n\n---\n\n### **Details:**\n\nPlease fill the `info.contact.email` field in the app-doc.php config file.\n\n### **Error place:**\n\nfile=\/src\/Services\/SwaggerService.php, line=999, function=checkEmail, class=RonasIT\\AutoDoc\\Services\\SwaggerService, type=->, args=[]\n---", - "version": "0.0.0", - "title": "Name of Your Application", - "termsOfService": "", - "contact": { - "email": null - }, - "license": { - "name": "", - "url": "" - } - } -} \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_contact_email_format.html b/tests/fixtures/SwaggerServiceTest/invalid_contact_email_format.html deleted file mode 100644 index 8162a684..00000000 --- a/tests/fixtures/SwaggerServiceTest/invalid_contact_email_format.html +++ /dev/null @@ -1,11 +0,0 @@ -# ❗️ **ERROR** ❗️ - -## 🚨🚨 RonasIT\AutoDoc\Exceptions\EmptyContactEmailException 🚨🚨 - ---- - -### **Details:** - -Please fill the `info.contact.email` field in the app-doc.php config file. - ---- \ No newline at end of file From b3fc2f79c6586fe5e7e0eea349b65d47a1fe43d9 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 14 Oct 2025 16:22:19 +0300 Subject: [PATCH 29/62] refactor: add throwable in documentation driver --- composer.json | 2 +- composer.lock | 18 +- src/Drivers/LocalDriver.php | 10 + src/Drivers/RemoteDriver.php | 9 +- src/Drivers/StorageDriver.php | 10 + src/Exceptions/NonJSONDocFileException.php | 13 + src/Services/SwaggerService.php | 7 +- tests/LocalDriverTest.php | 22 +- tests/RemoteDriverTest.php | 22 + tests/StorageDriverTest.php | 20 + tests/SwaggerServiceTest.php | 21 +- tests/TestCase.php | 5 - .../invalid_prod_json_data.json | 343 ++++++++++++ .../invalid_prod_json_data.json | 343 ++++++++++++ .../invalid_prod_json_data.json | 343 ++++++++++++ .../empty_prod_documentation.json | 0 ...rrect_documentation_structure_request.json | 511 ++++++++---------- .../empty_prod_documentation.html | 14 + ...rrect_documentation_structure_request.html | 6 +- .../Traits/SwaggerServiceMockTrait.php | 2 +- 20 files changed, 1405 insertions(+), 316 deletions(-) create mode 100644 src/Exceptions/NonJSONDocFileException.php create mode 100644 tests/fixtures/LocalDriverTest/invalid_prod_json_data.json create mode 100644 tests/fixtures/RemoteDriverTest/invalid_prod_json_data.json create mode 100644 tests/fixtures/StorageDriverTest/invalid_prod_json_data.json create mode 100644 tests/fixtures/SwaggerServiceTest/documentation/empty_prod_documentation.json create mode 100644 tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html diff --git a/composer.json b/composer.json index 10c0ca53..b5788056 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "orchestra/testbench": ">=9.3", "php-coveralls/php-coveralls": "^2.7", "php-mock/php-mock-phpunit": ">=2.10", - "ronasit/laravel-helpers": "^3.4" + "ronasit/laravel-helpers": "^3.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ab4fb7b9..357b588e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6649148cf8a8b2e6d835a0a49f845589", + "content-hash": "5f6eb8551a6eb860f46af5549ff0285b", "packages": [ { "name": "brick/math", @@ -9345,16 +9345,16 @@ }, { "name": "ronasit/laravel-helpers", - "version": "3.4.2", + "version": "3.5.8", "source": { "type": "git", "url": "https://github.com/RonasIT/laravel-helpers.git", - "reference": "287d5e3a3af61a34ae58efbd69d2780a935c5ab4" + "reference": "b2ef76134afd66dedb5a956712f1bd1b483ef9c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/RonasIT/laravel-helpers/zipball/287d5e3a3af61a34ae58efbd69d2780a935c5ab4", - "reference": "287d5e3a3af61a34ae58efbd69d2780a935c5ab4", + "url": "https://api.github.com/repos/RonasIT/laravel-helpers/zipball/b2ef76134afd66dedb5a956712f1bd1b483ef9c1", + "reference": "b2ef76134afd66dedb5a956712f1bd1b483ef9c1", "shasum": "" }, "require": { @@ -9420,9 +9420,9 @@ ], "support": { "issues": "https://github.com/RonasIT/laravel-helpers/issues", - "source": "https://github.com/RonasIT/laravel-helpers/tree/3.4.2" + "source": "https://github.com/RonasIT/laravel-helpers/tree/3.5.8" }, - "time": "2025-05-26T03:41:09+00:00" + "time": "2025-10-08T08:37:24+00:00" }, { "name": "symfony/config", @@ -9778,13 +9778,13 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": "^8.3", "ext-json": "*" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/src/Drivers/LocalDriver.php b/src/Drivers/LocalDriver.php index b5d6288e..234a0fb9 100755 --- a/src/Drivers/LocalDriver.php +++ b/src/Drivers/LocalDriver.php @@ -4,6 +4,8 @@ use RonasIT\AutoDoc\Exceptions\FileNotFoundException; use RonasIT\AutoDoc\Exceptions\MissedProductionFilePathException; +use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; +use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; class LocalDriver extends BaseDriver { @@ -35,6 +37,14 @@ public function getDocumentation(): array $fileContent = file_get_contents($this->prodFilePath); + if (empty($fileContent)) { + throw new EmptyDocFileException($this->prodFilePath); + } + + if (!json_validate(file_get_contents($this->prodFilePath))) { + throw new NonJSONDocFileException($this->prodFilePath); + } + return json_decode($fileContent, true); } } diff --git a/src/Drivers/RemoteDriver.php b/src/Drivers/RemoteDriver.php index 34792410..9c59d252 100755 --- a/src/Drivers/RemoteDriver.php +++ b/src/Drivers/RemoteDriver.php @@ -4,6 +4,7 @@ use RonasIT\AutoDoc\Exceptions\FileNotFoundException; use RonasIT\AutoDoc\Exceptions\MissedRemoteDocumentationUrlException; +use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; class RemoteDriver extends BaseDriver { @@ -39,7 +40,13 @@ public function getDocumentation(): array throw new FileNotFoundException(); } - return json_decode($content, true); + $content = json_decode($content, true); + + if (!json_validate($content)) { + throw new NonJSONDocFileException('Remote documentation'); + } + + return $content; } protected function getUrl(): string diff --git a/src/Drivers/StorageDriver.php b/src/Drivers/StorageDriver.php index 71cd95d6..a2d52ddf 100755 --- a/src/Drivers/StorageDriver.php +++ b/src/Drivers/StorageDriver.php @@ -6,6 +6,8 @@ use Illuminate\Contracts\Filesystem\Filesystem; use Illuminate\Support\Facades\Storage; use RonasIT\AutoDoc\Exceptions\MissedProductionFilePathException; +use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; +use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; class StorageDriver extends BaseDriver { @@ -39,6 +41,14 @@ public function getDocumentation(): array $fileContent = $this->disk->get($this->prodFilePath); + if (empty($fileContent)) { + throw new EmptyDocFileException($this->prodFilePath); + } + + if (!json_validate($fileContent)) { + throw new NonJSONDocFileException($this->prodFilePath); + } + return json_decode($fileContent, true); } } diff --git a/src/Exceptions/NonJSONDocFileException.php b/src/Exceptions/NonJSONDocFileException.php new file mode 100644 index 00000000..907e034c --- /dev/null +++ b/src/Exceptions/NonJSONDocFileException.php @@ -0,0 +1,13 @@ +openAPIValidator->validate($documentation); } catch (Throwable $exception) { - $message = ($exception instanceof Exception) - ? $exception->getMessage() - : __('validation.unhandled_error_message'); - return $this->generateEmptyData( $this->config['defaults']['error'], [ - 'message' => $message, + 'message' => $exception->getMessage(), 'type' => $exception::class, 'error_place' => $this->getErrorPlace($exception), ] diff --git a/tests/LocalDriverTest.php b/tests/LocalDriverTest.php index bd599fcd..0be98e21 100755 --- a/tests/LocalDriverTest.php +++ b/tests/LocalDriverTest.php @@ -5,6 +5,8 @@ use RonasIT\AutoDoc\Drivers\LocalDriver; use RonasIT\AutoDoc\Exceptions\FileNotFoundException; use RonasIT\AutoDoc\Exceptions\MissedProductionFilePathException; +use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; +use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; class LocalDriverTest extends TestCase { @@ -37,7 +39,7 @@ public function testSaveProcessTmpData() public function testSaveProcessTmpDataCheckTokenBasedPath() { - $this->mockParallelTestingToken(); + $this->mockParallelTestingToken('workerID'); $processTempFilePath = __DIR__ . '/../storage/temp_documentation_workerID.json'; @@ -124,6 +126,24 @@ public function testGetDocumentation() $this->assertEqualsJsonFixture('tmp_data', $documentation); } + public function testGetEmptyDocumentation(): void + { + file_put_contents(self::$productionFilePath, ''); + + $this->assertExceptionThrew(EmptyDocFileException::class, "Doc file '/app/tests/../storage/documentation.json' is empty."); + + self::$localDriverClass->getDocumentation(); + } + + public function testGetInvalidJsonDocumentation(): void + { + file_put_contents(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); + + $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file '/app/tests/../storage/documentation.json' is not a json doc file."); + + self::$localDriverClass->getDocumentation(); + } + public function testGetDocumentationFileNotExists() { $this->assertExceptionThrew(FileNotFoundException::class, 'Documentation file not found not_exists_file'); diff --git a/tests/RemoteDriverTest.php b/tests/RemoteDriverTest.php index 374ec6ca..029a91bc 100755 --- a/tests/RemoteDriverTest.php +++ b/tests/RemoteDriverTest.php @@ -5,6 +5,7 @@ use RonasIT\AutoDoc\Drivers\RemoteDriver; use RonasIT\AutoDoc\Exceptions\MissedRemoteDocumentationUrlException; use RonasIT\AutoDoc\Exceptions\FileNotFoundException; +use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; class RemoteDriverTest extends TestCase { @@ -146,6 +147,27 @@ public function testGetDocumentation() $this->assertEquals(self::$tmpData, $documentation); } + public function testGetInvalidJsonDocumentation(): void + { + $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file 'Remote documentation' is not a json doc file."); + + config(['auto-doc.drivers.remote.key' => 'mocked_key']); + config(['auto-doc.drivers.remote.url' => 'mocked_url']); + + $mock = $this->mockClass(RemoteDriver::class, [ + $this->functionCall( + name: 'makeHttpRequest', + arguments: [ + 'get', + 'mocked_url/documentations/mocked_key', + ], + result: [$this->getFixture('invalid_prod_json_data.json'), 200], + ), + ]); + + $mock->getDocumentation(); + } + public function testGetDocumentationNoFile() { $this->assertExceptionThrew(FileNotFoundException::class, 'Documentation file not found '); diff --git a/tests/StorageDriverTest.php b/tests/StorageDriverTest.php index 1472cd7e..24e3e4c0 100755 --- a/tests/StorageDriverTest.php +++ b/tests/StorageDriverTest.php @@ -7,6 +7,8 @@ use Illuminate\Support\Facades\Storage; use RonasIT\AutoDoc\Drivers\StorageDriver; use RonasIT\AutoDoc\Exceptions\MissedProductionFilePathException; +use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; +use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; class StorageDriverTest extends TestCase { @@ -118,6 +120,24 @@ public function testGetDocumentation() $this->assertEqualsJsonFixture('tmp_data', $documentation); } + public function testGetEmptyDocumentation(): void + { + $this->disk->put(self::$productionFilePath, ''); + + $this->assertExceptionThrew(EmptyDocFileException::class, "Doc file 'documentation.json' is empty."); + + self::$storageDriverClass->getDocumentation(); + } + + public function testGetInvalidJsonDocumentation(): void + { + $this->disk->put(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); + + $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file 'documentation.json' is not a json doc file."); + + self::$storageDriverClass->getDocumentation(); + } + public function testGetDocumentationFileNotExists() { $this->assertExceptionThrew(FileNotFoundException::class, 'Documentation file not found documentation.json'); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 332e31d5..7e2b2277 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -229,7 +229,11 @@ public static function getConstructorInvalidTmpData(): array 'fixture' => 'invalid_format_response_invalid_items.html', ], [ - 'tmpDoc' => 'documentation/tmp_data_incorrect_documentation_structure_request', + 'prodDoc' => 'documentation/empty_prod_documentation', + 'fixture' => 'empty_prod_documentation.html', + ], + [ + 'prodDoc' => 'documentation/tmp_data_incorrect_documentation_structure_request', 'fixture' => 'invalid_format_incorrect_documentation_structure_request.html', ], ]; @@ -237,11 +241,18 @@ public static function getConstructorInvalidTmpData(): array #[DataProvider('getConstructorInvalidTmpData')] public function testGetDocFileContentInvalidTmpData( - string $tmpDoc, string $fixture, + ?string $tmpDoc = null, + ?string $prodDoc = null, ?string $eight_dot_four_fixture = null, ) { - $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); + if (!empty($prodDoc)) { + $prodDocPath = base_path("tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"); + + file_put_contents('/app/tests/../storage/documentation.json', file_get_contents($prodDocPath)); + } else { + $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); + } $content = app(SwaggerService::class)->getDocFileContent(); @@ -874,7 +885,7 @@ public function testAddDataDescriptionForRouteConditionals() public function testMergeTempDocumentation() { - $this->mockParallelTestingToken(); + $this->mockParallelTestingToken('workerID'); $this->fillTempFile($this->getFixture('tmp_data_post_user_request.json')); @@ -889,7 +900,7 @@ public function testMergeTempDocumentation() public function testMergeToEmptyTempDocumentation() { - $this->mockParallelTestingToken(); + $this->mockParallelTestingToken('workerID'); $this->fillTempFile(''); diff --git a/tests/TestCase.php b/tests/TestCase.php index 89d4cc0f..363c845d 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -209,9 +209,4 @@ protected function addGlobalPrefix($prefix = '/global') $this->setUp(); } - - protected function mockParallelTestingToken(string $token = 'workerID'): void - { - ParallelTesting::resolveTokenUsing(fn () => $token); - } } diff --git a/tests/fixtures/LocalDriverTest/invalid_prod_json_data.json b/tests/fixtures/LocalDriverTest/invalid_prod_json_data.json new file mode 100644 index 00000000..62943724 --- /dev/null +++ b/tests/fixtures/LocalDriverTest/invalid_prod_json_data.json @@ -0,0 +1,343 @@ +{ + "openapi": "3.1.0", + "host": "localhost", + "basePath": "\/", + "schemes": [], + "paths": { + "\/auth\/login": { + "post": { + "tags": [ + "auth" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "You have entered an incorrect credentials." + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + } + } + } + } + }, + "security": [], + "description": "", + "summary": "login" + }, + "get": { + "tags": [ + "auth" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "application/json": { + "schema": { + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } + }, + "type": "object" + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "example": { + "error": "You have entered an incorrect credentials." + }, + "type": "object" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + }, + "type": "object" + } + } + } + } + }, + "security": [], + "description": "", + "summary": "login" + } + }, + "\/api\/users": { + "post": { + "tags": [ + "api" + ], + "consumes": [ + "application\/x-www-form-urlencoded" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/apiusersObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "example": { + "message": "This action is unauthorized." + }, + "type": "object" + } + } + } + } + }, + "security": [], + "description": "", + "summary": "test" + } + }, + "\/users\/roles": { + "get": { + "tags": [ + "users" + ], + "consumes": [], + "produces": [ + "application\/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "example": [ + { + "id": 1, + "name": "admin", + "users": [ + { + "id": 1, + "name": "admin" + } + ] + }, + { + "id": 2, + "name": "client", + "users": [ + { + "id": 2, + "name": "first_client" + }, + { + "id": 3, + "name": "second_client" + } + ] + } + ] + }, + "type": "object" + } + } + } + }, + "security": [], + "description": "" + } + } + }, + "components": { + "schemas": { + "authloginObject": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "2" + }, + "password": { + "type": "string", + "description": "" + } + }, + "required": [ + "email", + "password" + ], + "example": { + "email": "admin@test.com", + "password": "123" + } + }, + "apiusersObject": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "" + } + }, + "required": [ + "query" + ], + "example": { + "first_name": "andrey", + "last_name": "voronin" + } + + } + }, + "info": { + "description": "This is automatically collected documentation", + "version": "0.0.0", + "title": "Project Title", + "termsOfService": "", + "contact": { + "email": "your@email.com" + } + + } diff --git a/tests/fixtures/RemoteDriverTest/invalid_prod_json_data.json b/tests/fixtures/RemoteDriverTest/invalid_prod_json_data.json new file mode 100644 index 00000000..62943724 --- /dev/null +++ b/tests/fixtures/RemoteDriverTest/invalid_prod_json_data.json @@ -0,0 +1,343 @@ +{ + "openapi": "3.1.0", + "host": "localhost", + "basePath": "\/", + "schemes": [], + "paths": { + "\/auth\/login": { + "post": { + "tags": [ + "auth" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "You have entered an incorrect credentials." + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + } + } + } + } + }, + "security": [], + "description": "", + "summary": "login" + }, + "get": { + "tags": [ + "auth" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "application/json": { + "schema": { + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } + }, + "type": "object" + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "example": { + "error": "You have entered an incorrect credentials." + }, + "type": "object" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + }, + "type": "object" + } + } + } + } + }, + "security": [], + "description": "", + "summary": "login" + } + }, + "\/api\/users": { + "post": { + "tags": [ + "api" + ], + "consumes": [ + "application\/x-www-form-urlencoded" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/apiusersObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "example": { + "message": "This action is unauthorized." + }, + "type": "object" + } + } + } + } + }, + "security": [], + "description": "", + "summary": "test" + } + }, + "\/users\/roles": { + "get": { + "tags": [ + "users" + ], + "consumes": [], + "produces": [ + "application\/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "example": [ + { + "id": 1, + "name": "admin", + "users": [ + { + "id": 1, + "name": "admin" + } + ] + }, + { + "id": 2, + "name": "client", + "users": [ + { + "id": 2, + "name": "first_client" + }, + { + "id": 3, + "name": "second_client" + } + ] + } + ] + }, + "type": "object" + } + } + } + }, + "security": [], + "description": "" + } + } + }, + "components": { + "schemas": { + "authloginObject": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "2" + }, + "password": { + "type": "string", + "description": "" + } + }, + "required": [ + "email", + "password" + ], + "example": { + "email": "admin@test.com", + "password": "123" + } + }, + "apiusersObject": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "" + } + }, + "required": [ + "query" + ], + "example": { + "first_name": "andrey", + "last_name": "voronin" + } + + } + }, + "info": { + "description": "This is automatically collected documentation", + "version": "0.0.0", + "title": "Project Title", + "termsOfService": "", + "contact": { + "email": "your@email.com" + } + + } diff --git a/tests/fixtures/StorageDriverTest/invalid_prod_json_data.json b/tests/fixtures/StorageDriverTest/invalid_prod_json_data.json new file mode 100644 index 00000000..62943724 --- /dev/null +++ b/tests/fixtures/StorageDriverTest/invalid_prod_json_data.json @@ -0,0 +1,343 @@ +{ + "openapi": "3.1.0", + "host": "localhost", + "basePath": "\/", + "schemes": [], + "paths": { + "\/auth\/login": { + "post": { + "tags": [ + "auth" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "You have entered an incorrect credentials." + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + } + } + } + } + }, + "security": [], + "description": "", + "summary": "login" + }, + "get": { + "tags": [ + "auth" + ], + "consumes": [ + "application\/json" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "200": { + "description": "Operation successfully done", + "content": { + "application/json": { + "schema": { + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } + }, + "type": "object" + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "example": { + "error": "You have entered an incorrect credentials." + }, + "type": "object" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + }, + "type": "object" + } + } + } + } + }, + "security": [], + "description": "", + "summary": "login" + } + }, + "\/api\/users": { + "post": { + "tags": [ + "api" + ], + "consumes": [ + "application\/x-www-form-urlencoded" + ], + "produces": [ + "application\/json" + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/apiusersObject" + } + } + }, + "required": true, + "description": "" + }, + "responses": { + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "example": { + "message": "This action is unauthorized." + }, + "type": "object" + } + } + } + } + }, + "security": [], + "description": "", + "summary": "test" + } + }, + "\/users\/roles": { + "get": { + "tags": [ + "users" + ], + "consumes": [], + "produces": [ + "application\/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "example": [ + { + "id": 1, + "name": "admin", + "users": [ + { + "id": 1, + "name": "admin" + } + ] + }, + { + "id": 2, + "name": "client", + "users": [ + { + "id": 2, + "name": "first_client" + }, + { + "id": 3, + "name": "second_client" + } + ] + } + ] + }, + "type": "object" + } + } + } + }, + "security": [], + "description": "" + } + } + }, + "components": { + "schemas": { + "authloginObject": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "2" + }, + "password": { + "type": "string", + "description": "" + } + }, + "required": [ + "email", + "password" + ], + "example": { + "email": "admin@test.com", + "password": "123" + } + }, + "apiusersObject": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "" + } + }, + "required": [ + "query" + ], + "example": { + "first_name": "andrey", + "last_name": "voronin" + } + + } + }, + "info": { + "description": "This is automatically collected documentation", + "version": "0.0.0", + "title": "Project Title", + "termsOfService": "", + "contact": { + "email": "your@email.com" + } + + } diff --git a/tests/fixtures/SwaggerServiceTest/documentation/empty_prod_documentation.json b/tests/fixtures/SwaggerServiceTest/documentation/empty_prod_documentation.json new file mode 100644 index 00000000..e69de29b diff --git a/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json b/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json index df9611dd..3f9efc3d 100644 --- a/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json +++ b/tests/fixtures/SwaggerServiceTest/documentation/tmp_data_incorrect_documentation_structure_request.json @@ -1,15 +1,13 @@ { "openapi": "3.1.0", - "servers": [ - { - "url": "https:\/\/localhost" - } - ], + "host": "localhost", + "basePath": "\/", + "schemes": [], "paths": { - "\/v{version}\/media": { + "\/auth\/login": { "post": { "tags": [ - "v{version}" + "auth" ], "consumes": [ "application\/json" @@ -17,37 +15,55 @@ "produces": [ "application\/json" ], - "parameters": [ - { - "in": "path", - "name": "version", - "description": "in: 0.1,0.2", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } } - } - ], + }, + "required": true, + "description": "" + }, "responses": { - "201": { - "description": "Created", + "200": { + "description": "Operation successfully done", "content": { - "application\/json": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/postV{version}media201ResponseObject" + "type": "object" }, "example": { - "id": 20, - "link": "https:\/\/localhost\/v0.2\/media\/20\/content", - "created_at": "2018-11-11T11:11:11.000000Z", - "preview": { - "id": 19, - "link": "https:\/\/localhost\/v0.2\/media\/19\/content", - "created_at": "2018-11-11T11:11:11.000000Z", - "blur_hash": null + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } }, - "blur_hash": "L00000fQfQfQfQfQfQfQfQfQfQfQ" + "ttl": 60, + "refresh_ttl": 20160 } } } @@ -55,13 +71,25 @@ "401": { "description": "Unauthorized", "content": { - "application\/json": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/postV{version}media401ResponseObject" + "type": "object" }, "example": { - "message": "Unauthenticated." + "error": "You have entered an incorrect credentials." + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." } } } @@ -69,104 +97,93 @@ }, "security": [], "description": "", - "deprecated": false, - "requestBody": { - "content": { - "application\/json": { - "schema": { - "$ref": "#\/components\/schemas\/v{version}mediaObject" - } - } - }, - "description": "", - "required": true - }, - "summary": "create media" - } - }, - "\/v{version}\/media\/{id}\/content": { + "summary": "login" + }, "get": { "tags": [ - "v{version}" + "auth" ], "consumes": [ "application\/json" ], "produces": [ - "image\/jpeg", "application\/json" ], - "parameters": [ - { - "in": "path", - "name": "version", - "description": "in: 0.1,0.2", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/authloginObject" + } } }, - { - "in": "path", - "name": "id", - "description": "regexp: [0-9]+", - "required": true, - "schema": { - "type": "string" - } - } - ], + "required": true, + "description": "" + }, "responses": { "200": { "description": "Operation successfully done", "content": { - "image\/jpeg": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/getV{version}media{id}content200ResponseObject" + "example": { + "token": "some_token", + "user": { + "id": 2, + "email": "user@test.com", + "deleted_at": null, + "created_at": "2017-11-16 06:08:34", + "updated_at": "2018-01-01 00:00:00", + "role_id": 2, + "state": "confirmed", + "reset_password_hash": null, + "failed_auth_attempts": 0, + "last_auth_attempt": "2018-01-01 00:00:00", + "first_name": "user", + "last_name": null, + "set_password_hash_created_at": null, + "full_name": "user", + "new_email": "new_email_test2@test.com", + "is_email_verified": true, + "role": { + "id": 2, + "name": "client", + "created_at": null, + "updated_at": null, + "settable": true + } + }, + "ttl": 60, + "refresh_ttl": 20160 + } }, - "example": "[]" - } - } - }, - "429": { - "description": "Too Many Requests", - "content": { - "application\/json": { - "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/getV{version}media{id}content429ResponseObject" - }, - "example": { - "message": "Too Many Attempts." - } + "type": "object" } } }, - "403": { - "description": "Forbidden", + "401": { + "description": "Unauthorized", "content": { - "application\/json": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/getV{version}media{id}content403ResponseObject" - }, - "example": { - "message": "This action is unauthorized." + "example": { + "error": "You have entered an incorrect credentials." + }, + "type": "object" } } } }, - "404": { - "description": "This entity not found", + "400": { + "description": "Bad Request", "content": { - "application\/json": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/getV{version}media{id}content404ResponseObject" - }, - "example": { - "message": "Media does not exist" + "example": { + "error": "The limit of failed authorization attempts has been reached. You can't login in next 50 minutes." + }, + "type": "object" } } } @@ -174,43 +191,42 @@ }, "security": [], "description": "", - "deprecated": false, - "summary": "get content" + "summary": "login" } }, - "\/media\/{id}": { - "delete": { + "\/api\/users": { + "post": { "tags": [ - "media" + "api" ], "consumes": [ - "application\/json" + "application\/x-www-form-urlencoded" ], "produces": [ "application\/json" ], - "parameters": [ - { - "in": "path", - "name": "id", - "description": "", - "required": true, - "schema": { - "type": "string" + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/apiusersObject" + } } - } - ], + }, + "required": true, + "description": "" + }, "responses": { - "404": { - "description": "This entity not found", + "403": { + "description": "Forbidden", "content": { - "application\/json": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/deleteMedia{id}404ResponseObject" - }, - "example": { - "message": "Not found." + "example": { + "message": "This action is unauthorized." + }, + "type": "object" } } } @@ -218,183 +234,110 @@ }, "security": [], "description": "", - "deprecated": false, - "summary": "delete media" + "summary": "test" } }, - "\/media\/bulk": { - "post": { + "\/users\/roles": { + "get": { "tags": [ - "media" - ], - "consumes": [ - "application\/json" + "users" ], + "consumes": [], "produces": [ "application\/json" ], "parameters": [], "responses": { - "404": { - "description": "This entity not found", + "200": { + "description": "OK", "content": { - "application\/json": { + "application/json": { "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/postMediabulk404ResponseObject" + "example": [ + { + "id": 1, + "name": "admin", + "users": [ + { + "id": 1, + "name": "admin" + } + ] + }, + { + "id": 2, + "name": "client", + "users": [ + { + "id": 2, + "name": "first_client" + }, + { + "id": 3, + "name": "second_client" + } + ] + } + ] }, - "example": { - "message": "Not found." - } + "type": "object" } } } }, "security": [], - "description": "", - "deprecated": false, - "requestBody": { - "content": { - "application\/json": { - "schema": { - "$ref": "#\/components\/schemas\/mediabulkObject" - } - } - }, - "description": "", - "required": true - }, - "summary": "bulk create media" + "description": "" } - }, - "\/media": { - "get": { - "tags": [ - "media" - ], - "consumes": [ - "application\/json" - ], - "produces": [ - "application\/json" - ], - "parameters": [ - { - "in": "query", - "name": "page", - "description": "integer", - "schema": { - "type": "integer" - } - }, - { - "in": "query", - "name": "per_page", - "description": "integer", - "schema": { - "type": "integer" - } - }, - { - "in": "query", - "name": "all", - "description": "integer", - "schema": { - "type": "integer" - } - }, - { - "in": "query", - "name": "query", - "description": "string", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "order_by", - "description": "string, in:link,name", - "schema": { - "type": "string" - } - }, - { - "in": "query", - "name": "desc", - "description": "boolean", - "schema": { - "type": "boolean" - } + } + }, + "components": { + "schemas": { + "authloginObject": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "2" }, - { - "in": "query", - "name": "name", - "description": "string", - "schema": { - "type": "string" - } - } - ], - "responses": { - "404": { - "description": "This entity not found", - "content": { - "application\/json": { - "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/getMedia404ResponseObject" - }, - "example": { - "message": "Not found." - } - } - } + "password": { + "type": "string", + "description": "" } }, - "security": [], - "description": "", - "deprecated": false, - "summary": "search media" - }, - "post": { - "tags": [ - "media" + "required": [ + "email", + "password" ], - "consumes": [ - "application\/json" - ], - "produces": [ - "application\/json" - ], - "parameters": [], - "content": { - "application\/json": { - "schema": { - "type": "object", - "$ref": "#\/components\/schemas\/postMedia404ResponseObject" - }, - "example": { - "message": "Not found." - } - } + "example": { + "email": "admin@test.com", + "password": "123" } - } - }, - "security": [], - "description": "", - "deprecated": false, - "requestBody": { - "content": { - "application\/json": { - "schema": { - "$ref": "#\/components\/schemas\/mediaObject" + }, + "apiusersObject": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "" } + }, + "required": [ + "query" + ], + "example": { + "first_name": "andrey", + "last_name": "voronin" } - }, - "description": "", - "required": true - }, - "summary": "create media" - } -}}, "components": {"schemas": {"v{version}mediaObject": {"type": "object", "properties": {"file": {"type": "string", "description": "file, max:5120, mimes:jpg,jpeg,bmp,png,heic"}, "meta": {"type": "object", "description": ""}, "is_public": {"type": "boolean", "description":""}, "type": {"type": "string","description": "in:avatar,cover"}}, "required":["file"], "example": {"file": "[uploaded_file]"}},"postV{version}media201ResponseObject": {"type": "object", "properties": {"id": {"type": "integer"}, "link":{"type": "string"}, "created_at": {"type": "string"}, "preview": {"type": "array", "nullable": true}, "blur_hash": {"type": "string"}}}, "postV{version}media401ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "getV{version}media{id}content200ResponseObject": {"type": "object", "properties":[]}, "getV{version}media{id}content429ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "getV{version}media{id}content403ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "getV{version}media{id}content404ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "deleteMedia{id}404ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}, "mediabulkObject": {"type": "object", "properties": {"media": {"type": "object", "description": ""}, "media.*": {"type": "object", "description": ""}, "media.*.file": {"type": "string", "description": "file, max:5120, mimes:jpg,jpeg,bmp,png,heic"}, "media.*.meta":{"type": "object", "description": ""},"media.*.is_public": {"type": "boolean", "description": ""}}, "required":["media", "media.*.file"], "example": {"media":[{"meta":["test1"], "file": "[uploaded_file]"}, {"meta":["test2"], "file": "[uploaded_file]"}]}}, "postMediabulk404ResponseObject": {"type": "object","properties": {"message": {"type": "string"}}}, "getMedia404ResponseObject": {"type": "object","properties": {"message": {"type": "string"}}}, "mediaObject": {"type": "object","properties": {"file": {"type": "string","description": "file, max:5120, mimes:jpg,jpeg,bmp,png,heic"}, "meta": {"type":"object", "description": ""}, "is_public": {"type": "boolean", "description": ""}, "type": {"type": "string", "description": "in:avatar,cover"}}, "required":["file"], "example": {"file": "[uploaded_file]"}},"postMedia404ResponseObject": {"type": "object", "properties": {"message": {"type": "string"}}}}}, "info": {"description": "This is automatically collected documentation", "version": "0.0.0", "title": "Laravel", "termsOfService": "", "contact": {"email": "azabolotnikov@ronasit.com"}}} \ No newline at end of file + + } + }, + "info": { + "description": "This is automatically collected documentation", + "version": "0.0.0", + "title": "Project Title", + "termsOfService": "", + "contact": { + "email": "your@email.com" + } + +} diff --git a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html new file mode 100644 index 00000000..ca1b786b --- /dev/null +++ b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html @@ -0,0 +1,14 @@ +# ❗️ **ERROR** ❗️ + +## 🚨🚨 RonasIT\AutoDoc\Exceptions\EmptyDocFileException 🚨🚨 + +--- + +### **Details:** + +Doc file '/app/tests/../storage/documentation.json' is empty. + +### **Error place:** + +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +--- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 51d4f69d..167028db 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -1,14 +1,14 @@ # ❗️ **ERROR** ❗️ -## 🚨🚨 TypeError 🚨🚨 +## 🚨🚨 RonasIT\AutoDoc\Exceptions\NonJSONDocFileException 🚨🚨 --- ### **Details:** -Documentation file is empty or have bad format +Doc file '/app/tests/../storage/documentation.json' is not a json doc file. ### **Error place:** -file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=MockClass, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 8c47d2bb..8cdda6c3 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -57,7 +57,7 @@ protected function mockDriverGetDocumentation($data, $driverClass = LocalDriver: $this->mockClass($driverClass, [ $this->functionCall( name: 'getDocumentation', - result: $data + result: $data, ), ]); } From 5f0de86e47515d078f9aa26dafaa8f1688c6481f Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 14 Oct 2025 17:45:33 +0300 Subject: [PATCH 30/62] tests:fix --- src/Drivers/RemoteDriver.php | 4 +--- tests/LocalDriverTest.php | 12 ++++++++++-- tests/SwaggerServiceTest.php | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Drivers/RemoteDriver.php b/src/Drivers/RemoteDriver.php index 9c59d252..ce0be8b4 100755 --- a/src/Drivers/RemoteDriver.php +++ b/src/Drivers/RemoteDriver.php @@ -40,13 +40,11 @@ public function getDocumentation(): array throw new FileNotFoundException(); } - $content = json_decode($content, true); - if (!json_validate($content)) { throw new NonJSONDocFileException('Remote documentation'); } - return $content; + return json_decode($content, true); } protected function getUrl(): string diff --git a/tests/LocalDriverTest.php b/tests/LocalDriverTest.php index 0be98e21..9f7ebf00 100755 --- a/tests/LocalDriverTest.php +++ b/tests/LocalDriverTest.php @@ -130,7 +130,11 @@ public function testGetEmptyDocumentation(): void { file_put_contents(self::$productionFilePath, ''); - $this->assertExceptionThrew(EmptyDocFileException::class, "Doc file '/app/tests/../storage/documentation.json' is empty."); + $this->assertExceptionThrew( + expectedClassName: EmptyDocFileException::class, + expectedMessage: "Doc file '/app/tests/../storage/documentation.json' is empty.", + isStrict: false, + ); self::$localDriverClass->getDocumentation(); } @@ -139,7 +143,11 @@ public function testGetInvalidJsonDocumentation(): void { file_put_contents(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); - $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file '/app/tests/../storage/documentation.json' is not a json doc file."); + $this->assertExceptionThrew( + expectedClassName: NonJSONDocFileException::class, + expectedMessage: "Doc file '/app/tests/../storage/documentation.json' is not a json doc file.", + isStrict: false, + ); self::$localDriverClass->getDocumentation(); } diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 7e2b2277..2d139870 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -249,7 +249,7 @@ public function testGetDocFileContentInvalidTmpData( if (!empty($prodDoc)) { $prodDocPath = base_path("tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"); - file_put_contents('/app/tests/../storage/documentation.json', file_get_contents($prodDocPath)); + file_put_contents(base_path('tests/../storage/documentation.json'), file_get_contents($prodDocPath)); } else { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); } From 63a7baedb4e95e66d9d6ccb5cc952c250f069005 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 15 Oct 2025 13:25:01 +0300 Subject: [PATCH 31/62] fix: tests --- tests/LocalDriverTest.php | 12 ++---------- tests/SwaggerServiceTest.php | 8 ++++++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/LocalDriverTest.php b/tests/LocalDriverTest.php index 9f7ebf00..6197157a 100755 --- a/tests/LocalDriverTest.php +++ b/tests/LocalDriverTest.php @@ -130,11 +130,7 @@ public function testGetEmptyDocumentation(): void { file_put_contents(self::$productionFilePath, ''); - $this->assertExceptionThrew( - expectedClassName: EmptyDocFileException::class, - expectedMessage: "Doc file '/app/tests/../storage/documentation.json' is empty.", - isStrict: false, - ); + $this->assertExceptionThrew(EmptyDocFileException::class, 'Doc file ' . self::$productionFilePath . ' is empty.'); self::$localDriverClass->getDocumentation(); } @@ -143,11 +139,7 @@ public function testGetInvalidJsonDocumentation(): void { file_put_contents(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); - $this->assertExceptionThrew( - expectedClassName: NonJSONDocFileException::class, - expectedMessage: "Doc file '/app/tests/../storage/documentation.json' is not a json doc file.", - isStrict: false, - ); + $this->assertExceptionThrew(NonJSONDocFileException::class, 'Doc file ' . self::$productionFilePath . ' is not a json doc file.'); self::$localDriverClass->getDocumentation(); } diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 2d139870..26e16a01 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -247,9 +247,13 @@ public function testGetDocFileContentInvalidTmpData( ?string $eight_dot_four_fixture = null, ) { if (!empty($prodDoc)) { - $prodDocPath = base_path("tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"); + $productionFilePath = __DIR__ . '/../storage/documentation.json'; - file_put_contents(base_path('tests/../storage/documentation.json'), file_get_contents($prodDocPath)); + config(['auto-doc.drivers.local.production_path' => $productionFilePath]); + + $prodDocPath = "tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"; + + file_put_contents($productionFilePath, file_get_contents($prodDocPath)); } else { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); } From 33f932176bfae7a0b00996278241424290ec37f0 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 15 Oct 2025 15:09:52 +0300 Subject: [PATCH 32/62] fix: tests --- src/Drivers/LocalDriver.php | 5 +++-- tests/LocalDriverTest.php | 4 ++-- .../SwaggerServiceTest/empty_prod_documentation.html | 2 +- ...lid_format_incorrect_documentation_structure_request.html | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Drivers/LocalDriver.php b/src/Drivers/LocalDriver.php index 234a0fb9..b544f716 100755 --- a/src/Drivers/LocalDriver.php +++ b/src/Drivers/LocalDriver.php @@ -6,6 +6,7 @@ use RonasIT\AutoDoc\Exceptions\MissedProductionFilePathException; use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; use RonasIT\AutoDoc\Exceptions\NonJSONDocFileException; +use Symfony\Component\Filesystem\Path; class LocalDriver extends BaseDriver { @@ -38,11 +39,11 @@ public function getDocumentation(): array $fileContent = file_get_contents($this->prodFilePath); if (empty($fileContent)) { - throw new EmptyDocFileException($this->prodFilePath); + throw new EmptyDocFileException(Path::makeRelative($this->prodFilePath, base_path())); } if (!json_validate(file_get_contents($this->prodFilePath))) { - throw new NonJSONDocFileException($this->prodFilePath); + throw new NonJSONDocFileException(Path::makeRelative($this->prodFilePath, base_path())); } return json_decode($fileContent, true); diff --git a/tests/LocalDriverTest.php b/tests/LocalDriverTest.php index 6197157a..3ede2589 100755 --- a/tests/LocalDriverTest.php +++ b/tests/LocalDriverTest.php @@ -130,7 +130,7 @@ public function testGetEmptyDocumentation(): void { file_put_contents(self::$productionFilePath, ''); - $this->assertExceptionThrew(EmptyDocFileException::class, 'Doc file ' . self::$productionFilePath . ' is empty.'); + $this->assertExceptionThrew(EmptyDocFileException::class, "Doc file 'storage/documentation.json' is empty."); self::$localDriverClass->getDocumentation(); } @@ -139,7 +139,7 @@ public function testGetInvalidJsonDocumentation(): void { file_put_contents(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); - $this->assertExceptionThrew(NonJSONDocFileException::class, 'Doc file ' . self::$productionFilePath . ' is not a json doc file.'); + $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file 'storage/documentation.json' is not a json doc file."); self::$localDriverClass->getDocumentation(); } diff --git a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html index ca1b786b..cee4a3aa 100644 --- a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html +++ b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html @@ -6,7 +6,7 @@ ### **Details:** -Doc file '/app/tests/../storage/documentation.json' is empty. +Doc file 'storage/documentation.json' is empty. ### **Error place:** diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 167028db..5ce01a75 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -6,7 +6,7 @@ ### **Details:** -Doc file '/app/tests/../storage/documentation.json' is not a json doc file. +Doc file 'storage/documentation.json' is not a json doc file. ### **Error place:** From c334ebfa2de7e8f611ea2c7eeba5bae2dab78aa5 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 15 Oct 2025 15:14:34 +0300 Subject: [PATCH 33/62] fix: remove useless --- lang/en/validation.php | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 lang/en/validation.php diff --git a/lang/en/validation.php b/lang/en/validation.php deleted file mode 100644 index 18eeb1f3..00000000 --- a/lang/en/validation.php +++ /dev/null @@ -1,5 +0,0 @@ - 'Documentation file is empty or have bad format', -]; From 4a22c5d14b9670bfe966ec16d7df06d4a0cafb94 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Wed, 15 Oct 2025 15:14:34 +0300 Subject: [PATCH 34/62] fix: remove useless --- lang/en/validation.php | 5 ----- src/AutoDocServiceProvider.php | 4 +--- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 lang/en/validation.php diff --git a/lang/en/validation.php b/lang/en/validation.php deleted file mode 100644 index 18eeb1f3..00000000 --- a/lang/en/validation.php +++ /dev/null @@ -1,5 +0,0 @@ - 'Documentation file is empty or have bad format', -]; diff --git a/src/AutoDocServiceProvider.php b/src/AutoDocServiceProvider.php index 672c6fe3..05c3afd8 100644 --- a/src/AutoDocServiceProvider.php +++ b/src/AutoDocServiceProvider.php @@ -10,9 +10,7 @@ class AutoDocServiceProvider extends ServiceProvider public function boot() { $this->mergeConfigFrom(__DIR__ . '/../config/auto-doc.php', 'auto-doc'); - - $this->loadTranslationsFrom(__DIR__ . '/../lang', 'auto-doc'); - + $this->publishes([ __DIR__ . '/../config/auto-doc.php' => config_path('auto-doc.php'), ], 'config'); From bbb99541b4e903bc24859f71f56ca1e8149e55da Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 16 Oct 2025 10:01:47 +0600 Subject: [PATCH 35/62] Update src/Services/SwaggerService.php --- src/Services/SwaggerService.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 44226ea6..3f4f19f1 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -825,14 +825,11 @@ public function getDocFileContent() $this->openAPIValidator->validate($documentation); } catch (Throwable $exception) { - return $this->generateEmptyData( - $this->config['defaults']['error'], - [ - 'message' => $exception->getMessage(), - 'type' => $exception::class, - 'error_place' => $this->getErrorPlace($exception), - ] - ); + return $this->generateEmptyData($this->config['defaults']['error'], [ + 'message' => $exception->getMessage(), + 'type' => $exception::class, + 'error_place' => $this->getErrorPlace($exception), + ]); } $additionalDocs = config('auto-doc.additional_paths', []); From 2ffa2e08b56a4a0605a490f1a9a7f398c3339d91 Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 16 Oct 2025 10:03:44 +0600 Subject: [PATCH 36/62] Update src/AutoDocServiceProvider.php --- src/AutoDocServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AutoDocServiceProvider.php b/src/AutoDocServiceProvider.php index 05c3afd8..0b1c5645 100644 --- a/src/AutoDocServiceProvider.php +++ b/src/AutoDocServiceProvider.php @@ -10,7 +10,6 @@ class AutoDocServiceProvider extends ServiceProvider public function boot() { $this->mergeConfigFrom(__DIR__ . '/../config/auto-doc.php', 'auto-doc'); - $this->publishes([ __DIR__ . '/../config/auto-doc.php' => config_path('auto-doc.php'), ], 'config'); From a41dd8e377f4955c8b837f45075af3f10e52f95c Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 16 Oct 2025 10:05:48 +0600 Subject: [PATCH 37/62] Apply suggestion from @DenTray --- src/AutoDocServiceProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AutoDocServiceProvider.php b/src/AutoDocServiceProvider.php index 0b1c5645..fafd6bcb 100644 --- a/src/AutoDocServiceProvider.php +++ b/src/AutoDocServiceProvider.php @@ -10,6 +10,7 @@ class AutoDocServiceProvider extends ServiceProvider public function boot() { $this->mergeConfigFrom(__DIR__ . '/../config/auto-doc.php', 'auto-doc'); + $this->publishes([ __DIR__ . '/../config/auto-doc.php' => config_path('auto-doc.php'), ], 'config'); From deb135fb447148c557d01a671355a9221359c6eb Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 19 Oct 2025 15:50:15 +0300 Subject: [PATCH 38/62] refactor: separate invalid prod data test --- tests/SwaggerServiceTest.php | 57 +++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 26e16a01..b78e536c 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -184,7 +184,7 @@ public static function getConstructorInvalidTmpData(): array 'tmpDoc' => 'documentation/invalid_format__missing_field__tag_name', 'fixture' => 'invalid_format_missing_field_tag_name.html', ], - // TODO: Remove 8.4 fixture after php update + // TODO: Remove legacy fixtures after min php update version increased [ 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', 'fixture' => 'invalid_format_missing_local_ref.html', @@ -228,6 +228,32 @@ public static function getConstructorInvalidTmpData(): array 'tmpDoc' => 'documentation/invalid_format__response__invalid_items', 'fixture' => 'invalid_format_response_invalid_items.html', ], + ]; + } + + #[DataProvider('getConstructorInvalidTmpData')] + public function testGetDocFileContentInvalidTmpData( + string $fixture, + string $tmpDoc, + ?string $eight_dot_four_fixture = null, + ) { + $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); + + $content = app(SwaggerService::class)->getDocFileContent(); + + $this->mockGetTrace($content['info']['description']); + + if (!empty($eight_dot_four_fixture) + && version_compare(PHP_VERSION, '8.4.0', '>=')) { + $this->assertEqualsFixture($eight_dot_four_fixture, $content['info']['description']); + } else { + $this->assertEqualsFixture($fixture, $content['info']['description']); + } + } + + public static function getInvalidProdData(): array + { + return [ [ 'prodDoc' => 'documentation/empty_prod_documentation', 'fixture' => 'empty_prod_documentation.html', @@ -239,35 +265,24 @@ public static function getConstructorInvalidTmpData(): array ]; } - #[DataProvider('getConstructorInvalidTmpData')] - public function testGetDocFileContentInvalidTmpData( + #[DataProvider('getInvalidProdData')] + public function testGetDocFileContentInvalidProdData( string $fixture, - ?string $tmpDoc = null, - ?string $prodDoc = null, - ?string $eight_dot_four_fixture = null, - ) { - if (!empty($prodDoc)) { - $productionFilePath = __DIR__ . '/../storage/documentation.json'; + string $prodDoc + ): void { + $productionFilePath = __DIR__ . '/../storage/documentation.json'; - config(['auto-doc.drivers.local.production_path' => $productionFilePath]); + config(['auto-doc.drivers.local.production_path' => $productionFilePath]); - $prodDocPath = "tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"; + $prodDocPath = "tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"; - file_put_contents($productionFilePath, file_get_contents($prodDocPath)); - } else { - $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); - } + file_put_contents($productionFilePath, file_get_contents($prodDocPath)); $content = app(SwaggerService::class)->getDocFileContent(); $this->mockGetTrace($content['info']['description']); - if (!empty($eight_dot_four_fixture) - && version_compare(PHP_VERSION, '8.4.0', '>=')) { - $this->assertEqualsFixture($eight_dot_four_fixture, $content['info']['description']); - } else { - $this->assertEqualsFixture($fixture, $content['info']['description']); - } + $this->assertEqualsFixture($fixture, $content['info']['description']); } public function testEmptyContactEmail() From 9aa1c0718c520ab2851c26f248504539a4f029fa Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 26 Oct 2025 15:55:09 +0300 Subject: [PATCH 39/62] refactor: use swagger service mock, remove useless --- tests/SwaggerServiceTest.php | 68 ++++++++++++------ .../Traits/SwaggerServiceMockTrait.php | 12 ++++ tests/support/Traits/TraceMockTrait.php | 72 ------------------- 3 files changed, 59 insertions(+), 93 deletions(-) delete mode 100644 tests/support/Traits/TraceMockTrait.php diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index b78e536c..a17bb4fa 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -17,11 +17,10 @@ use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceMockTrait; use RonasIT\AutoDoc\Tests\Support\Traits\SwaggerServiceTestingTrait; use stdClass; -use RonasIT\AutoDoc\Tests\Support\Traits\TraceMockTrait; class SwaggerServiceTest extends TestCase { - use SwaggerServiceMockTrait, SwaggerServiceTestingTrait, TraceMockTrait; + use SwaggerServiceMockTrait, SwaggerServiceTestingTrait; public function testConstructorInvalidConfigVersion() { @@ -184,21 +183,17 @@ public static function getConstructorInvalidTmpData(): array 'tmpDoc' => 'documentation/invalid_format__missing_field__tag_name', 'fixture' => 'invalid_format_missing_field_tag_name.html', ], - // TODO: Remove legacy fixtures after min php update version increased [ 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', 'fixture' => 'invalid_format_missing_local_ref.html', - 'eight_dot_four_fixture' => 'php_8.4_invalid_format_missing_local_ref.html' ], [ 'tmpDoc' => 'documentation/invalid_format__missing_external_ref', 'fixture' => 'invalid_format_missing_external_ref.html', - 'eight_dot_four_fixture' => 'php_8.4_invalid_format_missing_external_ref.html' ], [ 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', 'fixture' => 'invalid_format_missing_ref_file.html', - 'eight_dot_four_fixture' => 'php_8.4_invalid_format_missing_ref_file.html' ], [ 'tmpDoc' => 'documentation/invalid_format__invalid_schema_type', @@ -235,20 +230,12 @@ public static function getConstructorInvalidTmpData(): array public function testGetDocFileContentInvalidTmpData( string $fixture, string $tmpDoc, - ?string $eight_dot_four_fixture = null, ) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); $content = app(SwaggerService::class)->getDocFileContent(); - $this->mockGetTrace($content['info']['description']); - - if (!empty($eight_dot_four_fixture) - && version_compare(PHP_VERSION, '8.4.0', '>=')) { - $this->assertEqualsFixture($eight_dot_four_fixture, $content['info']['description']); - } else { - $this->assertEqualsFixture($fixture, $content['info']['description']); - } + $this->assertExceptionHTMLEqualsFixture($fixture, $content['info']['description']); } public static function getInvalidProdData(): array @@ -280,9 +267,43 @@ public function testGetDocFileContentInvalidProdData( $content = app(SwaggerService::class)->getDocFileContent(); - $this->mockGetTrace($content['info']['description']); + $this->assertExceptionHTMLEqualsFixture($fixture, $content['info']['description']); + } - $this->assertEqualsFixture($fixture, $content['info']['description']); + // TODO: Remove legacy fixtures after min php update version increased + public static function getInvalidPhpEightDotFourData(): array + { + return [ + [ + 'tmpDoc' => 'documentation/invalid_format__missing_external_ref', + 'fixture' => 'php_8.4_invalid_format_missing_external_ref.html', + ], + [ + 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', + 'fixture' => 'php_8.4_invalid_format_missing_ref_file.html', + ], + [ + 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', + 'fixture' => 'php_8.4_invalid_format_missing_ref_file.html', + ], + ]; + } + + // TODO: Remove legacy fixtures after min php update version increased + #[DataProvider('getInvalidPhpEightDotFourData')] + public function testGetDocFileContentInvalidPhpEightDotFourData( + string $fixture, + string $tmpDoc, + ) { + if (version_compare(PHP_VERSION, '8.4.0', '>=')) { + $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); + + $content = app(SwaggerService::class)->getDocFileContent(); + + $this->assertExceptionHTMLEqualsFixture($fixture, $content['info']['description']); + } else { + $this->markTestSkipped('This test requires PHP version >= 8.4.0'); + } } public function testEmptyContactEmail() @@ -619,7 +640,9 @@ public function testAddDataGlobalPostGlobalURIRequest() config(['auto-doc.security' => 'jwt']); - $this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_global_post_global_uri_request')); + $this->mockDriverGetEmptyAndSaveProcessTmpData( + $this->getJsonFixture('tmp_data_global_post_global_uri_request') + ); $service = app(SwaggerService::class); @@ -632,7 +655,8 @@ public function testAddDataGlobalPostGlobalURIRequest() ], headers: [ 'authorization' => 'Bearer some_token', - ]); + ] + ); $response = $this->generateResponse('example_success_users_post_response.json'); @@ -706,7 +730,9 @@ public function testAddDataPostRequestWithObjectParams() public function testAddDataWithNotExistsMethodOnController() { - $this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_get_user_request_without_request_class')); + $this->mockDriverGetEmptyAndSaveProcessTmpData( + $this->getJsonFixture('tmp_data_get_user_request_without_request_class') + ); $service = app(SwaggerService::class); @@ -735,7 +761,7 @@ public static function getImplementations(): array { return [ [ - 'implementation' => TestRequest::class, + 'implementation' => TestRequest::class, ], [ 'implementation' => fn ($app) => new TestRequest(), diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 8cdda6c3..e8832339 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -4,6 +4,7 @@ use RonasIT\AutoDoc\Drivers\LocalDriver; use RonasIT\Support\Traits\MockTrait; +use Illuminate\Support\Str; trait SwaggerServiceMockTrait { @@ -68,4 +69,15 @@ protected function mockDriverSaveData($driverClass = LocalDriver::class): void $this->functionCall('saveData'), ]); } + + protected function assertExceptionHTMLEqualsFixture(string $fixture, string $content, bool $exportMode = false): void + { + $content = Str::replaceMatches('/MockObject/', 'MockClass', $content); + + $content = Str::replaceMatches('/line=\d+, /', 'line=999, ', $content); + + $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content); + + $this->assertEqualsFixture($fixture, $content, $exportMode); + } } diff --git a/tests/support/Traits/TraceMockTrait.php b/tests/support/Traits/TraceMockTrait.php deleted file mode 100644 index 2191ed6d..00000000 --- a/tests/support/Traits/TraceMockTrait.php +++ /dev/null @@ -1,72 +0,0 @@ - Str::contains($value, 'function='), - ); - - $traceInfoInArray = $this->getTraceInfoInArray($traceInfo); - - $mockedContent = Arr::set( - array: $contentInArray, - key: array_search($traceInfo, $contentInArray), - value: implode(', ', $traceInfoInArray), - ); - - $content = implode(PHP_EOL, $mockedContent); - } - - protected function getTraceInfoInArray(string $traceInfo): array - { - $errorPlaceInArray = explode(', ', $traceInfo); - $errorPlaceInArray = array_combine( - keys: Arr::map($errorPlaceInArray, fn ($value) => Str::before($value, '=')), - values: $errorPlaceInArray, - ); - - foreach ($errorPlaceInArray as $key => $value) { - $errorPlaceInArray[$key] = match ($key) { - 'line' => 'line=999', - 'class' => Str::contains($value, 'MockObject') ? 'class=MockClass' : $value, - 'file' => 'file=/src' . Str::after($value, '/src'), - 'function' => $this->normalizeClosureFormat($value), - default => $value, - }; - } - - return $errorPlaceInArray; - } - - protected function normalizeFilePath(string $filePath): string - { - if (!str_starts_with($filePath, '/app')) { - return Str::after($filePath, base_path() . DIRECTORY_SEPARATOR); - } - - return $filePath; - } - - protected function normalizeClosureFormat(string $function): string - { - if (Str::contains($function, 'closure:')) { - $functionInArray = explode(':', $function); - - Arr::set($functionInArray, array_key_last($functionInArray), '1}'); - - return implode(':', $functionInArray); - } - - return $function; - } -} \ No newline at end of file From ab733aa8269887fd804c74fde7c5b29d311b142b Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 26 Oct 2025 16:08:28 +0300 Subject: [PATCH 40/62] fix: tests --- tests/support/Traits/SwaggerServiceMockTrait.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index e8832339..b5a1ede1 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -78,6 +78,8 @@ protected function assertExceptionHTMLEqualsFixture(string $fixture, string $con $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content); + $content = Str::replaceMatches('/:\d+/', ':1', $content); + $this->assertEqualsFixture($fixture, $content, $exportMode); } } From 2618e5cea50ff2e4f14efaf6abc942e0e684f370 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 26 Oct 2025 16:15:03 +0300 Subject: [PATCH 41/62] fix:tests --- tests/SwaggerServiceTest.php | 47 +++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index a17bb4fa..3f3f24b8 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -183,18 +183,6 @@ public static function getConstructorInvalidTmpData(): array 'tmpDoc' => 'documentation/invalid_format__missing_field__tag_name', 'fixture' => 'invalid_format_missing_field_tag_name.html', ], - [ - 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', - 'fixture' => 'invalid_format_missing_local_ref.html', - ], - [ - 'tmpDoc' => 'documentation/invalid_format__missing_external_ref', - 'fixture' => 'invalid_format_missing_external_ref.html', - ], - [ - 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', - 'fixture' => 'invalid_format_missing_ref_file.html', - ], [ 'tmpDoc' => 'documentation/invalid_format__invalid_schema_type', 'fixture' => 'invalid_format_invalid_schema_type.html', @@ -306,6 +294,41 @@ public function testGetDocFileContentInvalidPhpEightDotFourData( } } + public static function getInvalidPhpEightDotThreeData(): array + { + return [ + [ + 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', + 'fixture' => 'invalid_format_missing_local_ref.html', + ], + [ + 'tmpDoc' => 'documentation/invalid_format__missing_external_ref', + 'fixture' => 'invalid_format_missing_external_ref.html', + ], + [ + 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', + 'fixture' => 'invalid_format_missing_ref_file.html', + ], + ]; + } + + // TODO: Remove legacy fixtures after min php update version increased + #[DataProvider('getInvalidPhpEightDotThreeData')] + public function testGetDocFileContentInvalidPhpEightDotThreeData( + string $fixture, + string $tmpDoc, + ) { + if (version_compare(PHP_VERSION, '8.4.0', '<=')) { + $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); + + $content = app(SwaggerService::class)->getDocFileContent(); + + $this->assertExceptionHTMLEqualsFixture($fixture, $content['info']['description']); + } else { + $this->markTestSkipped('This test requires PHP version <= 8.4.0'); + } + } + public function testEmptyContactEmail() { config(['auto-doc.info.contact.email' => null]); From 186e3ab202e7b7ba26df3ecf7ca27d2cb73fefe5 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 26 Oct 2025 16:29:30 +0300 Subject: [PATCH 42/62] style:fix --- src/Drivers/LocalDriver.php | 2 +- tests/SwaggerServiceTest.php | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Drivers/LocalDriver.php b/src/Drivers/LocalDriver.php index b544f716..ed39aef4 100755 --- a/src/Drivers/LocalDriver.php +++ b/src/Drivers/LocalDriver.php @@ -42,7 +42,7 @@ public function getDocumentation(): array throw new EmptyDocFileException(Path::makeRelative($this->prodFilePath, base_path())); } - if (!json_validate(file_get_contents($this->prodFilePath))) { + if (!json_validate($fileContent)) { throw new NonJSONDocFileException(Path::makeRelative($this->prodFilePath, base_path())); } diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 3f3f24b8..7bb70437 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -663,9 +663,7 @@ public function testAddDataGlobalPostGlobalURIRequest() config(['auto-doc.security' => 'jwt']); - $this->mockDriverGetEmptyAndSaveProcessTmpData( - $this->getJsonFixture('tmp_data_global_post_global_uri_request') - ); + $this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_global_post_global_uri_request')); $service = app(SwaggerService::class); @@ -677,9 +675,8 @@ public function testAddDataGlobalPostGlobalURIRequest() 'query' => null, ], headers: [ - 'authorization' => 'Bearer some_token', - ] - ); + 'authorization' => 'Bearer some_timplementationoken', + ]); $response = $this->generateResponse('example_success_users_post_response.json'); @@ -721,9 +718,7 @@ public function testAddDataPostRequestWithObjectParams() { config(['auto-doc.security' => 'jwt']); - $this->mockDriverGetEmptyAndSaveProcessTmpData( - $this->getJsonFixture('tmp_data_post_user_request_with_object_params') - ); + $this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_post_user_request_with_object_params')); $service = app(SwaggerService::class); @@ -753,9 +748,7 @@ public function testAddDataPostRequestWithObjectParams() public function testAddDataWithNotExistsMethodOnController() { - $this->mockDriverGetEmptyAndSaveProcessTmpData( - $this->getJsonFixture('tmp_data_get_user_request_without_request_class') - ); + $this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_get_user_request_without_request_class')); $service = app(SwaggerService::class); @@ -913,9 +906,7 @@ public function testSaveProductionData() public function testAddDataDescriptionForRouteConditionals() { - $this->mockDriverGetEmptyAndSaveProcessTmpData( - $this->getJsonFixture('tmp_data_get_route_parameters_description') - ); + $this->mockDriverGetEmptyAndSaveProcessTmpData($this->getJsonFixture('tmp_data_get_route_parameters_description')); $request = $this->generateRequest( type: 'get', From 5e8c8a1132217bfc7be1af569eb3499537018137 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Mon, 27 Oct 2025 12:15:47 +0300 Subject: [PATCH 43/62] fix: remove useless --- tests/support/Traits/SwaggerServiceMockTrait.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index b5a1ede1..d12ead9b 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -72,8 +72,6 @@ protected function mockDriverSaveData($driverClass = LocalDriver::class): void protected function assertExceptionHTMLEqualsFixture(string $fixture, string $content, bool $exportMode = false): void { - $content = Str::replaceMatches('/MockObject/', 'MockClass', $content); - $content = Str::replaceMatches('/line=\d+, /', 'line=999, ', $content); $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content); From e134ca932dbbf5ac5b07b5f732f3d7875205262f Mon Sep 17 00:00:00 2001 From: Anton Zabolotnikov <110885041+AZabolotnikov@users.noreply.github.com> Date: Wed, 29 Oct 2025 07:10:58 +0500 Subject: [PATCH 44/62] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 7bb70437..b7290be1 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -216,8 +216,8 @@ public static function getConstructorInvalidTmpData(): array #[DataProvider('getConstructorInvalidTmpData')] public function testGetDocFileContentInvalidTmpData( - string $fixture, string $tmpDoc, + string $fixture, ) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); From 09aba3dda6a10afd51b533bd4be934bcccfdfb52 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 2 Nov 2025 23:10:07 +0300 Subject: [PATCH 45/62] style:fix --- src/Services/SwaggerService.php | 12 +++++------ tests/SwaggerServiceTest.php | 20 ++++++++----------- .../Traits/SwaggerServiceMockTrait.php | 11 ---------- .../Traits/SwaggerServiceTestingTrait.php | 12 +++++++++++ 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 3f4f19f1..88d43228 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -851,14 +851,14 @@ public function getDocFileContent() protected function getErrorPlace(Throwable $exception): string { - $errorPlaceInTrace = Arr::first($exception->getTrace()); + $firstTraceEntry = Arr::first($exception->getTrace()); - $errorPlaceInTrace = implode(', ', Arr::map( - $errorPlaceInTrace, - fn ($value, $key) => $key . '=' . (is_array($value) ? json_encode($value) : $value), - )); + $formattedTraceEntry = Arr::map( + array: $firstTraceEntry, + callback: fn ($value, $key) => $key . '=' . (is_array($value) ? json_encode($value) : $value), + ); - return $errorPlaceInTrace; + return implode(', ', $formattedTraceEntry); } protected function camelCaseToUnderScore($input): string diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index b7290be1..53445f88 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -259,7 +259,7 @@ public function testGetDocFileContentInvalidProdData( } // TODO: Remove legacy fixtures after min php update version increased - public static function getInvalidPhpEightDotFourData(): array + public static function getInvalidData_php84(): array { return [ [ @@ -278,11 +278,9 @@ public static function getInvalidPhpEightDotFourData(): array } // TODO: Remove legacy fixtures after min php update version increased - #[DataProvider('getInvalidPhpEightDotFourData')] - public function testGetDocFileContentInvalidPhpEightDotFourData( - string $fixture, - string $tmpDoc, - ) { + #[DataProvider('getInvalidData_php84')] + public function testGetDocFileContentInvalidData_php84(string $fixture, string $tmpDoc) + { if (version_compare(PHP_VERSION, '8.4.0', '>=')) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); @@ -294,7 +292,7 @@ public function testGetDocFileContentInvalidPhpEightDotFourData( } } - public static function getInvalidPhpEightDotThreeData(): array + public static function getInvalidData_php83(): array { return [ [ @@ -313,11 +311,9 @@ public static function getInvalidPhpEightDotThreeData(): array } // TODO: Remove legacy fixtures after min php update version increased - #[DataProvider('getInvalidPhpEightDotThreeData')] - public function testGetDocFileContentInvalidPhpEightDotThreeData( - string $fixture, - string $tmpDoc, - ) { + #[DataProvider('getInvalidData_php83')] + public function testGetDocFileContentInvalidData_php83(string $fixture, string $tmpDoc) + { if (version_compare(PHP_VERSION, '8.4.0', '<=')) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index d12ead9b..75d063a4 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -69,15 +69,4 @@ protected function mockDriverSaveData($driverClass = LocalDriver::class): void $this->functionCall('saveData'), ]); } - - protected function assertExceptionHTMLEqualsFixture(string $fixture, string $content, bool $exportMode = false): void - { - $content = Str::replaceMatches('/line=\d+, /', 'line=999, ', $content); - - $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content); - - $content = Str::replaceMatches('/:\d+/', ':1', $content); - - $this->assertEqualsFixture($fixture, $content, $exportMode); - } } diff --git a/tests/support/Traits/SwaggerServiceTestingTrait.php b/tests/support/Traits/SwaggerServiceTestingTrait.php index 9db8f8e0..2ba97ccc 100644 --- a/tests/support/Traits/SwaggerServiceTestingTrait.php +++ b/tests/support/Traits/SwaggerServiceTestingTrait.php @@ -3,6 +3,7 @@ namespace RonasIT\AutoDoc\Tests\Support\Traits; use RonasIT\Support\Traits\MockTrait; +use Illuminate\Support\Str; trait SwaggerServiceTestingTrait { @@ -21,4 +22,15 @@ protected function assertTempFileEqualsFixture(string $fixture): void $this->assertFileEquals($path, getcwd() . '/storage/temp_documentation.json'); } + + protected function assertExceptionHTMLEqualsFixture(string $fixture, string $content, bool $exportMode = false): void + { + $content = Str::replaceMatches('/line=\d+,/', 'line=999, ', $content); + + $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content); + + $content = Str::replaceMatches('/:\d+/', ':1', $content); + + $this->assertEqualsFixture($fixture, $content, $exportMode); + } } From c83958a5c1a5141f01610da8d14cefdb7953380a Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Sun, 2 Nov 2025 23:10:37 +0300 Subject: [PATCH 46/62] fix:remove useless --- tests/support/Traits/SwaggerServiceMockTrait.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/support/Traits/SwaggerServiceMockTrait.php b/tests/support/Traits/SwaggerServiceMockTrait.php index 75d063a4..8cdda6c3 100644 --- a/tests/support/Traits/SwaggerServiceMockTrait.php +++ b/tests/support/Traits/SwaggerServiceMockTrait.php @@ -4,7 +4,6 @@ use RonasIT\AutoDoc\Drivers\LocalDriver; use RonasIT\Support\Traits\MockTrait; -use Illuminate\Support\Str; trait SwaggerServiceMockTrait { From 3331f1cbcbc4cdaa1acd57de383c991933c1854c Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 4 Nov 2025 14:02:23 +0300 Subject: [PATCH 47/62] style:fix --- tests/SwaggerServiceTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 53445f88..4a59771e 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -242,8 +242,8 @@ public static function getInvalidProdData(): array #[DataProvider('getInvalidProdData')] public function testGetDocFileContentInvalidProdData( - string $fixture, - string $prodDoc + string $prodDoc, + string $fixture ): void { $productionFilePath = __DIR__ . '/../storage/documentation.json'; @@ -279,7 +279,7 @@ public static function getInvalidData_php84(): array // TODO: Remove legacy fixtures after min php update version increased #[DataProvider('getInvalidData_php84')] - public function testGetDocFileContentInvalidData_php84(string $fixture, string $tmpDoc) + public function testGetDocFileContentInvalidData_php84(string $tmpDoc, string $fixture) { if (version_compare(PHP_VERSION, '8.4.0', '>=')) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); @@ -312,7 +312,7 @@ public static function getInvalidData_php83(): array // TODO: Remove legacy fixtures after min php update version increased #[DataProvider('getInvalidData_php83')] - public function testGetDocFileContentInvalidData_php83(string $fixture, string $tmpDoc) + public function testGetDocFileContentInvalidData_php83(string $tmpDoc, string $fixture) { if (version_compare(PHP_VERSION, '8.4.0', '<=')) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); From 5eef60568c27f9b22ed7b5db7a9f2e76caa4a08c Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 4 Nov 2025 16:18:54 +0300 Subject: [PATCH 48/62] fix:tests --- tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html | 2 +- .../invalid_format_array_parameter_no_items.html | 2 +- .../invalid_format_array_response_body_no_items.html | 2 +- .../invalid_format_array_response_header_no_items.html | 2 +- .../SwaggerServiceTest/invalid_format_body_and_form_params.html | 2 +- .../invalid_format_duplicate_header_params.html | 2 +- .../invalid_format_duplicate_operation_id.html | 2 +- .../invalid_format_duplicate_path_params.html | 2 +- .../invalid_format_duplicate_path_placeholders.html | 2 +- .../SwaggerServiceTest/invalid_format_duplicate_tag.html | 2 +- .../invalid_format_file_invalid_consumes.html | 2 +- .../SwaggerServiceTest/invalid_format_file_no_consumes.html | 2 +- ...nvalid_format_incorrect_documentation_structure_request.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_schema_type.html | 2 +- .../invalid_format_invalid_value_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_value_path.html | 2 +- .../invalid_format_invalid_value_status_code.html | 2 +- .../invalid_format_missing_field_definition_type.html | 2 +- .../invalid_format_missing_field_header_type.html | 2 +- .../invalid_format_missing_field_info_version.html | 2 +- .../invalid_format_missing_field_items_type.html | 2 +- .../invalid_format_missing_field_operation_responses.html | 2 +- .../invalid_format_missing_field_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_missing_field_paths.html | 2 +- .../invalid_format_missing_field_response_description.html | 2 +- .../invalid_format_missing_field_tag_name.html | 2 +- .../invalid_format_missing_path_parameter.html | 2 +- .../SwaggerServiceTest/invalid_format_multiple_body_params.html | 2 +- .../SwaggerServiceTest/invalid_format_no_path_params.html | 2 +- .../invalid_format_path_param_no_placeholder.html | 2 +- .../invalid_format_request_body_invalid_content.html | 2 +- .../invalid_format_response_invalid_items.html | 2 +- .../invalid_format_security_definition_flow.html | 2 +- .../invalid_format_security_definition_in.html | 2 +- .../invalid_format_security_definition_type.html | 2 +- tests/fixtures/SwaggerServiceTest/invalid_version.html | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html index cee4a3aa..a98fd5dc 100644 --- a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html +++ b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index 497ab12d..af5805e2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index ca505eae..1c4bc09b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index f7edcb4a..11b1235f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index 4260f82c..b6913e21 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index d97ab16a..aa5d6162 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index 27cb7ff9..4171555d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index b30a1771..4d91c3f7 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index 43432d5b..22eea8c0 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index cb8ba38a..9e832131 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index 0bf41111..e499e01d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index 4cae7ff3..5a725cf4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 5ce01a75..1f800367 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index 855ad952..dd974f06 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index e3085d3f..f38b81f5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index 1c19c7f3..f0d5e034 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index d332bd91..f93888c2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index a71f2c82..3aaa85da 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index 16511e5e..938f862a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index f577df16..52b22a63 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index 347e99c6..280e1c29 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index 51f44d2a..5c07e647 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 228657f6..32cfcbc8 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index 8c3f08cc..330ee1c7 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index 5b10e3df..cab9afa8 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index 782ca34b..0e875148 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index be45334f..3897f848 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index a40ab989..5861dd25 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index d1450f4c..7807255d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index bbe5b4bd..7fdd5d9f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index ebfd7c9a..8e7115b0 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index 5c0f44cd..40144565 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index 771a4b12..4b82a066 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index 338b923f..0e3de11e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index 2ecc341b..a855cab2 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index 06889e32..1e017729 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file From f70a93b63d3b1d23be58d5e592a2e71e6c0d86ca Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:23:55 +0600 Subject: [PATCH 49/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 4a59771e..4a465287 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -329,8 +329,7 @@ public function testEmptyContactEmail() { config(['auto-doc.info.contact.email' => null]); - $this->expectException(EmptyContactEmailException::class); - $this->expectExceptionMessage('Please fill the `info.contact.email` field in the app-doc.php config file.'); +$this-> assertExceptionThrew(EmptyContactEmailException::class, 'Please fill the `info.contact.email` field in the app-doc.php config file.'); app(SwaggerService::class)->getDocFileContent(); } From 17c2b2a122cf0c58966329837527d9b6c0a6f7f0 Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:25:01 +0600 Subject: [PATCH 50/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 4a465287..66bfe7cd 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -241,10 +241,8 @@ public static function getInvalidProdData(): array } #[DataProvider('getInvalidProdData')] - public function testGetDocFileContentInvalidProdData( - string $prodDoc, - string $fixture - ): void { + public function testGetDocFileContentInvalidProdData(string $prodDoc, string $fixture): void + { $productionFilePath = __DIR__ . '/../storage/documentation.json'; config(['auto-doc.drivers.local.production_path' => $productionFilePath]); From a0804024a45b087b7866688fa23706b0828bc8cd Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:25:55 +0600 Subject: [PATCH 51/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 66bfe7cd..be1da46d 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -257,7 +257,7 @@ public function testGetDocFileContentInvalidProdData(string $prodDoc, string $fi } // TODO: Remove legacy fixtures after min php update version increased - public static function getInvalidData_php84(): array + public static function getInvalidDataPHP84(): array { return [ [ From 229e54592e395b4087ed7abf2cffcccc04490638 Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:26:47 +0600 Subject: [PATCH 52/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index be1da46d..b3268cbe 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -276,7 +276,7 @@ public static function getInvalidDataPHP84(): array } // TODO: Remove legacy fixtures after min php update version increased - #[DataProvider('getInvalidData_php84')] + #[DataProvider('getInvalidDataPHP84')] public function testGetDocFileContentInvalidData_php84(string $tmpDoc, string $fixture) { if (version_compare(PHP_VERSION, '8.4.0', '>=')) { From 4f0254cdc3fdde92832f382d82534ff6aa3fbda3 Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:27:32 +0600 Subject: [PATCH 53/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index b3268cbe..51a7db37 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -277,7 +277,7 @@ public static function getInvalidDataPHP84(): array // TODO: Remove legacy fixtures after min php update version increased #[DataProvider('getInvalidDataPHP84')] - public function testGetDocFileContentInvalidData_php84(string $tmpDoc, string $fixture) + public function testGetDocFileContentInvalidDataPHP84(string $tmpDoc, string $fixture) { if (version_compare(PHP_VERSION, '8.4.0', '>=')) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); From a0ba34f18027b9f039ab5ab0023fa39bf954753b Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:28:03 +0600 Subject: [PATCH 54/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 51a7db37..1e46073c 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -290,7 +290,7 @@ public function testGetDocFileContentInvalidDataPHP84(string $tmpDoc, string $fi } } - public static function getInvalidData_php83(): array + public static function getInvalidDataPHP83(): array { return [ [ From 208ce1196e002d4f4b90ab4c9fadcfb3a47c0426 Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:29:51 +0600 Subject: [PATCH 55/62] Update tests/SwaggerServiceTest.php --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 1e46073c..cd25e116 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -309,7 +309,7 @@ public static function getInvalidDataPHP83(): array } // TODO: Remove legacy fixtures after min php update version increased - #[DataProvider('getInvalidData_php83')] + #[DataProvider('getInvalidDataPHP83')] public function testGetDocFileContentInvalidData_php83(string $tmpDoc, string $fixture) { if (version_compare(PHP_VERSION, '8.4.0', '<=')) { From 5c8cfeb6fc9126df3fbf485c8e00f0e91232f79f Mon Sep 17 00:00:00 2001 From: DenTray Date: Thu, 6 Nov 2025 13:39:17 +0600 Subject: [PATCH 56/62] Update tests/SwaggerServiceTest.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/SwaggerServiceTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index cd25e116..5c19d926 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -327,7 +327,7 @@ public function testEmptyContactEmail() { config(['auto-doc.info.contact.email' => null]); -$this-> assertExceptionThrew(EmptyContactEmailException::class, 'Please fill the `info.contact.email` field in the app-doc.php config file.'); +$this->assertExceptionThrew(EmptyContactEmailException::class, 'Please fill the `info.contact.email` field in the app-doc.php config file.'); app(SwaggerService::class)->getDocFileContent(); } From c07712a44722197284de0286f6c32ccf4a465d5a Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Thu, 6 Nov 2025 13:56:52 +0300 Subject: [PATCH 57/62] tests: make correct php 8.4 tests --- tests/SwaggerServiceTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 4a59771e..0b2945ee 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -268,7 +268,7 @@ public static function getInvalidData_php84(): array ], [ 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', - 'fixture' => 'php_8.4_invalid_format_missing_ref_file.html', + 'fixture' => 'php_8.4_invalid_format_missing_local_ref.html', ], [ 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', @@ -314,14 +314,14 @@ public static function getInvalidData_php83(): array #[DataProvider('getInvalidData_php83')] public function testGetDocFileContentInvalidData_php83(string $tmpDoc, string $fixture) { - if (version_compare(PHP_VERSION, '8.4.0', '<=')) { + if (version_compare(PHP_VERSION, '8.4.0', '<')) { $this->mockDriverGetDocumentation($this->getJsonFixture($tmpDoc)); $content = app(SwaggerService::class)->getDocFileContent(); $this->assertExceptionHTMLEqualsFixture($fixture, $content['info']['description']); } else { - $this->markTestSkipped('This test requires PHP version <= 8.4.0'); + $this->markTestSkipped('This test requires PHP version < 8.4.0'); } } @@ -671,7 +671,7 @@ public function testAddDataGlobalPostGlobalURIRequest() 'query' => null, ], headers: [ - 'authorization' => 'Bearer some_timplementationoken', + 'authorization' => 'Bearer some_token', ]); $response = $this->generateResponse('example_success_users_post_response.json'); From 30f0f23d0c4d34e1c997290f0b4982c41b94b21e Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Thu, 6 Nov 2025 14:01:06 +0300 Subject: [PATCH 58/62] fix:tests --- tests/SwaggerServiceTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index e4e7ec59..daf7bd16 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -265,7 +265,7 @@ public static function getInvalidDataPHP84(): array 'fixture' => 'php_8.4_invalid_format_missing_external_ref.html', ], [ - 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', + 'tmpDoc' => 'documentation/invalid_format__missing_local_ref', 'fixture' => 'php_8.4_invalid_format_missing_local_ref.html', ], [ @@ -327,7 +327,7 @@ public function testEmptyContactEmail() { config(['auto-doc.info.contact.email' => null]); -$this->assertExceptionThrew(EmptyContactEmailException::class, 'Please fill the `info.contact.email` field in the app-doc.php config file.'); + $this->assertExceptionThrew(EmptyContactEmailException::class, 'Please fill the `info.contact.email` field in the app-doc.php config file.'); app(SwaggerService::class)->getDocFileContent(); } From 8a1c80b4c751870786112a4353043ce9030b0a50 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Thu, 6 Nov 2025 14:33:25 +0300 Subject: [PATCH 59/62] refactor: remove useless --- src/Services/SwaggerService.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index 88d43228..ecd71c21 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -837,7 +837,7 @@ public function getDocFileContent() foreach ($additionalDocs as $filePath) { try { $additionalDocContent = $this->getOpenAPIFileContent(base_path($filePath)); - } catch (DocFileNotExistsException|EmptyDocFileException|InvalidSwaggerSpecException $exception) { + } catch (DocFileNotExistsException|InvalidSwaggerSpecException $exception) { report($exception); continue; @@ -994,10 +994,6 @@ protected function getOpenAPIFileContent(string $filePath): array $fileContent = json_decode(file_get_contents($filePath), true); - if (empty($fileContent)) { - throw new EmptyDocFileException($filePath); - } - $this->openAPIValidator->validate($fileContent); return $fileContent; From b0030f310c2fd8ca5238ccf4bdd6ffc746631ce2 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 11 Nov 2025 15:58:27 +0300 Subject: [PATCH 60/62] refactor: replace getFixturePath to getFixture --- src/Services/SwaggerService.php | 6 +++++- tests/AutoDocControllerTest.php | 3 ++- tests/LocalDriverTest.php | 2 +- tests/StorageDriverTest.php | 2 +- tests/SwaggerServiceTest.php | 8 ++++---- .../empty_additional_documentation.json | 1 + .../SwaggerServiceTest/empty_prod_documentation.html | 2 +- .../invalid_format_array_parameter_no_items.html | 2 +- .../invalid_format_array_response_body_no_items.html | 2 +- .../invalid_format_array_response_header_no_items.html | 2 +- .../invalid_format_body_and_form_params.html | 2 +- .../invalid_format_duplicate_header_params.html | 2 +- .../invalid_format_duplicate_operation_id.html | 2 +- .../invalid_format_duplicate_path_params.html | 2 +- .../invalid_format_duplicate_path_placeholders.html | 2 +- .../SwaggerServiceTest/invalid_format_duplicate_tag.html | 2 +- .../invalid_format_file_invalid_consumes.html | 2 +- .../invalid_format_file_no_consumes.html | 2 +- ..._format_incorrect_documentation_structure_request.html | 2 +- .../invalid_format_invalid_schema_type.html | 2 +- .../invalid_format_invalid_value_parameter_in.html | 2 +- .../invalid_format_invalid_value_path.html | 2 +- .../invalid_format_invalid_value_status_code.html | 2 +- .../invalid_format_missing_field_definition_type.html | 2 +- .../invalid_format_missing_field_header_type.html | 2 +- .../invalid_format_missing_field_info_version.html | 2 +- .../invalid_format_missing_field_items_type.html | 2 +- .../invalid_format_missing_field_operation_responses.html | 2 +- .../invalid_format_missing_field_parameter_in.html | 2 +- .../invalid_format_missing_field_paths.html | 2 +- ...invalid_format_missing_field_response_description.html | 2 +- .../invalid_format_missing_field_tag_name.html | 2 +- .../invalid_format_missing_path_parameter.html | 2 +- .../invalid_format_multiple_body_params.html | 2 +- .../SwaggerServiceTest/invalid_format_no_path_params.html | 2 +- .../invalid_format_path_param_no_placeholder.html | 2 +- .../invalid_format_request_body_invalid_content.html | 2 +- .../invalid_format_response_invalid_items.html | 2 +- .../invalid_format_security_definition_flow.html | 2 +- .../invalid_format_security_definition_in.html | 2 +- .../invalid_format_security_definition_type.html | 2 +- tests/fixtures/SwaggerServiceTest/invalid_version.html | 2 +- tests/support/Traits/SwaggerServiceTestingTrait.php | 2 +- 43 files changed, 51 insertions(+), 45 deletions(-) create mode 100644 tests/fixtures/AutoDocControllerTest/empty_additional_documentation.json diff --git a/src/Services/SwaggerService.php b/src/Services/SwaggerService.php index ecd71c21..88d43228 100644 --- a/src/Services/SwaggerService.php +++ b/src/Services/SwaggerService.php @@ -837,7 +837,7 @@ public function getDocFileContent() foreach ($additionalDocs as $filePath) { try { $additionalDocContent = $this->getOpenAPIFileContent(base_path($filePath)); - } catch (DocFileNotExistsException|InvalidSwaggerSpecException $exception) { + } catch (DocFileNotExistsException|EmptyDocFileException|InvalidSwaggerSpecException $exception) { report($exception); continue; @@ -994,6 +994,10 @@ protected function getOpenAPIFileContent(string $filePath): array $fileContent = json_decode(file_get_contents($filePath), true); + if (empty($fileContent)) { + throw new EmptyDocFileException($filePath); + } + $this->openAPIValidator->validate($fileContent); return $fileContent; diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index cf9141d8..66f2156e 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -4,6 +4,7 @@ use Illuminate\Http\Response; use phpmock\phpunit\PHPMock; +use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; class AutoDocControllerTest extends TestCase { @@ -75,7 +76,7 @@ public function testGetJSONDocumentationIsEmpty() $mock->expects($this->once()); config([ - 'auto-doc.additional_paths' => ['tests/fixtures/AutoDocControllerTest/documentation__non_json.txt'], + 'auto-doc.additional_paths' => ['tests/fixtures/AutoDocControllerTest/empty_additional_documentation.json'], ]); $response = $this->json('get', '/auto-doc/documentation'); diff --git a/tests/LocalDriverTest.php b/tests/LocalDriverTest.php index 3ede2589..6a5e95a1 100755 --- a/tests/LocalDriverTest.php +++ b/tests/LocalDriverTest.php @@ -137,7 +137,7 @@ public function testGetEmptyDocumentation(): void public function testGetInvalidJsonDocumentation(): void { - file_put_contents(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); + file_put_contents(self::$productionFilePath, $this->getFixture('invalid_prod_json_data.json')); $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file 'storage/documentation.json' is not a json doc file."); diff --git a/tests/StorageDriverTest.php b/tests/StorageDriverTest.php index 24e3e4c0..855e4d10 100755 --- a/tests/StorageDriverTest.php +++ b/tests/StorageDriverTest.php @@ -131,7 +131,7 @@ public function testGetEmptyDocumentation(): void public function testGetInvalidJsonDocumentation(): void { - $this->disk->put(self::$productionFilePath, $this->getFixturePath('invalid_prod_json_data')); + $this->disk->put(self::$productionFilePath, $this->getFixture('invalid_prod_json_data.json')); $this->assertExceptionThrew(NonJSONDocFileException::class, "Doc file 'documentation.json' is not a json doc file."); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index daf7bd16..b68cd350 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -230,11 +230,11 @@ public static function getInvalidProdData(): array { return [ [ - 'prodDoc' => 'documentation/empty_prod_documentation', + 'prodDoc' => 'documentation/empty_prod_documentation.json', 'fixture' => 'empty_prod_documentation.html', ], [ - 'prodDoc' => 'documentation/tmp_data_incorrect_documentation_structure_request', + 'prodDoc' => 'documentation/tmp_data_incorrect_documentation_structure_request.json', 'fixture' => 'invalid_format_incorrect_documentation_structure_request.html', ], ]; @@ -247,9 +247,9 @@ public function testGetDocFileContentInvalidProdData(string $prodDoc, string $fi config(['auto-doc.drivers.local.production_path' => $productionFilePath]); - $prodDocPath = "tests/fixtures/SwaggerServiceTest/{$prodDoc}.json"; + $documentation = $this->getFixture($prodDoc); - file_put_contents($productionFilePath, file_get_contents($prodDocPath)); + file_put_contents($productionFilePath, $documentation); $content = app(SwaggerService::class)->getDocFileContent(); diff --git a/tests/fixtures/AutoDocControllerTest/empty_additional_documentation.json b/tests/fixtures/AutoDocControllerTest/empty_additional_documentation.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/tests/fixtures/AutoDocControllerTest/empty_additional_documentation.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html index a98fd5dc..a40adbd9 100644 --- a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html +++ b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999 function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index af5805e2..9fc4515a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index 1c4bc09b..bb4860a5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index 11b1235f..5642ee70 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index b6913e21..9e940e4d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index aa5d6162..17da728f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index 4171555d..7221779f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index 4d91c3f7..697cc67b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index 22eea8c0..b7936768 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index 9e832131..3991abc4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index e499e01d..0245fdd4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index 5a725cf4..b51eeda4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 1f800367..0fb71f1e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999 function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index dd974f06..fa2ecaa8 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index f38b81f5..55997556 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index f0d5e034..074e5803 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index f93888c2..6cfd8ece 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index 3aaa85da..d539dc65 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index 938f862a..48cd0eb1 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index 52b22a63..7010172b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index 280e1c29..3d54c938 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index 5c07e647..ec4314d5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 32cfcbc8..1f5123d1 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index 330ee1c7..fbe7a89e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index cab9afa8..6afc93e3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index 0e875148..7e7ee1b1 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index 3897f848..2d1b0ede 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index 5861dd25..16b70c99 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index 7807255d..c8452ad8 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index 7fdd5d9f..d0f16e7b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index 8e7115b0..72f460e4 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index 40144565..888a0091 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index 4b82a066..dd3c0593 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index 0e3de11e..48886131 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index a855cab2..4b153b75 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index 1e017729..038053f5 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/support/Traits/SwaggerServiceTestingTrait.php b/tests/support/Traits/SwaggerServiceTestingTrait.php index 2ba97ccc..e04276d8 100644 --- a/tests/support/Traits/SwaggerServiceTestingTrait.php +++ b/tests/support/Traits/SwaggerServiceTestingTrait.php @@ -25,7 +25,7 @@ protected function assertTempFileEqualsFixture(string $fixture): void protected function assertExceptionHTMLEqualsFixture(string $fixture, string $content, bool $exportMode = false): void { - $content = Str::replaceMatches('/line=\d+,/', 'line=999, ', $content); + $content = Str::replaceMatches('/line=\d+,/', 'line=999', $content); $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content); From 07ac0867c44a6649990a05d3521b013d9491e333 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 11 Nov 2025 15:58:57 +0300 Subject: [PATCH 61/62] style: remove useless --- tests/AutoDocControllerTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/AutoDocControllerTest.php b/tests/AutoDocControllerTest.php index 66f2156e..86ef7b04 100644 --- a/tests/AutoDocControllerTest.php +++ b/tests/AutoDocControllerTest.php @@ -4,7 +4,6 @@ use Illuminate\Http\Response; use phpmock\phpunit\PHPMock; -use RonasIT\AutoDoc\Exceptions\EmptyDocFileException; class AutoDocControllerTest extends TestCase { From 5d00c6d154c43258b8cb22c90d4f519d1e8112e8 Mon Sep 17 00:00:00 2001 From: Ruslan Guskov Date: Tue, 11 Nov 2025 16:01:31 +0300 Subject: [PATCH 62/62] style: fix --- tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html | 2 +- .../invalid_format_array_parameter_no_items.html | 2 +- .../invalid_format_array_response_body_no_items.html | 2 +- .../invalid_format_array_response_header_no_items.html | 2 +- .../SwaggerServiceTest/invalid_format_body_and_form_params.html | 2 +- .../invalid_format_duplicate_header_params.html | 2 +- .../invalid_format_duplicate_operation_id.html | 2 +- .../invalid_format_duplicate_path_params.html | 2 +- .../invalid_format_duplicate_path_placeholders.html | 2 +- .../SwaggerServiceTest/invalid_format_duplicate_tag.html | 2 +- .../invalid_format_file_invalid_consumes.html | 2 +- .../SwaggerServiceTest/invalid_format_file_no_consumes.html | 2 +- ...nvalid_format_incorrect_documentation_structure_request.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_schema_type.html | 2 +- .../invalid_format_invalid_value_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_invalid_value_path.html | 2 +- .../invalid_format_invalid_value_status_code.html | 2 +- .../invalid_format_missing_field_definition_type.html | 2 +- .../invalid_format_missing_field_header_type.html | 2 +- .../invalid_format_missing_field_info_version.html | 2 +- .../invalid_format_missing_field_items_type.html | 2 +- .../invalid_format_missing_field_operation_responses.html | 2 +- .../invalid_format_missing_field_parameter_in.html | 2 +- .../SwaggerServiceTest/invalid_format_missing_field_paths.html | 2 +- .../invalid_format_missing_field_response_description.html | 2 +- .../invalid_format_missing_field_tag_name.html | 2 +- .../invalid_format_missing_path_parameter.html | 2 +- .../SwaggerServiceTest/invalid_format_multiple_body_params.html | 2 +- .../SwaggerServiceTest/invalid_format_no_path_params.html | 2 +- .../invalid_format_path_param_no_placeholder.html | 2 +- .../invalid_format_request_body_invalid_content.html | 2 +- .../invalid_format_response_invalid_items.html | 2 +- .../invalid_format_security_definition_flow.html | 2 +- .../invalid_format_security_definition_in.html | 2 +- .../invalid_format_security_definition_type.html | 2 +- tests/fixtures/SwaggerServiceTest/invalid_version.html | 2 +- tests/support/Traits/SwaggerServiceTestingTrait.php | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html index a40adbd9..cee4a3aa 100644 --- a/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html +++ b/tests/fixtures/SwaggerServiceTest/empty_prod_documentation.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Services/SwaggerService.php, line=999 function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html index 9fc4515a..497ab12d 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_parameter_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined"],"paths.\/users.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html index bb4860a5..ca505eae 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_body_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html index 5642ee70..f7edcb4a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_array_response_header_no_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"array"},["array","boolean","integer","number","string","object","date","double"],"paths.\/users.get.responses.default.headers.Last-Modified"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html index 9e940e4d..4260f82c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_body_and_form_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"body","schema":{"type":"number"}},{"name":"bar","in":"formData","schema":{"type":"number"}}],"paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html index 17da728f..d97ab16a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_header_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"foo","in":"header","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html index 7221779f..27cb7ff9 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_operation_id.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateOperationIdsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html index 697cc67b..b30a1771 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateParamsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}},{"name":"username","in":"path","schema":{"type":"number"},"required":true}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html index b7936768..43432d5b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_path_placeholders.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"img_id","in":"path","required":true,"schema":{"type":"number"}}],"\/users\/{username}\/profile\/{username}\/image\/{img_id}","paths.\/users\/{username}\/profile\/{username}\/image\/{img_id}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html index 3991abc4..cb8ba38a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_duplicate_tag.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateTagsUnique, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html index 0245fdd4..0bf41111 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_invalid_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"consumes":["application\/octet-stream","image\/png"],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html index b51eeda4..4cae7ff3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_file_no_consumes.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFormDataConsumes, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"parameters":[{"name":"username","in":"path","schema":{"type":"string"},"required":true},{"name":"image","in":"formData","schema":{"type":"file"}}],"responses":{"default":{"description":"hello world"}}},"paths.\/users\/{username}\/profile\/image.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html index 0fb71f1e..5ce01a75 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_incorrect_documentation_structure_request.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Services/SwaggerService.php, line=999 function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] +file=/src/Services/SwaggerService.php, line=999, function=getDocumentation, class=RonasIT\AutoDoc\Drivers\LocalDriver, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html index fa2ecaa8..855ad952 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_schema_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateType, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"type":"something","items":{"user":{"type":"string"}}},["array","boolean","integer","number","string","object","null","undefined","file"],"paths.\/users.get.responses.200.schema"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html index 55997556..e3085d3f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["paths.\/auth\/login.post.parameters.0.in",["body","formData","query","path","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html index 074e5803..1c19c7f3 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_path.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePaths, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html index 6cfd8ece..d332bd91 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_invalid_value_status_code.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateResponse, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"description":"hello world"},"8888","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html index d539dc65..a71f2c82 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"components.schemas.authloginObject"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html index 48cd0eb1..16511e5e 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_header_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/user\/login.get.responses.200.headers.X-Rate-Limit"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html index 7010172b..f577df16 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_info_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["title","version"],"info"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html index 3d54c938..347e99c6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_items_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/pet\/findByStatus.get.parameters.0.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html index ec4314d5..51f44d2a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_operation_responses.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["responses"],"paths.\/auth\/login.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html index 1f5123d1..228657f6 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_parameter_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["in","name"],"paths.\/auth\/login.post.parameters.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html index fbe7a89e..8c3f08cc 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_paths.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["openapi","info","paths"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html index 6afc93e3..5b10e3df 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_response_description.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["description"],"paths.\/auth\/login.post.responses.200"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html index 7e7ee1b1..782ca34b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_field_tag_name.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["name"],"tags.0"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html index 2d1b0ede..be45334f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_missing_path_parameter.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"string"},"required":false},{"name":"username","in":"header","schema":{"type":"string"}},{"name":"username","in":"body","schema":{"type":"string"}}],"\/users","paths.\/users.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html index 16b70c99..a40ab989 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_multiple_body_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateBodyParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"bar","in":"header","schema":{"type":"number"},"required":true},{"name":"foo","in":"body","required":true,"schema":{"type":"number"}},{"name":"foo2","in":"body","schema":{"type":"number"}}],"paths.\/users\/{username}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html index c8452ad8..d1450f4c 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_no_path_params.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"header","required":true,"schema":{"type":"number"}},{"name":"foo","in":"body","schema":{"type":"number"}}],"\/users\/{username}\/{foo}","paths.\/users\/{username}\/{foo}.get"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html index d0f16e7b..bbe5b4bd 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_path_param_no_placeholder.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validatePathParameters, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[[{"name":"username","in":"path","required":true,"schema":{"type":"string"}},{"name":"foo","in":"path","schema":{"type":"number"}}],"\/users\/{username}","paths.\/users\/{username}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html index 72f460e4..ebfd7c9a 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_request_body_invalid_content.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateRequestBodyContent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[{"image\/png":{"items":[]}},"paths.\/users\/{id}.post"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html index 888a0091..5c0f44cd 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_response_invalid_items.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldsPresent, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[["type"],"paths.\/users\/{id}.post.responses.200.schema.items"] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html index dd3c0593..771a4b12 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_flow.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.flow",["implicit","password","application","accessCode"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html index 48886131..338b923f 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_in.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.in",["query","header"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html index 4b153b75..2ecc341b 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_format_security_definition_type.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateFieldValue, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=["securityDefinitions.0.type",["basic","apiKey","oauth2"]] --- \ No newline at end of file diff --git a/tests/fixtures/SwaggerServiceTest/invalid_version.html b/tests/fixtures/SwaggerServiceTest/invalid_version.html index 038053f5..06889e32 100644 --- a/tests/fixtures/SwaggerServiceTest/invalid_version.html +++ b/tests/fixtures/SwaggerServiceTest/invalid_version.html @@ -10,5 +10,5 @@ ### **Error place:** -file=/src/Validators/SwaggerSpecValidator.php, line=999 function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] +file=/src/Validators/SwaggerSpecValidator.php, line=999, function=validateVersion, class=RonasIT\AutoDoc\Validators\SwaggerSpecValidator, type=->, args=[] --- \ No newline at end of file diff --git a/tests/support/Traits/SwaggerServiceTestingTrait.php b/tests/support/Traits/SwaggerServiceTestingTrait.php index e04276d8..a9c45106 100644 --- a/tests/support/Traits/SwaggerServiceTestingTrait.php +++ b/tests/support/Traits/SwaggerServiceTestingTrait.php @@ -25,7 +25,7 @@ protected function assertTempFileEqualsFixture(string $fixture): void protected function assertExceptionHTMLEqualsFixture(string $fixture, string $content, bool $exportMode = false): void { - $content = Str::replaceMatches('/line=\d+,/', 'line=999', $content); + $content = Str::replaceMatches('/line=\d+,/', 'line=999,', $content); $content = Str::replaceMatches('/file=.*?(src\/[^\s]+)/', 'file=/$1', $content);