Skip to content

[BUG] rename_keys processor: json pointers with escaped syntax fail to validate #5121

@joelmarty

Description

@joelmarty

Describe the bug
The escaped syntax for json pointers define how to build json pointers for fields that include special characters.

However, the isValidKey() method in JacksonEventKey only checks the basic character set and keys defined with the escaped syntax are rejected.

To Reproduce
Steps to reproduce the behavior:

  1. Create a pipeline with a rename_keys processor using an escaped syntax:
my-file-pipeline:
  source:
    file:
      path: run/data/events.jsonl
      record_type: event
      format: json
  sink:
    - file:
        path: "run/data/result.jsonl"
  processor:
    - rename_keys:
        entries:
          - from_key: host
            to_key: '"cs(host)"'
  1. Run data-prepper
  2. data-prepper cannot start with the error:

2024-10-28T16:35:39,367 [main] ERROR org.opensearch.dataprepper.core.validation.LoggingPluginErrorsHandler - 1. rp-pipeline-file.processor.rename_keys: caused by: Parameter "entries.null.to_key" for plugin "rename_keys" is invalid: key "cs(host)" must contain only alphanumeric chars with .-_@/ and must follow JsonPointer (ie. 'field/to/key')

Expected behavior
The to_key argument "cs(host)" should be accepted as it conforms to the documented syntax.

Screenshots
N/A

Environment (please complete the following information):

  • OS: macOs
  • Version 14.5

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    Status

    Unplanned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions