Skip to content

Ordering, Associative Arrays, and JSON Objects #62

@mnot

Description

@mnot

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:

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:

  1. Associative array ordering should be honoured by templates, so we should incorporate JSON objects -> associative arrays #63 (after more work), or
  2. 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.

/CC @jcgregorio @royfielding @hadleynet @DavidOrchard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions