Skip to content

Fix escaped JSON insertion in behavior autocomplete for PurgeFiles#14304

Closed
Sumitsh28 wants to merge 2 commits intokestra-io:developfrom
Sumitsh28:autocomplete
Closed

Fix escaped JSON insertion in behavior autocomplete for PurgeFiles#14304
Sumitsh28 wants to merge 2 commits intokestra-io:developfrom
Sumitsh28:autocomplete

Conversation

@Sumitsh28
Copy link
Contributor

✨ Description

Fixes an issue where the behavior field autocomplete in io.kestra.plugin.core.namespace.PurgeFiles inserts an escaped JSON string instead of valid YAML.

The root cause was a default value defined at schema time using @Builder.Default with 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

  • Code compiles successfully and passes all checks
  • All unit and integration tests pass

Before

image

After

image

…r is not set

Signed-off-by: Sumitsh28 <sumit.off28@gmail.com>
@github-project-automation github-project-automation bot moved this to To review in Pull Requests Jan 26, 2026
@MilosPaunovic MilosPaunovic added area/backend Needs backend code changes kind/external Pull requests raised by community contributors labels Jan 26, 2026
@loicmathieu
Copy link
Member

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.

@brian-mulier-p
Copy link
Member

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.

@Sumitsh28
Copy link
Contributor Author

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 \" replacement in the YAML completion override, just as Brian suggested. Let me know what you think!

@MilosPaunovic
Copy link
Member

Yup @Sumitsh28, absolutely, go for the FE solution PR here, thanks! 🍀

@github-project-automation github-project-automation bot moved this from To review to Done in Pull Requests Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/backend Needs backend code changes kind/external Pull requests raised by community contributors

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Autocomplete for behaviour in PurgeFiles inserts escaped JSON string

4 participants