Skip to content

Commit

Permalink
[#5074] Use camel_to_underscore from the library instead of re-implem…
Browse files Browse the repository at this point in the history
…enting this
  • Loading branch information
vaszig committed Mar 7, 2025
1 parent 205314b commit ff781a7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
7 changes: 0 additions & 7 deletions src/openforms/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ def underscore_to_camel(input_: str | int) -> str:
return re.sub(camelize_re, _underscore_to_camel, input_)


def camel_to_underscore(input: str) -> str:
"""
Convert a string from camelCase to snake_case
"""
return re.sub(r"(?<!^)(?=[A-Z])", "_", input).lower()


def get_from_serializer_data_or_instance(
field: str, data: Mapping, serializer: Serializer
) -> Any:
Expand Down
2 changes: 1 addition & 1 deletion src/openforms/registrations/contrib/json_dump/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from django.db.models.functions import Coalesce, NullIf
from django.utils.translation import gettext_lazy as _

from djangorestframework_camel_case.util import camel_to_underscore
from zgw_consumers.client import build_client

from openforms.api.utils import camel_to_underscore
from openforms.formio.constants import DataSrcOptions
from openforms.formio.service import rewrite_formio_components
from openforms.formio.typing import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from datetime import date, datetime
from typing import assert_never, cast

from djangorestframework_camel_case.util import camel_to_underscore
from glom import Assign, Path, glom

from openforms.api.utils import camel_to_underscore, underscore_to_camel
from openforms.api.utils import underscore_to_camel
from openforms.formio.service import FormioData
from openforms.formio.typing import Component, EditGridComponent
from openforms.formio.typing.vanilla import FileComponent
Expand Down

0 comments on commit ff781a7

Please sign in to comment.