Skip to content

Instantly share code, notes, and snippets.

@Fannon
Last active August 29, 2015 14:20
Show Gist options
  • Save Fannon/1052577fe58b347798b7 to your computer and use it in GitHub Desktop.
Save Fannon/1052577fe58b347798b7 to your computer and use it in GitHub Desktop.
JSON Schema property array notation
// JSON Schema Spec
{
properties: {
// Property order is not ensured! two could come before one, but you'd never know...
one: {
id: "1" // Which ID is it now? One or 1?
type: "string"
},
two: {
type: "string"
}
},
// You'd have to define a custom propertiesOrder Array and iterate over this
// But: What if the propertiesOrder Array does not contain all properties?
propertiesOrder: [
"one",
"two"
]
}
// My suggestion:
{
properties: [
// Property order is ensured
{
id: one,
type: "string"
},
{
id: two,
type: "string"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment