Describe the bug
When applying a JSON patch com.linkedin.metadata.aspect.patch.template.TemplateUtil#populateTopLevelKeys uses a JsonPatch as a template for a node to transform.
JsonPatch objects will have / and ~ encoded as ~1 and ~0 respectively. This needs to be converted back when creating an object based on the paths of a JSON Patch
To Reproduce
Steps to reproduce the behavior:
Trigger a metadata change that will apply a patch to a column name with a / in it:
{\"op\": \"add\", \"path\": \"/fineGrainedLineages/NONE/urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,my_database.my_schema.my_table,PROD),slash is ~1)", \"value\": {\"confidenceScore\": 1.0}}
Run ingestion pipeline
See error
Expected behavior
The "target" object should have a key with the slash unescaped so it looks something like this:
{"/fineGrainedLineages/NONE/urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,my_database.my_schema.my_table,PROD),slash is /)" : {}}
However, the target retains the encoded / so it looks like this:
{"/fineGrainedLineages/NONE/urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,my_database.my_schema.my_table,PROD),slash is ~1)" : {}}
However, the JSON Pointer logic correctly tries to find:
"/fineGrainedLineages/NONE/urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,my_database.my_schema.my_table,PROD),slash is /)"
Describe the bug When applying a JSON patch
com.linkedin.metadata.aspect.patch.template.TemplateUtil#populateTopLevelKeys
uses aJsonPatch
as a template for a node to transform.JsonPatch
objects will have/
and~
encoded as~1
and~0
respectively. This needs to be converted back when creating an object based on the paths of a JSON PatchTo Reproduce Steps to reproduce the behavior:
/
in it:Expected behavior The "target" object should have a key with the slash unescaped so it looks something like this:
However, the target retains the encoded
/
so it looks like this:{"/fineGrainedLineages/NONE/urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,my_database.my_schema.my_table,PROD),slash is ~1)" : {}}
However, the JSON Pointer logic correctly tries to find:
"/fineGrainedLineages/NONE/urn:li:schemaField:(urn:li:dataset:(urn:li:dataPlatform:snowflake,my_database.my_schema.my_table,PROD),slash is /)"
Additional context This logic would fix it