Skip to content

Commit

Permalink
Merge pull request #509 from maykinmedia/fix/508-api-schema
Browse files Browse the repository at this point in the history
🐛 [#508] Fix API schema
  • Loading branch information
SilviaAmAm authored Nov 19, 2024
2 parents 10084d7 + 8252e0f commit d8c9546
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions backend/src/openarchiefbeheer/selection/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,28 @@
),
],
)


SCHEMA_SELECTION_REQUEST = OpenApiRequest(
request={
"type": "object",
"properties": {
"items": {
"type": "array",
"description": "Filter on specific items in the selection",
"items": {"type": "string"},
}
},
},
examples=[
OpenApiExample(
"Add to the selection",
value={
"items": [
"http://zaken.nl/api/v1/zaken/111-111-111",
"http://zaken.nl/api/v1/zaken/222-222-222",
]
},
),
],
)
3 changes: 2 additions & 1 deletion backend/src/openarchiefbeheer/selection/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from ..models import AllSelectedToggle, SelectionItem
from .filtersets import SelectionItemBackend, SelectionItemFilterset
from .schemas import SCHEMA_REQUEST, SCHEMA_RESPONSE
from .schemas import SCHEMA_REQUEST, SCHEMA_RESPONSE, SCHEMA_SELECTION_REQUEST
from .serializers import (
SelectAllToggleSerializer,
SelectionItemDataReadSerializer,
Expand Down Expand Up @@ -50,6 +50,7 @@ def _get_selection_representation(self, queryset=None):
# otherwise the filter backends are not picked up. The right response is added by using
# DRF spectacular post processing hooks.
responses={200: SelectionItemDataReadSerializer(many=True)},
request=SCHEMA_SELECTION_REQUEST,
)
def post(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())
Expand Down

0 comments on commit d8c9546

Please sign in to comment.