[BUG] Current support for setting JSON pointer values in Event
Describe the bug
The JacksonEvent put operation does not honor JSON pointer operations
To Reproduce Steps to reproduce the behavior:
- Configure an
add_entriesprocessor
processor:
- add_entries:
entries:
- key: z~1y
value: "some_value"
- Observe the literal key
z~1yinstead of literal keyz/y
Expected behavior
Create a literal, but not nested, key for z~1y
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. Ubuntu 20.04 LTS]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
Hey @graytaylor0! 👋
I'd love to take a crack at this one if it's still available!
Looking at the setNode method in JacksonEvent.java, when we do a put operation, the leafKey goes straight into ((ObjectNode) parentNode).set(leafKey, valueNode) without any JSON Pointer unescaping. So if someone tries put("z~1y", value), it creates a field literally called z~1y instead of z/y.
This seems similar to what was described in #5953 for the delete operation. The fix would involve unescaping the JSON Pointer notation (like ~1 → /) before we set the value on the ObjectNode.
I'd also make sure to add tests covering keys with slashes, tildes, and other special characters to prevent this from popping up again.
Sound good? Let me know if there's anything specific I should keep in mind!