feat: Add canonical serialization mode to event and variable serialization#8552
Draft
ViktorVovk wants to merge 1 commit into4ian:masterfrom
Draft
feat: Add canonical serialization mode to event and variable serialization#8552ViktorVovk wants to merge 1 commit into4ian:masterfrom
ViktorVovk wants to merge 1 commit into4ian:masterfrom
Conversation
- Introduced a global canonical mode in the Serializer class to ensure consistent JSON output. - Updated various event serialization methods to include default values and alphabetical key ordering when canonical mode is enabled. - Added support for canonical serialization in the Variable class. - Enhanced the SerializerElement to handle canonical mode during JSON conversion. - Updated related tests and preferences to accommodate the new serialization behavior.
Owner
Shouldn't this make things harder to review for a human (or even an AI) because there is less noise?
Agree it's not great and probably something we can fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
canonicalEventSerializationpreference for stable, diff-friendly event JSONProblem
GDevelop's event serialization omits properties that hold default values —
disabled,folded,inverted,awaitare only written to JSON whentrue;events,variables,subInstructions,loopIndexVariable, etc. are only written when non-empty. This causes two kinds of noise in git diffs:Both issues make per-event diffs hard to review in version-controlled projects.
Solution
Add a project-level preference
canonicalEventSerialization(opt-in, defaultfalse). When enabled:false,"",[]), so toggling a flag produces a single-line value change, not an insertion/deletion.The preference is controlled via
gdevelop-settings.yaml(already read by the IDE on project open):