-
Notifications
You must be signed in to change notification settings - Fork 21
Description
In #1, we decided to not attach significance to the ordering of associative arrays in variables, and to adjust the test case format to suit. However, it appears that some tests added after #1 was incorporated didn't account for this. Specifically:
- (commit 8281c73)
uritemplate-test/extended-tests.json
Lines 144 to 146 in 1eb27ab
["{+keys}", "key1,val1%2F,key2,val2%2F"], ["{#keys}", "#key1,val1%2F,key2,val2%2F"], ["{keys}", "key1,val1%252F,key2,val2%252F"]
In #58, we had a report that because some implementations of JSON don't expose object ordering (as noted in the JSON RFC), so some tests were failing for them.
Having forgotten about #1, I reasoned that associative arrays are implicitly ordered, and started #63.
I think our choices are:
- Associative array ordering should be honoured by templates, so we should incorporate JSON objects -> associative arrays #63 (after more work), or
- It shouldn't, so we should incorporate Reserved expansion dictionary explode alternate ordering #58.
In either case, an errata against the spec should be filed to clarify this.
If we had a clean slate, I think (1) is the right way to go -- associative arrays are clearly ordered, the spec uses them and not hashes/dictionaries for examples, and it's downright odd/surprising for cases where ordering matters (e.g., path segments).
BUT we don't have a clean slate: we have an unknown number of implementations and several years of deployment. That argues for (2).
HOWEVER, I would note that the change in 8281c73 has been in the test cases for several years now and no one has complained about this causing issues for them until now. That seems to me to indicate that implementations are already honouring the ordering here, and that we could do (1) safely.
Data most welcome.