Skip to content

./manage.py generateschema: AttributeError: 'NoneType' object has no attribute 'query_params' #8237

Discussion options

You must be logged in to vote

I was able to fix this by using a custom implementation of SchemaGenerator.

class MockedSchemaGenerator(SchemaGenerator):

    def get_schema(self, request=None, public=False):

        mock_request = Request(HttpRequest())
        mock_request.auth = ...

        return super().get_schema(request=mock_request, public=False)

Note the public=False part, it's very important.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bradydean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant