Skip to content

Add django decorator - #976

Merged
p1c2u merged 6 commits into
python-openapi:masterfrom
mik-laj:django-decorator
Mar 19, 2025
Merged

Add django decorator#976
p1c2u merged 6 commits into
python-openapi:masterfrom
mik-laj:django-decorator

Conversation

@mik-laj

Copy link
Copy Markdown
Contributor

Hello,

I have a project where I would like to be able to configure specifications for each view separately, because we have several API variants, and therefore several specification files.

This is very inspired by the approach used by Flask integrations.

Best regards,
Kamil Breguła

if not hasattr(settings, "OPENAPI"):
if not hasattr(settings, "OPENAPI_SPEC"):
raise ImproperlyConfigured(
"OPENAPI_SPEC not defined in settings"

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

OPENAPI_SPEC is a depreacted, so we should suggest to use OPENAPI.

@codecov

codecovBot commented Mar 19, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 83.01887% with 9 lines in your changes missing coverage. Please review.

Project coverage is 90.62%. Comparing base (c8db221) to head (ca6044e).
Report is 45 commits behind head on master.

Files with missing linesPatch %Lines
openapi_core/contrib/django/providers.py58.33%4 Missing and 1 partial ⚠️
openapi_core/contrib/django/decorators.py89.74%2 Missing and 2 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## master #976 +/- ##
==========================================
+ Coverage 90.36% 90.62% +0.26% 
==========================================
Files 148 150 +2 Lines 4328 4374 +46 Branches 529 532 +3 ==========================================
+ Hits 3911 3964 +53 - Misses 316 318 +2 + Partials 101 92 -9 

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment threaddocs/integrations/django.md Outdated

@p1c2up1c2u left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just one suggestion otherwise looks good 💪

mik-lajand others added 2 commits March 19, 2025 19:36
Co-authored-by: Artur Maciag <maciag.artur@gmail.com>
@p1c2u

Copy link
Copy Markdown
Collaborator

Thank you for the contribution

@p1c2u
p1c2u merged commit 32345fd into python-openapi:masterMar 19, 2025
Sign up for freeto 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

@mik-laj@p1c2u