From 086188e6c462b34f72ba6329ecbbc554bdcbc615 Mon Sep 17 00:00:00 2001 From: owine Date: Fri, 20 Feb 2026 19:37:39 -0600 Subject: [PATCH] feat(starr): add JSON schemas for cf-groups and naming files (#2628) Co-authored-by: Claude Opus 4.6 --- .pre-commit-config.yaml | 24 +++++++++++ schemas/cf-groups.schema.json | 67 +++++++++++++++++++++++++++++++ schemas/radarr-naming.schema.json | 30 ++++++++++++++ schemas/sonarr-naming.schema.json | 48 ++++++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 schemas/cf-groups.schema.json create mode 100644 schemas/radarr-naming.schema.json create mode 100644 schemas/sonarr-naming.schema.json diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cde064804..69824e270 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,6 +20,30 @@ repos: types: [json] args: ["-v", "--schemafile", "schemas/sonarr-cf.schema.json"] + - id: check-jsonschema + name: Validate Radarr CF Groups + files: ^docs/json/radarr/cf-groups/[^/]+\.json$ + types: [json] + args: ["-v", "--schemafile", "schemas/cf-groups.schema.json"] + + - id: check-jsonschema + name: Validate Sonarr CF Groups + files: ^docs/json/sonarr/cf-groups/[^/]+\.json$ + types: [json] + args: ["-v", "--schemafile", "schemas/cf-groups.schema.json"] + + - id: check-jsonschema + name: Validate Radarr Naming + files: ^docs/json/radarr/naming/[^/]+\.json$ + types: [json] + args: ["-v", "--schemafile", "schemas/radarr-naming.schema.json"] + + - id: check-jsonschema + name: Validate Sonarr Naming + files: ^docs/json/sonarr/naming/[^/]+\.json$ + types: [json] + args: ["-v", "--schemafile", "schemas/sonarr-naming.schema.json"] + - repo: https://github.com/adrienverge/yamllint rev: v1.38.0 hooks: diff --git a/schemas/cf-groups.schema.json b/schemas/cf-groups.schema.json new file mode 100644 index 000000000..a3909e9e5 --- /dev/null +++ b/schemas/cf-groups.schema.json @@ -0,0 +1,67 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "trash_id": { + "type": "string", + "pattern": "^[a-fA-F0-9]{32}$" + }, + "trash_description": { + "type": "string", + "minLength": 1 + }, + "default": { + "type": "string", + "enum": ["true", "false"] + }, + "custom_formats": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "trash_id": { + "type": "string", + "pattern": "^[a-fA-F0-9]{32}$" + }, + "required": { + "type": "boolean" + }, + "default": { + "type": "boolean" + } + }, + "required": ["name", "trash_id", "required"], + "additionalProperties": false + } + }, + "quality_profiles": { + "type": "object", + "properties": { + "include": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string", + "pattern": "^[a-fA-F0-9]{32}$" + } + }, + "additionalProperties": false, + "minProperties": 1 + } + }, + "required": ["include"], + "additionalProperties": false + } + }, + "required": ["name", "trash_id", "custom_formats", "quality_profiles"], + "additionalProperties": false +} diff --git a/schemas/radarr-naming.schema.json b/schemas/radarr-naming.schema.json new file mode 100644 index 000000000..689deff2f --- /dev/null +++ b/schemas/radarr-naming.schema.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "folder": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "minProperties": 1 + }, + "file": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "minProperties": 1 + } + }, + "required": ["folder", "file"], + "additionalProperties": false +} diff --git a/schemas/sonarr-naming.schema.json b/schemas/sonarr-naming.schema.json new file mode 100644 index 000000000..1da9cf4d9 --- /dev/null +++ b/schemas/sonarr-naming.schema.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "season": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "minProperties": 1 + }, + "series": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "minProperties": 1 + }, + "episodes": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "object", + "patternProperties": { + "^.+$": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false, + "minProperties": 1 + } + }, + "additionalProperties": false, + "minProperties": 1 + } + }, + "required": ["season", "series", "episodes"], + "additionalProperties": false +}