X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/xdg-ninja.git/blobdiff_plain/89a2d42e13509b929cac40bb9cab22397b9c31d2..7673416b9b1d48a96e4c14cbbdbd2eee6c560566:/json-schema/program.json?ds=sidebyside diff --git a/json-schema/program.json b/json-schema/program.json index d569273..2dc75f3 100644 --- a/json-schema/program.json +++ b/json-schema/program.json @@ -1,24 +1,66 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Program", - "description": "Specification of files or folders in the $HOME folder for a program", - "properties": { - "name": { + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "empty": { + "type": "string", + "pattern": "^\\s+$" + } + }, + "title": "specification", + "description": "A specification of files or folders in the $HOME folder for a program\nhttps://github.com/b3nj5m1n/xdg-ninja", + "type": "object", + "required": ["name", "files"], + "properties": { + "name": { + "title": "name", + "description": "A program name\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja", + "type": "string", + "minLength": 1, + "not": { + "$ref": "#/definitions/empty" + }, + "examples": ["abook"] + }, + "files": { + "title": "files", + "description": "Files and folders for a program\nhttps://github.com/b3nj5m1n/xdg-ninja", + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "description": "A file or a folder for a program\nhttps://github.com/b3nj5m1n/xdg-ninja", + "type": "object", + "required": ["path", "movable", "help"], + "properties": { + "path": { + "title": "path", + "description": "A path to a file or a folder\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja", + "type": "string", + "minLength": 1, + "not": { + "$ref": "#/definitions/empty" + }, + "examples": ["$HOME/.abook"] + }, + "movable": { + "title": "movable", + "description": "Whether a file or a folder is movable to a place other than $HOME\nhttps://github.com/b3nj5m1n/xdg-ninja", + "type": "boolean" + }, + "help": { + "title": "help", + "description": "A help message for a user in markdown\nRestrictions:\n- can't contain just spaces\nhttps://github.com/b3nj5m1n/xdg-ninja", "type": "string", - "description": "Name of the program", - "minLength": 1 - }, - "files": { - "description": "List of files (or folders) associated with the program", - "type": "array", - "items": { - "$ref": "file.json" + "minLength": 1, + "not": { + "$ref": "#/definitions/empty" }, - "minItems": 1 + "examples": [ + "Alias abook to use custom locations for configuration and data:\n\n```bash\nalias abook=abook --config \"$XDG_CONFIG_HOME\"/abook/abookrc --datafile \"$XDG_DATA_HOME\"/abook/addressbook\n```\n" + ] + } } - }, - "required": [ - "name", - "files" - ] -} \ No newline at end of file + } + } + } +}