Skip to content
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

Added support for Symfony\Component\HttpKernel\Exception\* documentation when annotated in exceptions #674

Merged
merged 7 commits into from
Feb 12, 2025

Conversation

phpsa
Copy link
Contributor

@phpsa phpsa commented Jan 7, 2025

using this example docblock:

    /**
     * Flags the policy for automatic renewal
     *
     * @param string $policyId the policy id to flag for renewal
     *
     * @return array{status:bool}
     * @response array{status:true}
     *
     * @throws BadRequestHttpException|NotAcceptableHttpException
     */

to have automated responses mapped over:
image
image

$type->isInstanceOf(LockedHttpException::class) => 423,
$type->isInstanceOf(MethodNotAllowedHttpException::class) => 405,
$type->isInstanceOf(NotAcceptableHttpException::class) => 406,
$type->isInstanceOf(NotFoundHttpException::class) => 404,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotFoundHttpException is handled in other extension, please make sure to handle it in a single extension

@romalytvynenko romalytvynenko changed the title fix: Symfony\Component\HttpKernel\Exception\ types Added support for Symfony\Component\HttpKernel\Exception\* documentation when annotated in exceptions Jan 8, 2025
@romalytvynenko
Copy link
Member

romalytvynenko commented Jan 8, 2025

@phpsa good idea! Let's just make sure we don't handle the same exceptions types in different extensions and I'm happy to merge. Thank you!

Oh, almost forgot. Please also include some tests

@phpsa
Copy link
Contributor Author

phpsa commented Jan 16, 2025

@romalytvynenko - thanks for the feedback,
have removed NotFound and added a test to confirm they are pickedup.

@phpsa phpsa requested a review from romalytvynenko January 28, 2025 03:50
@romalytvynenko
Copy link
Member

@phpsa made some changes before merging. The main difference is that in your PR you documented ANY exception as 500 response. I'd prefer not do that – not documenting the response is better that documenting it in a wrong way (some exceptions MAY be renderable and there a custom status MAY be used). Other than that – thanks for the contribution and sorry it took long to get to it.

@romalytvynenko romalytvynenko merged commit 7f0448a into dedoc:main Feb 12, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants