karmada
karmada copied to clipboard
proposal for overriding values inside structured data files
What type of PR is this?
/kind design /kind documentation
What this PR does / why we need it: Overriding values in structured data files (e.g., JSON, YAML) to simplify modifications.
Which issue(s) this PR fixes: Fixes #5330
Special notes for your reviewer: Related PR: #5329
Does this PR introduce a user-facing change?:
Introduced `PlaintextObjectOverrider` for overriding values in YAML or JSON plaintext objects.
Welcome @sophiefeifeifeiya! It looks like this is your first PR to karmada-io/karmada 🎉
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 34.85%. Comparing base (
5f7fc4f) to head (0682184).
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #5449 +/- ##
=======================================
Coverage 34.84% 34.85%
=======================================
Files 645 645
Lines 44861 44861
=======================================
+ Hits 15633 15636 +3
+ Misses 28021 28020 -1
+ Partials 1207 1205 -2
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 34.85% <ø> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Updates
Some updates after testing:
-
The issue with “Explicit Type Tags” in Plan 1 of the YAML implementation (yaml -> json -> yaml) was identified as follows:
number: !!int 12345 string: !!str 6789 # after transformation number: 12345 string: "6789"
In this process, the explicit type tags are removed, and the values are transformed into the data types indicated by the tags. However, this previously identified issue has now been resolved.
-
After testing Plan2 ytt, it still has the same problem as Plan 1.
As we have to use encapsulate it, and teh grammar of ytt is quite different from JSON, Plan 1 is preferable.
-
Final API design is in the proposal. Maybe some tiny changes can be made. Feel free to give suggestions.
The proposal is modified again, and you can refer to new modified proposal.
Conclusion
Thus, for the YAML implementation, Plan 1 is preferable. However, it’s important to inform users that: 1. Dates and times may result in data type loss. 2. Anchors (&) and aliases (*) used for referencing and reusing values will be hardcoded after transformation.
What do you guys think about? @Patrick0308 @chaunceyjiang @XiShanYongYe-Chang
At the same time cc @RainbowMango
@chaunceyjiang: GitHub didn't allow me to request PR reviews from the following users: Patrick0308.
Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs.
In response to this:
LGTM.
/cc @Patrick0308 @RainbowMango
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: chaunceyjiang
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [chaunceyjiang]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment