Altova XMLSpy 2024 Enterprise Edition

In the code listing below, the required keyword specifies that four properties are required for this object. However, of the four properties that are required, only three have been defined. The fourth property, city, is undefined. The defined properties are said to be specified, while the undefined property is said to be unspecified. See the screenshots below the listing.



JSONSpecified     JSONUnspecified

In Design View, the unspecified property is flagged in red because it is required by the schema, but is not defined. Although the JSON schema itself is valid, an instance document that is validated against it will not be valid. This is because: (i) If the city property is not present, the document will be invalid because the city property is required; (ii) If the city property is present, the document will be invalid because the city property is undefined and there is no property wildcard to allow its presence (see Implicitly Specifying a Property below) .


To create a definition for an unspecified property, do the following:


1.Select the unspecified property in Design View.

2.In the Details entry helper, check the Specified check box (see screenshot above). Alternatively, the Specified flag can be modified via the context menu.

3.Modify the property's definition as required.


Implicitly specifying a property

A property can be implicitly specified by adding a suitable pattern property or property wildcard. The screenshot below shows that a property wildcard has been added. An instance property named city will match this wildcard. In the schema, therefore, the city property is said to be implicitly specified by the wildcard. An instance file containing the city property will be valid against this schema.


Notice the respective icons in the implicitly specified property and in the property wildcard. Each icon is a link to the other property. Double-clicking one icon selects the other property.


© 2017-2023 Altova GmbH