forked from nautobot/nautobot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement REST API versioning and consolidate Job REST API endpoints (n…
…autobot#1521) * Combine JobViewSet and JobModelViewSet, branch job-list view depending on requested API version * Update REST API documentation, rework API-Version reporting in responses * Linting * More docs updates * Apply suggestions from code review Co-authored-by: Jathan McCollum <jathan@gmail.com> * Improve Swagger documentation of Job API endpoints * Add JobModel PK to JobClass serializer to ease migration Co-authored-by: Jathan McCollum <jathan@gmail.com>
- Loading branch information
1 parent
27595f7
commit fcf233e
Showing
14 changed files
with
324 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.conf import settings | ||
from django.utils.translation import gettext_lazy as _ | ||
from rest_framework.versioning import AcceptHeaderVersioning | ||
|
||
|
||
class NautobotAcceptHeaderVersioning(AcceptHeaderVersioning): | ||
"""Extend the DRF AcceptHeaderVersioning class with a more verbose rejection message.""" | ||
|
||
invalid_version_message = _('Invalid version in "Accept" header. Supported versions are %(versions)s') % { | ||
"versions": ", ".join(settings.REST_FRAMEWORK["ALLOWED_VERSIONS"]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.