xdg-ninja/json-schema/program.json
Miss Adorable 7b84d6d251
Enhance json schema (#353)
* feat: provide intellisence for configs

* feat: more constrains and hints

Provide:
- examples
- better descriptions
- url to repo

Disallow:
- space only strings

* fix: add missing titles

* fix: help keys

Use 'Not provided' placeholder

* Revert "fix: help keys"

This reverts commit 2a939cf8ae.

* fix: don't use strict JSON schema validation

* Revert "fix: don't use strict JSON schema validation"

This reverts commit 61d50085fb.

* fix: specify `type` for definition
2024-02-29 03:38:39 +01:00

66 lines
2.3 KiB
JSON

{
"$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",
"minLength": 1,
"not": {
"$ref": "#/definitions/empty"
},
"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"
]
}
}
}
}
}
}