37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from typesystem.fields import Const
|
|
import typesystem
|
|
from website_generator.fields import PathField
|
|
from website_generator.actions import registry
|
|
|
|
definitions = typesystem.SchemaDefinitions()
|
|
|
|
|
|
class ActionConfig(typesystem.Schema, definitions=definitions):
|
|
name = typesystem.String()
|
|
type = typesystem.Choice(choices=registry.keys())
|
|
tags = typesystem.Array(
|
|
items=typesystem.String(),
|
|
unique_items=True,
|
|
allow_null=True,
|
|
default=list,
|
|
)
|
|
|
|
|
|
class Config(typesystem.Schema, definitions=definitions):
|
|
# TODO: Use a Version field to parse into distutils.version.LooseVersion
|
|
version = Const(const='0.1')
|
|
content_root = PathField(allow_files=False, allow_folders=True)
|
|
output_root = PathField(allow_files=False, allow_folders=True)
|
|
public_root = PathField(must_exist=False, allow_null=True, default='/')
|
|
actions = typesystem.Array(
|
|
items=typesystem.Reference(to='ActionConfig'),
|
|
min_items=1,
|
|
)
|
|
use = typesystem.Array(
|
|
items=typesystem.String(),
|
|
unique_items=True,
|
|
allow_null=True,
|
|
default=list,
|
|
)
|
|
logging = typesystem.Object(additional_properties=True, allow_null=True)
|