All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sontools.jsontools-core.1.4.source-code.validator-validator.json Maven / Gradle / Ivy

Go to download

Java JSON Tools core library. It is independent of third party libraries. It is meant to minimize transitive dependencies. Applications of the JSON tools which relate to other libraries will be in separate optional pacakges.

There is a newer version: 1.7
Show newest version
#    JSONTools - Java JSON Tools
#    Copyright (C) 2006 S.D.I.-Consulting BVBA
#    http://www.sdi-consulting.com
#    mailto://[email protected]
#
#    This library is free software; you can redistribute it and/or
#    modify it under the terms of the GNU Lesser General Public
#    License as published by the Free Software Foundation; either
#    version 2.1 of the License, or (at your option) any later version.
#
#    This library is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public
#    License along with this library; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

{
   "name":"Validator validator",
   "type":"let",
   "*":"rule",
   "rules":
   [
      ########## START ##########
      {
         "name":"rule",
         "type":"switch",
         "key":"type",
         "case":
         [
            {"values":["true", "false", "null"], "rule":{"type":"ref","*":"atom-rule"}},
            {"values":["int", "complex", "array", "object", "simple",
                       "null", "bool", "string", "number", "decimal"],
                       "rule":{"type":"ref","*":"type-rule"}},
            {"values":["not", "content"], "rule":{"type":"ref","*":"rules-rule"}},
            {"values":["and", "or"], "rule":{"type":"ref","*":"ruleset-rule"}},
            {"values":["length", "range"], "rule":{"type":"ref","*":"minmax-rule"}},
            {"values":["ref"], "rule":{"type":"ref","*":"ref-rule"}},
            {"values":["custom"], "rule":{"type":"ref","*":"custom-rule"}},
            {"values":["enum"], "rule":{"type":"ref","*":"enum-rule"}},
            {"values":["let"], "rule":{"type":"ref","*":"let-rule"}},
            {"values":["regexp"], "rule":{"type":"ref","*":"regexp-rule"}},
            {"values":["properties"], "rule":{"type":"ref","*":"properties-rule"}},
            {"values":["switch"], "rule": {"type":"ref","*":"switch-rule"}}
         ]
      },
      ########## RULESET ##########
      {
         "name":"ruleset",
         "type":"and",
         "rules":[{"type":"array"},{"type":"content","rule":{"type":"ref","*":"rule"}}]
      },
      ########## PAIRS ##########
      {
         "name":"pairs",
         "type":"and",
         "rules":[{"type":"array"},{"type":"content","rule":{"type":"ref","*":"pair"}}]
      },
      ########## PAIR ##########
      {
         "name":"pair",
         "type":"properties",
         "pairs" :
          [{"key":"key",      "optional":false, "rule":{"type":"string"}},
           {"key":"optional", "optional":false, "rule":{"type":"bool"}},
           {"key":"rule",     "optional":false, "rule":{"type":"ref","*":"rule"}}
          ]
      },
      ########## CASES ##########
      {
         "name":"cases",
         "type":"and",
         "rules":[{"type":"array"},{"type":"content","rule":{"type":"ref","*":"case"}}]
      },
      ########## CASE ##########
      {
         "name":"case",
         "type":"properties",
         "pairs" :
          [{"key":"values",   "optional":false, "rule":{"type":"array"}},
           {"key":"rule",     "optional":false, "rule":{"type":"ref","*":"rule"}}
          ]
      },
      ########## ATOM ##########
      {
         "name":"atom-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["true", "false", "null"]}}
          ]
      },
      ########## RULESET-RULE ##########
      {
         "name":"ruleset-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name",  "optional":true,  "rule":{"type":"string"}},
           {"key":"type",  "optional":false, "rule":{"type":"enum","values":["and", "or"]}},
           {"key":"rules", "optional":false, "rule":{"type":"ref","*":"ruleset"}}
          ]
      },
      ########## RULES-RULE ##########
      {
         "name":"rules-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true,  "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["not", "content"]}},
           {"key":"rule", "optional":false, "rule":{"type":"ref","*":"rule"}}
          ]
      },
      ########## TYPE ##########
      {
         "name":"type-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["int", "complex", "array", "object", "simple", "null", "bool", "string", "number", "decimal"]}}
          ]
      },
      ########## MINMAX ##########
      {
         "name":"minmax-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["length", "range"]}},
           {"key":"min", "optional":true, "rule":{"type":"number"}},
           {"key":"max", "optional":true, "rule":{"type":"number"}}
          ]
      },
      ########## REF ##########
      {
         "name":"ref-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["ref"]}},
           {"key":"*",    "optional":false, "rule":{"type":"string"}}
          ]
      },
      ########## CUSTOM ##########
      {
         "name":"custom-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["custom"]}},
           {"key":"class", "optional":true, "rule":{"type":"string"}}
          ]
      },
      ########## ENUM ##########
      {
         "name":"enum-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["enum"]}},
           {"key":"values", "optional":true, "rule":{"type":"array"}}
          ]
      },
      ########## LET ##########
      {
         "name":"let-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name",  "optional":true,  "rule":{"type":"string"}},
           {"key":"type",  "optional":false, "rule":{"type":"enum","values":["let"]}},
           {"key":"rules", "optional":false, "rule":{"type":"ref","*":"ruleset"}},
           {"key":"*",     "optional":false, "rule":{"type":"string"}}
          ]
      },
      ########## REGEXP ##########
      {
         "name":"regexp-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name", "optional":true, "rule":{"type":"string"}},
           {"key":"type", "optional":false, "rule":{"type":"enum","values":["regexp"]}},
           {"key":"pattern", "optional":false, "rule":{"type":"string"}}
          ]
      },
      ########## PROPERTIES ##########
      {
         "name":"properties-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name",  "optional":true, "rule":{"type":"string"}},
           {"key":"type",  "optional":false, "rule":{"type":"enum","values":["properties"]}},
           {"key":"pairs", "optional":false, "rule":{"type":"ref","*":"pairs"}}
          ]
      },
      ########## SWITCH ##########
      {
         "name":"switch-rule",
         "type":"properties",
         "pairs" :
          [{"key":"name",  "optional":true, "rule":{"type":"string"}},
           {"key":"type",  "optional":false, "rule":{"type":"enum","values":["switch"]}},
           {"key":"key",   "optional":false, "rule":{"type":"string"}},
           {"key":"case",  "optional":false, "rule":{"type":"ref","*":"cases"}}
          ]
      }
   ]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy