Skip to content

Commit

Permalink
fix generateschema issues (#1442), add dependencies (#1444)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jun 21, 2024
1 parent a51f65e commit 5063bc8
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/release_cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TBA
- [ ] Update version number and date in `CHANGELOG`
- [ ] Update version number and date in `Major Changes` doc
- [ ] Ensure docs can be built without errors
- [ ] Ensure `generateschema` runs without errors or warnings (until in CI)

## Notes

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Changed
- Update download URL in ``get_chromedriver_url.py`` (#1385)
- Add ``AUTH_LDAP_USER_SEARCH_BASE`` as a Django setting (#1410)
- Change ``ATOMIC_REQUESTS`` recommendation and default to ``True`` (#1281)
- Add OpenAPI dependencies (#1444)
- **Filesfolders**
- Add migration required by Django v4.2 (#1396)
- Add app specific media type and versioning (#1278)
Expand Down Expand Up @@ -97,6 +98,8 @@ Fixed

- **General**
- ``README.rst`` badge rendering (#1402)
- **Filesfolders**
- OpenAPI ``generateschema`` errors and warnings (#1442)
- **Projectroles**
- ``SODARUser.update_full_name()`` not working with existing name (#1371)
- Legacy public guest access in child category breaks category updating (#1404)
Expand All @@ -109,8 +112,11 @@ Fixed
- Invalid URLs for remote peer projects in project detail view (#1435)
- Redundant ``Project.get_source_site()`` calls in project detail view (#1436)
- ``RemoteSite.get_access_date()`` invalid date sorting (#1437)
- OpenAPI ``generateschema`` compatibility (#1440, #1442)
- **Sodarcache**
- REST API set view ``app_name`` incorrectly set (#1405)
- **Timeline**
- OpenAPI ``generateschema`` warnings (#1442)

Removed
-------
Expand Down
8 changes: 8 additions & 0 deletions filesfolders/views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
GenericAPIView,
)
from rest_framework.renderers import JSONRenderer
from rest_framework.schemas.openapi import AutoSchema
from rest_framework.versioning import AcceptHeaderVersioning

# Projectroles dependency
Expand Down Expand Up @@ -197,6 +198,7 @@ class FolderListCreateAPIView(

pagination_class = SODARPageNumberPagination
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='ListCreateFolder')
serializer_class = FolderSerializer


Expand Down Expand Up @@ -226,6 +228,7 @@ class FolderRetrieveUpdateDestroyAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'folder'
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='UpdateDestroyFolder')
serializer_class = FolderSerializer


Expand Down Expand Up @@ -265,6 +268,7 @@ class FileListCreateAPIView(

pagination_class = SODARPageNumberPagination
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='ListCreateFile')
serializer_class = FileSerializer


Expand Down Expand Up @@ -296,6 +300,7 @@ class FileRetrieveUpdateDestroyAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'file'
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='UpdateDestroyFile')
serializer_class = FileSerializer


Expand All @@ -316,6 +321,7 @@ class FileServeAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'file'
permission_required = 'filesfolders.view_data'
schema = None


class HyperLinkListCreateAPIView(
Expand Down Expand Up @@ -352,6 +358,7 @@ class HyperLinkListCreateAPIView(

pagination_class = SODARPageNumberPagination
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='ListCreateHyperLink')
serializer_class = HyperLinkSerializer


Expand Down Expand Up @@ -382,4 +389,5 @@ class HyperLinkRetrieveUpdateDestroyAPIView(
lookup_field = 'sodar_uuid'
lookup_url_kwarg = 'hyperlink'
project_type = PROJECT_TYPE_PROJECT
schema = AutoSchema(operation_id_base='UpdateDestroyHyperLink')
serializer_class = HyperLinkSerializer
1 change: 1 addition & 0 deletions projectroles/views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class instead of SODARBaseAjaxView is needed.
allow_anonymous = False
authentication_classes = [SessionAuthentication]
renderer_classes = [JSONRenderer]
schema = None

@property
def permission_classes(self):
Expand Down
3 changes: 3 additions & 0 deletions projectroles/views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
)
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from rest_framework.schemas.openapi import AutoSchema
from rest_framework.versioning import AcceptHeaderVersioning
from rest_framework.views import APIView

Expand Down Expand Up @@ -1066,6 +1067,7 @@ class ProjectSettingRetrieveAPIView(

# NOTE: Update project settings perm is checked manually
permission_required = 'projectroles.view_project'
schema = AutoSchema(operation_id_base='AppSettingProject')
serializer_class = AppSettingSerializer

def get_object(self):
Expand Down Expand Up @@ -1237,6 +1239,7 @@ class UserSettingRetrieveAPIView(

# NOTE: Update project settings perm is checked manually
permission_required = 'projectroles.view_project'
schema = AutoSchema(operation_id_base='AppSettingUser')
serializer_class = AppSettingSerializer

def get_object(self):
Expand Down
4 changes: 4 additions & 0 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ django-debug-toolbar>=4.3.0, <4.4

# improved REPL
ipdb>=0.13.13, <0.14

# OpenAPI support
uritemplate>=4.1.1, <4.2
pyyaml>=6.0.1, <6.1
2 changes: 2 additions & 0 deletions timeline/views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from rest_framework.generics import ListAPIView, RetrieveAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.renderers import JSONRenderer
from rest_framework.schemas.openapi import AutoSchema
from rest_framework.versioning import AcceptHeaderVersioning

# Projectroles dependency
Expand Down Expand Up @@ -63,6 +64,7 @@ class ProjectTimelineEventListAPIView(

pagination_class = SODARPageNumberPagination
permission_required = 'timeline.view_timeline'
schema = AutoSchema(operation_id_base='ListTimelineEvent')
serializer_class = TimelineEventSerializer

def get_queryset(self):
Expand Down

0 comments on commit 5063bc8

Please sign in to comment.