From d52d1588f4440f804a56e591ef07db4add1337bd Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Wed, 10 Aug 2022 08:53:19 -0500 Subject: [PATCH 1/2] chore: Move .editorconfig to the repo root It doesn't exist yet as of this commit, but a set of new JSON files will be placed at the root of the repo and the editor config file is needed at the root of the repo to ensure proper formatting of those JSON files. --- docs/json/.editorconfig => .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename docs/json/.editorconfig => .editorconfig (94%) diff --git a/docs/json/.editorconfig b/.editorconfig similarity index 94% rename from docs/json/.editorconfig rename to .editorconfig index e609a5f64..11bd79db4 100644 --- a/docs/json/.editorconfig +++ b/.editorconfig @@ -1,7 +1,7 @@ # EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file -root = false +root = true [*.json] indent_style = space From a1941d691a5336d9df0a9f9f2f1e4fc9df7d7b22 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Wed, 10 Aug 2022 08:54:33 -0500 Subject: [PATCH 2/2] chore: New metadata.json file with repo information Currently, tooling that references files in the Trash Guides github repository has no reliable way to know where certain information lives. For example, the Recyclarr application hard-codes paths (relative to the repo root) to find the location of certain JSON files for Sonarr and Radarr. Hard-coding paths is a poor practice because it limits the ability for the Guides repository to be reorganized without breaking tools. This commit introduces a file named `metadata.json` that exists at the root of the repository. Its sole purpose is to communicate information about the repository itself. For now, the only thing this file provides is the paths to JSON files for Radarr custom formats and Sonarr release profiles. This file will never move, otherwise we run into the same issue that existed prior to having this file. When relevant files or directories are reorganized in the repository, respective paths in `metadata.json` will be updated which will allow tooling to continue to find needed resources. The catalyst for this change is that there has been discussion recently about a new structure for JSON files in the repository due to the introduction of Sonarr v4 JSON files. Lastly, a schema has been provided to assist with live editing in `metadata.json`. The schema file is named `metadata.schema.json`. Some editors provide validation as you edit JSON files (e.g. VS Code), which will take advantage of this Fixes #703 --- metadata.json | 11 +++++++++++ metadata.schema.json | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 metadata.json create mode 100644 metadata.schema.json diff --git a/metadata.json b/metadata.json new file mode 100644 index 000000000..e874db777 --- /dev/null +++ b/metadata.json @@ -0,0 +1,11 @@ +{ + "$schema": "metadata.schema.json", + "json_paths": { + "radarr": { + "custom_formats": ["docs/json/radarr"] + }, + "sonarr": { + "release_profiles": ["docs/json/sonarr"] + } + } +} diff --git a/metadata.schema.json b/metadata.schema.json new file mode 100644 index 000000000..2f94ffbbc --- /dev/null +++ b/metadata.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://raw.githubusercontent.com/TRaSH-/Guides/master/metadata.schema.json", + "type": "object", + "additionalProperties": false, + "properties": { + "$schema": { "type": "string" }, + "json_paths": { + "type": "object", + "additionalProperties": false, + "properties": { + "radarr": "#/$defs/radarr", + "sonarr": "#/$defs/sonarr" + } + } + }, + "$defs": { + "release_profiles": { + "type": "array", + "items": { "type": "string" } + }, + "custom_formats": { + "type": "array", + "items": { "type": "string" } + }, + "radarr": { + "type": "object", + "additionalProperties": false, + "properties": { + "custom_formats": "#/$defs/custom_formats" + } + }, + "sonarr": { + "type": "object", + "additionalProperties": false, + "properties": { + "release_profiles": "#/$defs/release_profiles" + } + } + } +}