Skip to content

Return the keys of dictionaries in order #407

@farcaller

Description

@farcaller

Using jsonnet with k8s I've noticed an interesting pattern—whenever you specify a list of key-value strings in k8s, jsonnet's objects work better. One way to use that is to map command line aruments, e.g.

args_+: {
  tls_cert: '/abc',
  tls_key: '/def',
}

becomes

--tls-cert=/abc --tls-key=/def

One problem with that approach is that jsonnet sorts all the keys, thus making it very hard to deal with situations when key order is important.

I'd like to see a mechanism to turn objects into what's basically an OrderedDict of python.

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