Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: sort inline properties recusively to prevent flaky struct field order #10

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

hidetatz
Copy link

@hidetatz hidetatz commented Oct 1, 2024

In case a resource contains another resource, it is set to InlineProperties . This InlineProperties is also a Property, so this can nest infinitely.

This PR introduces recursive property sort. Without this, nested properties are not sorted, so suppose "an object of an array of an object..." is not sorted.

resource_test.go Outdated Show resolved Hide resolved
@hidetatz hidetatz changed the title bug: sort inline properties recusively to prevente flaky struct field order bug: sort inline properties recusively to prevent flaky struct field order Oct 1, 2024
@HayatoShiba
Copy link

HayatoShiba commented Oct 1, 2024

At a glance, it seems that this line can be removed, but everything else looks good 🙏

prmdg/parser.go

Line 272 in f252a39

fld.InlineProperties = sortProperties(fld.InlineProperties)

Copy link

@HayatoShiba HayatoShiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! looks good 😆

@hidetatz hidetatz merged commit 191dee3 into master Oct 1, 2024
2 checks passed
@hidetatz hidetatz deleted the hidetatz/fix-prop-sort branch October 1, 2024 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants