i have an object in which the \"key\" of the property will be set dynamically... what is the right way of defining this in a JSON Schema?
This is what my object look
I think what you are looking for is the patternProperties
field, rather than the properties
one. Should look something like this, assuming you just want a match all pattern:
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "SomeSchema",
"description": "SomeDescription",
"type": "object",
"properties": {
"column_definitions": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/columnDef"
},
"readOnly": true
},
"row_values": {
"type": [
"array",
"null"
],
"items": {
"type": "object"
},
"readOnly": true
}
},
"definitions": {
"columnDef": {
"type": "object",
"patternProperties": {
".*": {
"type": "object",
"properties": {
"type": {
"type": [
"string",
"null"
],
"enum": [
"Text",
"Boolean",
"Numeric",
"DateTime"
],
"readOnly": true
},
"isNullable": {
"type": [
"boolean",
"null"
],
"readOnly": true
}
}
}
}
}
}
}