feat(ci): Custom Format JSON validation (#1939)

Co-authored-by: TRaSH <trash-pm@protonmail.ch>
pull/1904/head
nuxen 1 month ago committed by GitHub
parent 2a7c1fc1be
commit 308088b249
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,44 @@
name: Validate Custom Format JSONs
on:
push:
branches:
- master
paths:
- .github/workflows/custom-format-validation.yml
- docs/json/guide-only/*.json
- docs/json/radarr/cf/*.json
- docs/json/sonarr/cf/*.json
- schemas/**/*.json
pull_request:
paths:
- .github/workflows/custom-format-validation.yml
- docs/json/guide-only/*.json
- docs/json/radarr/cf/*.json
- docs/json/sonarr/cf/*.json
- schemas/**/*.json
jobs:
validate-json:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.5
- name: Setup Python
uses: actions/setup-python@v5.1.0
with:
python-version: "3.x"
- name: Install check-jsonschema
run: pip install check-jsonschema
- name: Validate Guide only Custom Formats
run: check-jsonschema -v --schemafile schemas/guide-only-cf.schema.json docs/json/guide-only/*.json
- name: Validate Radarr Custom Formats
run: check-jsonschema -v --schemafile schemas/radarr-cf.schema.json docs/json/radarr/cf/*.json
- name: Validate Sonarr Custom Formats
run: check-jsonschema -v --schemafile schemas/sonarr-cf.schema.json docs/json/sonarr/cf/*.json

@ -4,5 +4,19 @@
},
"yaml.schemas": {
"https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json": "untitled:Untitled-1"
}
},
"json.schemas": [
{
"fileMatch": ["docs/json/guide-only/*.json"],
"url": "./schemas/guide-only-cf.schema.json"
},
{
"fileMatch": ["docs/json/radarr/cf/*.json"],
"url": "./schemas/radarr-cf.schema.json"
},
{
"fileMatch": ["docs/json/sonarr/cf/*.json"],
"url": "./schemas/sonarr-cf.schema.json"
}
]
}

@ -1,6 +1,7 @@
{
"trash_id": "02e48d30a176c91baf9e15de05e5dc6a",
"name": "FanSUB",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "FanSUB",

@ -4,6 +4,7 @@
"default": -10000
},
"name": "FastSUB",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "FastSUB",

@ -1,6 +1,7 @@
{
"trash_id": "84f0acbda9c0c9de783894fb66df25aa",
"name": "FanSUB",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "FanSUB",

@ -4,6 +4,7 @@
"default": -10000
},
"name": "FastSUB",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "FastSUB",

@ -1,15 +0,0 @@
{
"name": "Season Pack",
"includeCustomFormatWhenRenaming": false,
"specifications": [
{
"name": "Season Packs",
"implementation": "ReleaseTypeSpecification",
"negate": false,
"required": false,
"fields": {
"value": 3
}
}
]
}

@ -0,0 +1,54 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"defs": {
"trash_id": {
"type": "string",
"pattern": "^([a-fA-F0-9]{32}|guide-only)$"
},
"trash_scores": {
"type": "object",
"properties": {
"default": {
"type": "integer",
"not": {
"const": 0
}
}
},
"patternProperties": {
"^.+$": {
"type": "integer"
}
},
"additionalProperties": false,
"minProperties": 1
},
"trash_regex": {
"type": "string",
"format": "uri"
},
"trash_description": {
"type": "string",
"minLength": 1
},
"name": {
"type": "string",
"minLength": 1
},
"baseSpecification": {
"type": "object",
"properties": {
"name": {
"$ref": "#/defs/name"
},
"negate": {
"type": "boolean"
},
"required": {
"type": "boolean"
}
},
"required": ["name", "negate", "required"]
}
}
}

@ -0,0 +1,50 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"trash_id": {
"$ref": "base-cf.schema.json#/defs/trash_id"
},
"trash_scores": {
"$ref": "base-cf.schema.json#/defs/trash_scores"
},
"trash_regex": {
"$ref": "base-cf.schema.json#/defs/trash_regex"
},
"trash_description": {
"$ref": "base-cf.schema.json#/defs/trash_description"
},
"name": {
"$ref": "base-cf.schema.json#/defs/name"
},
"includeCustomFormatWhenRenaming": {
"type": "boolean"
},
"specifications": {
"type": "array",
"items": {
"anyOf": [
{ "$ref": "specs/release-title-spec.json" },
{ "$ref": "specs/edition-spec.json" },
{ "$ref": "specs/language-spec.json" },
{ "$ref": "specs/indexer-flag-spec.json" },
{ "$ref": "specs/source-spec.json" },
{ "$ref": "specs/resolution-spec.json" },
{ "$ref": "specs/quality-modifier-spec.json" },
{ "$ref": "specs/size-spec.json" },
{ "$ref": "specs/release-group-spec.json" },
{ "$ref": "specs/release-type-spec.json" },
{ "$ref": "specs/year-spec.json" }
]
},
"minItems": 1
}
},
"required": [
"trash_id",
"name",
"includeCustomFormatWhenRenaming",
"specifications"
],
"additionalProperties": false
}

@ -0,0 +1,49 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"trash_id": {
"$ref": "base-cf.schema.json#/defs/trash_id"
},
"trash_scores": {
"$ref": "base-cf.schema.json#/defs/trash_scores"
},
"trash_regex": {
"$ref": "base-cf.schema.json#/defs/trash_regex"
},
"trash_description": {
"$ref": "base-cf.schema.json#/defs/trash_description"
},
"name": {
"$ref": "base-cf.schema.json#/defs/name"
},
"includeCustomFormatWhenRenaming": {
"type": "boolean"
},
"specifications": {
"type": "array",
"items": {
"anyOf": [
{ "$ref": "specs/release-title-spec.json" },
{ "$ref": "specs/edition-spec.json" },
{ "$ref": "specs/language-spec.json" },
{ "$ref": "specs/indexer-flag-spec.json" },
{ "$ref": "specs/source-spec.json" },
{ "$ref": "specs/resolution-spec.json" },
{ "$ref": "specs/quality-modifier-spec.json" },
{ "$ref": "specs/size-spec.json" },
{ "$ref": "specs/release-group-spec.json" },
{ "$ref": "specs/year-spec.json" }
]
},
"minItems": 1
}
},
"required": [
"trash_id",
"name",
"includeCustomFormatWhenRenaming",
"specifications"
],
"additionalProperties": false
}

@ -0,0 +1,47 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"trash_id": {
"$ref": "base-cf.schema.json#/defs/trash_id"
},
"trash_scores": {
"$ref": "base-cf.schema.json#/defs/trash_scores"
},
"trash_regex": {
"$ref": "base-cf.schema.json#/defs/trash_regex"
},
"trash_description": {
"$ref": "base-cf.schema.json#/defs/trash_description"
},
"name": {
"$ref": "base-cf.schema.json#/defs/name"
},
"includeCustomFormatWhenRenaming": {
"type": "boolean"
},
"specifications": {
"type": "array",
"items": {
"anyOf": [
{ "$ref": "specs/release-title-spec.json" },
{ "$ref": "specs/language-spec.json" },
{ "$ref": "specs/indexer-flag-spec.json" },
{ "$ref": "specs/source-spec.json" },
{ "$ref": "specs/resolution-spec.json" },
{ "$ref": "specs/size-spec.json" },
{ "$ref": "specs/release-group-spec.json" },
{ "$ref": "specs/release-type-spec.json" }
]
},
"minItems": 1
}
},
"required": [
"trash_id",
"name",
"includeCustomFormatWhenRenaming",
"specifications"
],
"additionalProperties": false
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "EditionSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "IndexerFlagSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"enum": [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "LanguageSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "integer"
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "QualityModifierSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"enum": [1, 2, 3, 4, 5]
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "ReleaseGroupSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "ReleaseTitleSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "ReleaseTypeSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"enum": [0, 1, 2, 3]
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "ResolutionSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"enum": [360, 480, 540, 576, 720, 1080, 2160]
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "SizeSpecification"
},
"fields": {
"type": "object",
"properties": {
"min": {
"type": "integer"
},
"max": {
"type": "integer",
"minimum": 1
}
},
"required": ["min", "max"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "SourceSpecification"
},
"fields": {
"type": "object",
"properties": {
"value": {
"type": "integer",
"enum": [1, 2, 3, 4, 5, 6, 7, 8, 9]
}
},
"required": ["value"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}

@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{ "$ref": "../base-cf.schema.json#/defs/baseSpecification" },
{
"properties": {
"implementation": {
"const": "SizeSpecification"
},
"fields": {
"type": "object",
"properties": {
"min": {
"type": "integer",
"minimum": 1
},
"max": {
"type": "integer",
"minimum": 1
}
},
"required": ["min", "max"],
"additionalProperties": false
}
},
"required": ["implementation", "fields"]
}
]
}
Loading…
Cancel
Save