Liquid XML Studio 2019
PropertyNames
JSON Schema Editor > Graphical Notation Overview > Properties Container > PropertyNames
Draft 04 Draft 06 Draft 07

The propertyNames property makes it possible to define rules that specify the property names that are allowable within the JSON Instance object.

Example JSON Schema
Copy Code
"MyObject": {
    "type": "object",
    "additionalProperties": {
        "type": "string"
    },
    "propertyNames": {
        "type": "string",
        "pattern": "VAL_\\d+"
    }
},

In this example "MyObject" is describes an object that can contain string properties with any name. The Property Names rules imposes a limitation on the property names, specifying that they must match the Pattern (regular expression) "VAL_\d+".

Example JSON Instance Document
Copy Code
"MyObject": {
    "VAL_1" : "My Value",
    "VAL_4" : "My Value",
    "VAL_0001" : "",
    "VAL_1" : "Some other value"
}

The functionality is very similar to Pattern Properties, but allows more control and can be easier to read.