mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 00:09:22 +00:00
### **User description** resolves https://github.com/openobserve/openobserve/issues/8658 ___ ### **PR Type** Bug fix, Enhancement ___ ### **Description** - Allow number placeholders in JSON templates - Introduce shadow JSON validation logic - Support quoted and bare placeholder replacements - Improve import and create template validation ___ ### Diagram Walkthrough ```mermaid flowchart LR AddTemplate["AddTemplate.vue validation"] -- "build shadow JSON" --> JSONParse1["Parse testBody"] ImportTemplate["ImportTemplate.vue validation"] -- "build shadow JSON" --> JSONParse2["Parse testBody"] Placeholders["Placeholders {aaa}, {bbb}"] -- "quoted -> 'test'" --> AddTemplate Placeholders -- "bare value -> 0" --> ImportTemplate ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>AddTemplate.vue</strong><dd><code>Shadow JSON validation for template body</code> </dd></summary> <hr> web/src/components/alerts/AddTemplate.vue <ul><li>Validate template body using shadow JSON.<br> <li> Replace quoted placeholders with "test".<br> <li> Replace bare value placeholders with 0.<br> <li> Preserve JSON.parse on transformed body.</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/8873/files#diff-2508a43827e6b35c07f3222deebd9945101ca6bc32b9dc592e6253ab99908bba">+12/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>ImportTemplate.vue</strong><dd><code>Import validation supports numeric placeholders</code> </dd></summary> <hr> web/src/components/alerts/ImportTemplate.vue <ul><li>Add shadow JSON logic during import validation.<br> <li> Replace quoted placeholders with "test".<br> <li> Replace bare value placeholders with 0.<br> <li> Provide clearer error on invalid JSON.</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/8873/files#diff-d22684c5142a49b8925a9dba1ef67631128caa95de66e71ba2a5b8120a0b91c6">+12/-1</a> </td> </tr> </table></td></tr></tr></tbody></table> </details> ___ --------- Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai> Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>