feat(ci): Custom Format JSON validation (#1939)
Co-authored-by: TRaSH <trash-pm@protonmail.ch>pull/1904/head
parent
2a7c1fc1be
commit
308088b249
@ -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
|
@ -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…
Reference in new issue