-
Notifications
You must be signed in to change notification settings - Fork 48
163 modify 500 code error response page #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…hub.com/RonasIT/laravel-swagger into 163-modify-500-code-error-response-page
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modifies the error response page formatting for Swagger validation errors, addressing issue #163. The changes enhance error presentation with structured markdown formatting and proper error context display.
- Reformats error page display with markdown structure including headers and visual separators
- Updates error handling to include exception type information alongside error messages
- Fixes test parameter ordering and adds new test case for incorrect documentation structure
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/views/error.blade.php | Updates error page template with structured markdown formatting |
| src/Services/SwaggerService.php | Modifies exception handling to capture and pass exception type information |
| tests/SwaggerServiceTest.php | Updates test expectations and adds new test case for documentation structure errors |
| tests/TestCase.php | Fixes parameter order in exportContent method call |
| tests/fixtures/SwaggerServiceTest/*.html | Updates all error fixture files to match new markdown-formatted error template |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 62 out of 64 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [ | ||
| 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', | ||
| 'fixture' => 'php_8.4_invalid_format_missing_ref_file.html', | ||
| ], |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate test case entry detected. Lines 267-270 and 271-274 have identical values for both 'tmpDoc' and 'fixture'. Remove the duplicate entry to avoid redundant test execution.
| [ | |
| 'tmpDoc' => 'documentation/invalid_format__missing_ref_file', | |
| 'fixture' => 'php_8.4_invalid_format_missing_ref_file.html', | |
| ], |
tests/SwaggerServiceTest.php
Outdated
| ], | ||
| headers: [ | ||
| 'authorization' => 'Bearer some_token', | ||
| 'authorization' => 'Bearer some_timplementationoken', |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'some_timplementationoken' to 'some_token'.
| 'authorization' => 'Bearer some_timplementationoken', | |
| 'authorization' => 'Bearer some_token', |
tests/SwaggerServiceTest.php
Outdated
| 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'); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect version comparison operator. The condition should be '<' instead of '<=' to check for PHP versions before 8.4.0. Currently, this test will run on PHP 8.4.0 when it should be skipped, which contradicts the skip message on line 322 stating 'This test requires PHP version <= 8.4.0' (note: the message itself is misleading as '<= 8.4.0' would include 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'); | |
| 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'); |
| { | ||
| if ($exportMode || $this->globalExportMode) { | ||
| $this->exportContent($fixtureName, $data); | ||
| $this->exportContent($data, $fixtureName); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter order in this call has been swapped. Based on the method signature at line 59 which defines exportContent($content, string $fixtureName), the first parameter should be the content. Verify that all calls to assertEqualsFixture still work correctly with this parameter order change, as exportContent now expects content first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method realization
protected function exportContent($content, string $fixtureName): void
{
file_put_contents($this->getFixturePath($fixtureName), $content);
}
| public function testMergeTempDocumentation() | ||
| { | ||
| $this->mockParallelTestingToken(); | ||
| $this->mockParallelTestingToken('workerID'); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method mockParallelTestingToken is called but was removed from TestCase.php (see lines 213-217 of the diff). This will cause a fatal error. Either restore this method or use an alternative implementation.
| public function testMergeToEmptyTempDocumentation() | ||
| { | ||
| $this->mockParallelTestingToken(); | ||
| $this->mockParallelTestingToken('workerID'); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method mockParallelTestingToken is called but was removed from TestCase.php (see lines 213-217 of the diff). This will cause a fatal error. Either restore this method or use an alternative implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method was moved in helpers package
| public function testSaveProcessTmpDataCheckTokenBasedPath() | ||
| { | ||
| $this->mockParallelTestingToken(); | ||
| $this->mockParallelTestingToken('workerID'); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method mockParallelTestingToken is called but was removed from TestCase.php (see lines 213-217 of the TestCase.php diff). This will cause a fatal error. Either restore this method or use an alternative implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method was moved in helpers package
Co-authored-by: Copilot <[email protected]>
|
@RGO230 please review copilot's comments and increase test coverage |
…hub.com/RonasIT/laravel-swagger into 163-modify-500-code-error-response-page
|



#163