Skip to content

Handling different naming conventions (e.g. camelCase, PascalCase) in data objects #19

@jnnwnk

Description

@jnnwnk

We plan to use this library in a project.
Since we use JavaScript on the frontend side and C# on the backend side, we stumbled over a "problem" regarding the naming conventions in each of those languages.
We use camelCase on the frontend side and PascalCase on the backend side. Is there a way to use the same JSON Logic rules (all defined using camelCase or PascalCase) in on both sides, each using their own naming conventions in their data objects (existing configuration or similar)?

To illustrate it precisely with an example:

JSON Logic (using camelCase for the data properties)

{
  "==": [1, {"var":"myProperty"}]
}

Data (using PascalCase for the data object)

{
  "MyProperty": 1
}

Should evaluate to true

Our idea would be to provide a naming convention (camelCase, PascalCase, snake_case, kebab-case) to JsonLogicEvaluator and to use it to evaluate properties from the data object. Alternatively, when determining the values from the data object, in a simple case, one could simply make a case insensitive comparison of the names. Normally, this should not lead to collisions or the like, although it's possible.

If there is no solution for this issue so far, am I willing to create a PR, if this feature is also needed by other users? Are there any contribution guidelines or something like this?

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