Class ItemsValidator

  • All Implemented Interfaces:
    JsonValidator

    public class ItemsValidator
    extends BaseJsonValidator
    A validator (keyed off items) that either defines a schema for all items in an arbitrarily long sequence, or a validator with a fixed set of schemas - both the contents and the number of those child schemas must match to be valid.
    • Constructor Detail

      • ItemsValidator

        public ItemsValidator​(java.lang.String schemaPath,
                              com.inductiveautomation.ignition.common.gson.JsonElement schemaNode,
                              JsonSchema parentSchema)
    • Method Detail

      • findSchemaForIndex

        public java.util.Optional<JsonSchema> findSchemaForIndex​(int index)
      • getSchemas

        public java.util.List<JsonSchema> getSchemas()
        Returns:
        a sequence of schemas underneath this validator.
      • isBoundedSchema

        public boolean isBoundedSchema()
        Returns:
        true if this validator is constrained to a fixed sequence of items, or false if it applies a schema to all items in an arbitrary sequence.
      • validate

        public java.util.Set<ValidationMessage> validate​(com.inductiveautomation.ignition.common.gson.JsonElement node,
                                                         com.inductiveautomation.ignition.common.gson.JsonElement rootNode,
                                                         java.lang.String at)
        Description copied from interface: JsonValidator
        Validate the given JsonElement, the given node is the child node of the root node at given data path.
        Parameters:
        node - JsonElement
        rootNode - JsonElement
        at - String
        Returns:
        A list of ValidationMessage if there is any validation error, or an empty list if there is no error.
      • deriveDefaultArray

        public com.inductiveautomation.ignition.common.gson.JsonArray deriveDefaultArray()
      • deriveDefaultArray

        public com.inductiveautomation.ignition.common.gson.JsonArray deriveDefaultArray​(boolean includeExample)
      • getDefaultItem

        public java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonElement> getDefaultItem()