mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 19:56:48 +00:00
fix(api): typed URLs and accurate response schemas
- Routers use path converters (use_regex_path=False): computes, instances and flavors take <int:...> ids, so non-numeric ids get 404 and drf-spectacular derives the parameter types itself. - Each method declares what it really returns: detail serializers, a shared StatusSerializer for status-only replies, no request body for actions. Instance properties used by the details serializer get return type hints. - The create-instance API drops the firmware field. Its only accepted value was "" (BIOS), which produced an empty, invalid enum, and the UEFI branch behind it was unreachable. Clients that still send it are unaffected; DRF ignores unknown fields. The schema now passes spectacular --validate --fail-on-warn; a test keeps it that way.
This commit is contained in:
parent
61208606f7
commit
3b8869c72f
10 changed files with 95 additions and 49 deletions
|
|
@ -14,6 +14,7 @@ class InterfaceViewSet(viewsets.ViewSet):
|
|||
"""
|
||||
|
||||
permission_classes = [IsSuperUser]
|
||||
serializer_class = InterfacesSerializer
|
||||
|
||||
def list(self, request, compute_pk=None):
|
||||
queryset = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue