Object Instance luci.uvl
UVL - UCI Validation Layer
Constants
STRICT_UNKNOWN_SECTIONS |
Boolean; default true; treat sections found in config but not in scheme as error |
STRICT_UNKNOWN_OPTIONS |
Boolean; default true; treat options found in config but not in scheme as error |
STRICT_EXTERNAL_VALIDATORS |
Boolean; default true; treat failed external validators as error |
STRICT_LIST_TYPE |
Boolean; default true; treat list values stored as options like errors |
Functions
| UVL (schemedir) |
Object constructor |
| UVL:get_scheme (scheme) |
Parse given scheme and return the scheme tree. |
| UVL:read_scheme (shm, alias) |
Find all parts of given scheme and construct validation tree. |
| UVL:validate (config, section, option) |
Validate given configuration, section or option. |
| UVL:validate_config (cfg) |
Validate given configuration. |
| UVL:validate_option (config, section, option) |
Validate given config option. |
| UVL:validate_section (config, section) |
Validate given config section. |
| config (scheme, co, c) |
Config instance constructor. |
| config:section (s) |
Get an associated section object. |
| config:sections () |
Get all section objects associated with this config. |
| scheme (scheme, co, c) |
Scheme instance constructor. |
| scheme:config () |
Get an associated config object. |
| scheme:error () |
Add an error to scheme. |
| scheme:section (s) |
Get an associated section object. |
| scheme:sections () |
Get all section objects associated with this scheme. |
Functions
- UVL (schemedir)
-
Object constructor
Parameters
-
schemedir: Path to the scheme directory (optional)
Return value:
Instance object
- UVL:get_scheme (scheme)
-
Parse given scheme and return the scheme tree.
Parameters
-
scheme: Name of the scheme to parse
Return values:
- Table containing the parsed scheme or nil on error
- String containing the reason for errors (if any)
- UVL:read_scheme (shm, alias)
-
Find all parts of given scheme and construct validation tree. This is normally done on demand, so you don't have to call this function by yourself.
Parameters
-
shm: Name of the scheme to parse
-
alias: Create an alias for the loaded scheme
- UVL:validate (config, section, option)
-
Validate given configuration, section or option.
Parameters
-
config: Name of the configuration to validate
-
section: Name of the section to validate (optional)
-
option: Name of the option to validate (optional)
Return values:
- Boolean indicating whether the given config validates
- String containing the reason for errors (if any)
- UVL:validate_config (cfg)
-
Validate given configuration.
Parameters
-
cfg: Name of the configuration to validate
Return values:
- Boolean indicating whether the given config validates
- String containing the reason for errors (if any)
- UVL:validate_option (config, section, option)
-
Validate given config option.
Parameters
-
config: Name of the configuration to validate
-
section: Name of the section to validate
-
option: Name of the option to validate
Return values:
- Boolean indicating whether the given config validates
- String containing the reason for errors (if any)
- UVL:validate_section (config, section)
-
Validate given config section.
Parameters
-
config: Name of the configuration to validate
-
section: Name of the section to validate
Return values:
- Boolean indicating whether the given config validates
- String containing the reason for errors (if any)
- config (scheme, co, c)
-
Config instance constructor.
Parameters
-
scheme: Scheme instance
-
co: Configuration data
-
c: Configuration name
Return value:
Config instance
- config:section (s)
-
Get an associated section object.
Parameters
Return value:
Section instance
- config:sections ()
-
Get all section objects associated with this config.
Return value:
Table containing all associated luci.uvl.section instances
- scheme (scheme, co, c)
-
Scheme instance constructor.
Parameters
-
scheme: Scheme instance
-
co: Configuration data
-
c: Configuration name
Return value:
Config instance
- scheme:config ()
-
Get an associated config object.
Return value:
Config instance
- scheme:error ()
-
Add an error to scheme.
Return value:
Scheme error context
- scheme:section (s)
-
Get an associated section object.
Parameters
Return value:
Section instance
- scheme:sections ()
-
Get all section objects associated with this scheme.
Return value:
Table containing all associated luci.uvl.section instances