Skip to content

Conversation

@ObadaS
Copy link
Collaborator

@ObadaS ObadaS commented Sep 23, 2025

@ mention of reviewers

@ihsaan-ullah

A brief description of the purpose of the changes contained in this PR.

This fixes the API docs not loading anymore by adding the swagger_spec_validator package into poetry.

This was the error we get on local instances when trying to open localhost/api/docs

Internal Server Error: /api/docs/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/asgiref/sync.py", line 489, in thread_handler
    raise exc_info[1]
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 38, in inner
    response = await get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 263, in _get_response_async
    response = await sync_to_async(response.render, thread_sensitive=True)()
  File "/usr/local/lib/python3.9/site-packages/asgiref/sync.py", line 439, in __call__
    ret = await asyncio.shield(exec_coro)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/asgiref/sync.py", line 493, in thread_handler
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/usr/local/lib/python3.9/site-packages/rest_framework/response.py", line 70, in rendered_content
    ret = renderer.render(self.data, accepted_media_type, context)
  File "/usr/local/lib/python3.9/site-packages/drf_yasg2/renderers.py", line 39, in render
    return codec.encode(data)
  File "/usr/local/lib/python3.9/site-packages/drf_yasg2/codecs.py", line 75, in encode
    VALIDATORS[validator](copy.deepcopy(spec))
  File "/usr/local/lib/python3.9/site-packages/drf_yasg2/codecs.py", line 30, in _validate_swagger_spec_validator
    from swagger_spec_validator.common import SwaggerValidationError as SSVErr
ModuleNotFoundError: No module named 'swagger_spec_validator'

I am not sure why it used to work before then suddenly stopped working.

Issues this PR resolves

#1997

To test, simply try to open localhost/api/docs

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ihsaan-ullah ihsaan-ullah self-assigned this Sep 24, 2025
@ihsaan-ullah
Copy link
Collaborator

@ObadaS we need to document the process of updating packages somewhere. e.g.

Step 1: Make changes in pyproject.toml file
Step 2: Create poetry.lock using the updated toml file using the following commands

# command 1

# command 2

@ihsaan-ullah
Copy link
Collaborator

ihsaan-ullah commented Sep 24, 2025

Test

✅ Tested this locally. It works fine

@ihsaan-ullah ihsaan-ullah linked an issue Sep 24, 2025 that may be closed by this pull request
@Didayolo Didayolo merged commit 2e95f84 into develop Sep 25, 2025
1 check passed
@Didayolo Didayolo deleted the apiFix branch September 25, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codabench API docs

4 participants