This PR adds a new rule for linting the metadata field (disabled by default, because it's an optional field), and can be configured in the compiler config with the following JSON:
The requiredMetadata property without any additionalConfiguration entries will simply check for the presence of the metadata property in each page object. Within additionalConfiguration, the user is able to specify a requiredProperties list that indicates the properties that must be present in the metadata object.
An object in the requiredProperties array with only a name field will check only for the presence of the property and that its value is not empty (or only containing whitespace). One with a values field will check for the presence of the property, and that the value is one of the values supplied in the array.
For now, we only handle string properties and values in metadata, but this could be extended in the future to include a type property (default "string"), and can specify different metadata types and different methods of validation. See the added unit tests and the resources therein for full examples.
This PR adds a new rule for linting the metadata field (disabled by default, because it's an optional field), and can be configured in the compiler config with the following JSON:
The
requiredMetadata
property without anyadditionalConfiguration
entries will simply check for the presence of themetadata
property in each page object. WithinadditionalConfiguration
, the user is able to specify arequiredProperties
list that indicates the properties that must be present in the metadata object.An object in the
requiredProperties
array with only aname
field will check only for the presence of the property and that its value is not empty (or only containing whitespace). One with avalues
field will check for the presence of the property, and that the value is one of the values supplied in the array.For now, we only handle string properties and values in metadata, but this could be extended in the future to include a type property (default "string"), and can specify different metadata types and different methods of validation. See the added unit tests and the resources therein for full examples.