Skip to content

OpenAPI spec generation warnings #119

@s-sajid-ali

Description

@s-sajid-ali

Warnings from drf-spectacular:

~/D/p/rts-coldfront (openapi)> PLUGIN_API=True uv run --dev manage.py spectacular --file openapi.yaml
path/packages/rts-coldfront/coldfront/plugins/api/views.py:217: Warning [AllocationChangeRequestViewSet]: Failed to obtain model through view's queryset due to raised exception. Prevent this either by setting "queryset = Model.objects.none()" on the view, checking for "getattr(self, "swagger_fake_view", False)" in get_queryset() or by simply using @extend_schema. (Exception: Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x10d789af0>.)
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:36: Warning [AllocationChangeRequestViewSet > AllocationChangeRequestSerializer > AllocationSerializer]: unable to resolve type hint for function "get_resources_as_string". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:36: Warning [AllocationChangeRequestViewSet > AllocationChangeRequestSerializer > AllocationSerializer]: unable to resolve type hint for function "get_allocation_users". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:36: Warning [AllocationChangeRequestViewSet > AllocationChangeRequestSerializer > AllocationSerializer]: unable to resolve type hint for function "get_allocation_attributes". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:123: Warning [AllocationChangeRequestViewSet > AllocationChangeRequestSerializer]: unable to resolve type hint for function "get_created_by". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:123: Warning [AllocationChangeRequestViewSet > AllocationChangeRequestSerializer]: unable to resolve type hint for function "get_fulfilled_by". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/views.py:217: Warning [AllocationChangeRequestViewSet]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. <int:id>) or annotating the parameter type with @extend_schema. Defaulting to "string".
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:84: Warning [AllocationRequestViewSet > AllocationRequestSerializer]: unable to resolve type hint for function "get_resources_as_string". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:84: Warning [AllocationRequestViewSet > AllocationRequestSerializer]: unable to resolve type hint for function "get_created_by". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:84: Warning [AllocationRequestViewSet > AllocationRequestSerializer]: unable to resolve type hint for function "get_fulfilled_by". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/views.py:30: Warning [AllocationViewSet]: Failed to obtain model through view's queryset due to raised exception. Prevent this either by setting "queryset = Model.objects.none()" on the view, checking for "getattr(self, "swagger_fake_view", False)" in get_queryset() or by simply using @extend_schema. (Exception: Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x10d7e4bf0>.)
path/packages/rts-coldfront/coldfront/plugins/api/views.py:30: Warning [AllocationViewSet]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. <int:id>) or annotating the parameter type with @extend_schema. Defaulting to "string".
path/packages/rts-coldfront/coldfront/plugins/api/views.py:285: Warning [ProjectViewSet]: Failed to obtain model through view's queryset due to raised exception. Prevent this either by setting "queryset = Model.objects.none()" on the view, checking for "getattr(self, "swagger_fake_view", False)" in get_queryset() or by simply using @extend_schema. (Exception: Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x10d7e5f40>.)
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:189: Warning [ProjectViewSet > ProjectSerializer]: unable to resolve type hint for function "get_project_users". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:189: Warning [ProjectViewSet > ProjectSerializer]: unable to resolve type hint for function "get_allocations". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/serializers.py:189: Warning [ProjectViewSet > ProjectSerializer]: unable to resolve type hint for function "get_project_attributes". Consider using a type hint or @extend_schema_field. Defaulting to string.
path/packages/rts-coldfront/coldfront/plugins/api/views.py:285: Warning [ProjectViewSet]: could not derive type of path parameter "id" because it is untyped and obtaining queryset from the viewset failed. Consider adding a type to the path (e.g. <int:id>) or annotating the parameter type with @extend_schema. Defaulting to "string".

Schema generation summary:
Warnings: 17 (17 unique)
Errors:   0 (0 unique)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions