Skip to content

Commit d8c9546

Browse files
authored
Merge pull request #509 from maykinmedia/fix/508-api-schema
🐛 [#508] Fix API schema
2 parents 10084d7 + 8252e0f commit d8c9546

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

backend/src/openarchiefbeheer/selection/api/schemas.py

+25
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,28 @@
5757
),
5858
],
5959
)
60+
61+
62+
SCHEMA_SELECTION_REQUEST = OpenApiRequest(
63+
request={
64+
"type": "object",
65+
"properties": {
66+
"items": {
67+
"type": "array",
68+
"description": "Filter on specific items in the selection",
69+
"items": {"type": "string"},
70+
}
71+
},
72+
},
73+
examples=[
74+
OpenApiExample(
75+
"Add to the selection",
76+
value={
77+
"items": [
78+
"http://zaken.nl/api/v1/zaken/111-111-111",
79+
"http://zaken.nl/api/v1/zaken/222-222-222",
80+
]
81+
},
82+
),
83+
],
84+
)

backend/src/openarchiefbeheer/selection/api/views.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

0 commit comments

Comments
 (0)