fix: Ensure autopatch processes properties in the same order every time - #1079
fix: Ensure autopatch processes properties in the same order every time#1079lucaspopp-wbd wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1079 +/- ##
=======================================
Coverage 93.22% 93.23%
=======================================
Files 23 23
Lines 4976 4982 +6
=======================================
+ Hits 4639 4645 +6
Misses 271 271
Partials 66 66 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the PR, but I don't think this change can affect the generated schema.
The tests only exercise Two things that may be closer to what you're seeing:
If we do keep the sort, I'd inline it rather than add a helper, matching for _, k := range slices.Sorted(maps.Keys(s.Properties)) {
optionalSchema.Properties[k] = makeOptionalSchema(s.Properties[k])
} |
|
Good point! Closed the PR :) |
Since map iterators return properties in a random order, autopatch schemas can fluctuate when multiple fields use the same type.
This change ensures fields are processed in a deterministic order (sorted by name) to avoid type name fluctuations.