Fix escaped JSON insertion in behavior autocomplete for PurgeFiles#14304
Fix escaped JSON insertion in behavior autocomplete for PurgeFiles#14304Sumitsh28 wants to merge 2 commits intokestra-io:developfrom
behavior autocomplete for PurgeFiles#14304Conversation
…r is not set Signed-off-by: Sumitsh28 <sumit.off28@gmail.com>
|
We use default values in attributes everywhere so if it's causing an issue with autocompletion it's concerning as we will not fix possibly hundreds of plugins that uses the same mechanism. Maybe @brian-mulier-p or @Skraye that have more knownledge on this area can have a look. |
|
I agree with Loïc that it's not reliable to fix it in every plugin and it's not a true fix because you may prefer to be able to edit default value. I would reprocess the autocompletion values with " replaced with " directly in our default yaml completion override (frontend) and then later on check if we can figure out a way to replace json values with yaml values but that's for later and a tricky subject. A simple replace for now will achieve good enough result as yaml also accepts json (as long as we remove that " escape). I would honestly close this PR in favor of a frontend one. |
|
Hi @loicmathieu and @brian-mulier-p, Thanks for the review and the detailed explanation. I completely agree, handling this centrally rather than patching individual plugins makes much more sense for scalability. Since I've contributed to the frontend and have familiarity with the codebase, would you like me to take a stab at this frontend fix? If you're good with that, I can close this PR and open a new one to implement the |
|
Yup @Sumitsh28, absolutely, go for the FE solution PR here, thanks! 🍀 |
✨ Description
Fixes an issue where the
behaviorfield autocomplete inio.kestra.plugin.core.namespace.PurgeFilesinserts an escaped JSON string instead of valid YAML.The root cause was a default value defined at schema time using
@Builder.Defaultwith a complex object (Property.ofValue(Version)), which caused the UI to serialize the default as escaped JSON.This PR removes the schema-level default and applies the default purge behavior (keep last 1 version) at runtime instead, ensuring correct YAML insertion while preserving existing behavior.
🔗 Related Issue
Closes #14113
🛠️ Backend Checklist
Before
After