Skip to content

Add "enforceOrder" keyword to objects #1073

Closed
@git-n-pissed

Description

@git-n-pissed

Currently the JSON Schema does not have provisions to enforce the order of fields in an object. This is a big problem when the JSON in question is source controlled and generated by disparate tools. The contents of two JSON files may be identical, but the ordering may be different which can cause massive diffs in Git.

There are many other cases where the order of fields should also be preserved. One such instance is when JSON is used to define the memory structure of an embedded device.

XSD supports this via the "sequence" element:
https://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#DefnDeclars

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