Key values of 'key' and 'type' in json schema

2k views Asked by At

I am given to understand that the words type and id are reserved words in json schema. Is there any way to set these as keys in json schema? Here is an example of what I am trying to do.

"id": {
    "type": "string"
},
"featureType": {
    "type": "string"
},
"type": {
    "type": "string"
}

I have tried validating this using a number of tools (including here). Googling around yields no suggestions either. Any help much appreciated. Cheers!

1

There are 1 answers

1
erosb On

The snippet you pasted above will most probably work. "type" and "id" are reserved keys, but they have special meaning only in case their corresponding value is a string. Since the values are objects in your case, there is no problem. I'm not 100% sure if the json schema spec explicitly states this, but this is how implementations work usually.