bicep
bicep copied to clipboard
Ordering of keys with objectKeys
Bicep version
Bicep CLI version 0.27.1 (4b41cb6d4b)
Describe the bug
The objectKeys function is described by:
Returns an array of object keys. Elements are consistently ordered alphabetically.
While this is technically true, it also might be ambiguous in the context of character casing.
To Reproduce
Consider:
output example3 string[] = objectKeys({ a: 1, b: 2 }) // returns [ 'a', 'b' ]
output example3a string[] = objectKeys({}) // returns []
output example3b string[] = objectKeys({ b: 2, a: 1 }) // returns [ 'a', 'b' ]
output example3c string[] = objectKeys({ A: 2, a: 1 }) // returns [ 'A', 'a' ]
output example3d string[] = objectKeys({ a: 2, A: 1 }) // returns [ 'a', 'A' ]
In short A and a from the example are not sorted.
While unlikely to occur on standard ARM resource properties in isolation. Flagging that this might cause non-deterministic behaviour that is confusing for customers.