path: root/aconf/model/field.lua
diff options
authorKaarle Ritvanen <>2015-04-02 16:34:13 +0300
committerKaarle Ritvanen <>2015-04-03 00:45:53 +0300
commit3baaf91de453d35b095881478be8d88b3fc2b97a (patch)
treedbeeedc851f0d8130907574ef8506904c5c44570 /aconf/model/field.lua
parentc7bce46f22ff9c41e3598d42400368d3c733316c (diff)
initial developer documentation
descriptions for all functions and classes used by the openssh module
Diffstat (limited to 'aconf/model/field.lua')
1 files changed, 38 insertions, 0 deletions
diff --git a/aconf/model/field.lua b/aconf/model/field.lua
index 6e4607f..1b44931 100644
--- a/aconf/model/field.lua
+++ b/aconf/model/field.lua
@@ -3,6 +3,7 @@ Copyright (c) 2012-2015 Kaarle Ritvanen
See LICENSE file for license details
+--- @module aconf.model
local M = {}
local err = require('aconf.error')
@@ -56,6 +57,39 @@ function M.conv_filter(filter)
+--- base class for fields. The constructor accepts a table argument
+-- containing field parameters as key&ndash;value pairs. The parameters
+-- listed below are valid for all subclasses. Subclasses may define
+-- additional parameters.
+-- @klass Field
+-- @tparam ?string addr back-end address for the field. This can be an
+-- absolute address or relative to the parent's address. The top-level
+-- component of a back-end address specifies the back-end. The
+-- interpretation of the remaining components is specific to the
+-- back-end. If not specified, the address is formed by appending the
+-- field's name to the address of the parent.
+-- @tparam ?|nil|string|{[string]=string,...} be_mode controls how the
+-- Augeas back-end will map addresses to Augeas paths. By default,
+-- each component of a back-end address is directly mapped to an
+-- Augeas path component. This parameter is an exception table
+-- applicable to the subtree defined by the field's address. Each key
+-- is a relative address pattern, and the corresponding value is a
+-- directive applied to matching address components. The *enumerate*
+-- directive indicates there can be several Augeas nodes matching the
+-- path and the next component is to be interpreted as an index for
+-- such nodes. The *parent-value* directive is applicable only to
+-- primitive fields and instructs the back-end not to append the last
+-- address component at all, causing the parent node's value to be
+-- accessed. If the *be\_mode* parameter is defined as a string, it is
+-- assumed to be a directive applicable to the field's own address.
+-- @tparam nil|{any|{any,string},...} choice array of allowed
+-- values. Each value may be a primitive value or a tuple specifying
+-- the value used by the data model and a user-friendly value.
+-- @tparam ?any default default value for the field
+-- @tparam ?boolean required field must be assigned a value if set,
+-- defaults to false
+-- @tparam ?string ui_name user-friendly name for the field.
M.Field = class(M.Member)
function M.Field:init(params)
@@ -263,6 +297,8 @@ function Primitive:validate(context, value)
+--- string field, inherits @{Field}.
+-- @klass String
M.String = class(Primitive)
function M.String:init(params)
@@ -317,6 +353,8 @@ function M.Integer:validate(context, value)
+--- boolean field, inherits @{Field}.
+-- @klass Boolean
M.Boolean = class(Primitive)
function M.Boolean:init(params)