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

feat: problem details plugin #3323

Merged
merged 24 commits into from
Aug 25, 2024
Merged

feat: problem details plugin #3323

merged 24 commits into from
Aug 25, 2024

Conversation

peterschutt
Copy link
Contributor

Description

A plugin to enable usage of problem details as the response.

The way this works is by injecting an exception handler into the app level exception handlers to convert ProblemDetailsException into a response following the specification as per RFC 9457.

Users can pass in a mapping of exception types to callables that will convert those exception types into ProblemDetailsException for handling specific exceptions such as pydantic's ValidationError. That converted ProblemDetailsException will then be used to create the response. This should allow for flexibility when needed.

Closes

Closes #3199.

@peterschutt peterschutt requested review from a team as code owners April 5, 2024 22:50
Copy link

github-actions bot commented Apr 5, 2024

It looks like you are adding a new feature! 🚀 Please rebase and point your PR to the develop branch.

@github-actions github-actions bot added size: small type/feat area/plugins This PR involves changes to the plugins pr/internal labels Apr 8, 2024
Copy link

codecov bot commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 98.30508% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.28%. Comparing base (d10c418) to head (a9d9387).
Report is 1 commits behind head on main.

Files Patch % Lines
litestar/plugins/problem_details.py 98.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3323   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files         329      330    +1     
  Lines       14973    15032   +59     
  Branches     2383     2392    +9     
=======================================
+ Hits        14716    14774   +58     
  Misses        116      116           
- Partials      141      142    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@cofin cofin left a comment

Choose a reason for hiding this comment

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

Nice. This looks useful. LGTM

@bunny-therapist
Copy link

What is the status on this?

@peterschutt
Copy link
Contributor Author

What is the status on this?

At risk of stating the obvious, it looks like its waiting on some comments to be resolved and a rebase.

@JacobCoffee JacobCoffee requested a review from guacs April 18, 2024 00:40
@JacobCoffee JacobCoffee added this to the 2.9.0 milestone Apr 18, 2024
@guacs
Copy link
Member

guacs commented Apr 18, 2024

What is the status on this?

I'll get it fixed in a few days. I've been a bit busy.

@guacs guacs force-pushed the problem-details-plugin branch 2 times, most recently from 69f34bd to 6460f0a Compare April 21, 2024 03:29
@github-actions github-actions bot added the area/docs This PR involves changes to the documentation label Apr 21, 2024
@guacs guacs requested a review from JacobCoffee April 21, 2024 03:30
Copy link

@bunny-therapist
Copy link

This is tagged for 2.9.0 but 2.9.0 was just released. I think the milestone needs to be updated.

@Alc-Alc Alc-Alc modified the milestones: 2.9.0, 2.10.0 Jun 4, 2024
@bunny-therapist
Copy link

This is tagged for v2.10.0 but it just came out and it did not contain this at all.

@JacobCoffee
Copy link
Member

dang.. sorry about this @bunny-therapist - yeah it needed to be merged to be included - perhaps @Alc-Alc had a reason for not merging ready PRs before?

@litestar-org/maintainers

@provinzkraut provinzkraut force-pushed the problem-details-plugin branch from b8e9d58 to a81176f Compare August 25, 2024 18:04
@provinzkraut provinzkraut self-requested a review as a code owner August 25, 2024 18:04
@provinzkraut provinzkraut enabled auto-merge (squash) August 25, 2024 18:41
@provinzkraut provinzkraut merged commit 58b20bc into main Aug 25, 2024
24 checks passed
@provinzkraut provinzkraut deleted the problem-details-plugin branch August 25, 2024 18:41
Copy link

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs This PR involves changes to the documentation area/plugins This PR involves changes to the plugins pr/internal size: medium type/feat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Support for RFC 7807 / 9457
9 participants