Skip to content

Docs should explain that djangorestframework_camel_case needs installing to use CAMEL_CASE #774

@pjrobertson

Description

@pjrobertson

Describe the bug

EDIT: Scratch that, I didn't realise djangorestframework_camel_case was its own package.

Docs should explain that djangorestframework_camel_case would need to be installed to use 'CAMEL_CASE'


OLD ISSUE BELOW:

Import error when using camel_case postprocessor.

To Reproduce
Follow the docs to set CAMELIZE_NAME and add the camel_case postprocessor hooks:

  # Camelize names like operationId and path parameter names
    # Camelization of the operation schema itself requires the addition of
    # 'drf_spectacular.contrib.djangorestframework_camel_case.camelize_serializer_fields'
    # to POSTPROCESSING_HOOKS
    'CAMELIZE_NAMES': False,

Settings.py:

...
    'CAMELIZE_NAMES': True,
    'POSTPROCESSING_HOOKS': ['drf_spectacular.contrib.djangorestframework_camel_case.camelize_serializer_fields'],
...
  1. Try to load up the /redoc/ api view.
  2. See the error: ModuleNotFoundError: No module named 'djangorestframework_camel_case'

I think the code should read:

 from .util import camelize, camelize_re, underscore_to_camel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions