feat: Add JSON schema for settings

pull/47/head
Robert Dailey 3 years ago
parent dfb981ffc2
commit d540cf37c9

@ -11,8 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- New settings file to control non-service specific behavior of Trash Updater. See [the
documentation](setref) for more information.
documentation][setref] for more information.
- Trash git repository URL can be overridden in settings.
- Schema added for `settings.yml`.
[setref]: https://github.com/rcdailey/trash-updater/wiki/Settings-Reference

@ -0,0 +1,45 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$ref": "#/definitions/Settings",
"definitions": {
"Settings": {
"type": "object",
"additionalProperties": false,
"title": "Trash Updater Settings",
"description": "Optional settings to control the behavior of Trash Updater",
"properties": {
"repository": {
"$ref": "#/definitions/Repository"
},
"enable_ssl_certificate_validation": {
"type": "boolean",
"title": "Allow SSL certificate validation for Sonarr & Radarr",
"description": "If set to `false`, SSL certificates are not validated. This is useful if you are connecting to a Sonarr or Radarr instance using `https` and it is set up with self-signed certificates. Note that disabling this setting is a **security risk** and should be avoided unless you are absolutely sure what you are doing."
}
}
},
"Repository": {
"type": "object",
"additionalProperties": false,
"title": "Settings for the git repo",
"description": "",
"properties": {
"clone_url": {
"type": "string",
"title": "Clone URL to the trash guides git repository",
"description": "A URL compatible with `git clone` that is used to clone the Trash Guides repository. This setting exists for enthusiasts that may want to instead have Trash Updater pull data from a fork instead of the official repository.",
"format": "uri",
"qt-uri-protocols": [
"http",
"https",
"ssh",
"git"
],
"qt-uri-extensions": [
".git"
]
}
}
}
}
}

@ -42,6 +42,8 @@ public class SettingsPersister : ISettingsPersister
private void CreateDefaultSettingsFile()
{
const string fileData =
"# yaml-language-server: $schema=https://raw.githubusercontent.com/rcdailey/trash-updater/master/schemas/settings-schema.json\n" +
"\n" +
"# Edit this file to customize the behavior of Trash Updater beyond its defaults\n" +
"# For the settings file reference guide, visit the link to the wiki below:\n" +
"# https://github.com/rcdailey/trash-updater/wiki/Settings-Reference\n";

@ -17,6 +17,21 @@ empty and default behavior will be used. There is absolutely no need to touch th
have a specific reason to. It is recommended that you only add the specific properties for the
customizations you need and leave the rest alone.
# Schema Validation
A schema file is provided for `settings.yml` to help assist in editing the file. To use it, simply
add the below snippet to the first line in your `settings.yml` file:
```yml
# yaml-language-server: $schema=https://raw.githubusercontent.com/rcdailey/trash-updater/master/schemas/settings-schema.json
```
If you use VS Code to edit your settings file and install the [YAML extension][yaml], it will
suggest properties you can use and show you documentation for each without having to reference this
page.
[yaml]: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
# YAML Reference
Table of Contents

Loading…
Cancel
Save