Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
fix: Use a deterministic ordering for rest placeholders (#3333)
Browse files Browse the repository at this point in the history
Deterministic outputs are required for automated testing of the micro-generator when comparing outputs between generators

Co-authored-by: Brent Shaffer <[email protected]>
  • Loading branch information
chrisdunelm and bshaffer authored Jan 21, 2021
1 parent 1d7141f commit 267e4dd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ private List<RestPlaceholderConfigView> generateRestPlaceholderConfigViews(
SurfaceNamer namer, Set<String> templateVars) {
List<RestPlaceholderConfigView> placeholderViews = new ArrayList<>(templateVars.size());

for (String var : templateVars) {
List<String> templateVarsList = new ArrayList<>(templateVars);
Collections.sort(templateVarsList);
for (String var : templateVarsList) {
placeholderViews.add(generateRestPlaceholderConfigView(namer, var));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5579,14 +5579,14 @@ return [
],
],
'placeholders' => [
'name' => [
'alt_book_name' => [
'getters' => [
'getName',
'getAltBookName',
],
],
'alt_book_name' => [
'name' => [
'getters' => [
'getAltBookName',
'getName',
],
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6639,14 +6639,14 @@ return [
],
],
'placeholders' => [
'name' => [
'alt_book_name' => [
'getters' => [
'getName',
'getAltBookName',
],
],
'alt_book_name' => [
'name' => [
'getters' => [
'getAltBookName',
'getName',
],
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3843,14 +3843,14 @@ return [
],
],
'placeholders' => [
'name' => [
'alt_book_name' => [
'getters' => [
'getName',
'getAltBookName',
],
],
'alt_book_name' => [
'name' => [
'getters' => [
'getAltBookName',
'getName',
],
],
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6658,14 +6658,14 @@ return [
],
],
'placeholders' => [
'name' => [
'alt_book_name' => [
'getters' => [
'getName',
'getAltBookName',
],
],
'alt_book_name' => [
'name' => [
'getters' => [
'getAltBookName',
'getName',
],
],
]
Expand Down

0 comments on commit 267e4dd

Please sign in to comment.