From 8597709c56f652ecaf40b486bed88575b4242ed9 Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:38:12 +0100 Subject: [PATCH 1/7] Created all Schemas for JSONs and edited Workflow file (Reference #12) --- .github/workflows/checkjson.yml | 33 +++++++- .github/workflows/effectschema.json | 38 ++++++++++ .github/workflows/entityschema.json | 75 +++++++++++++++++++ .github/workflows/itemschema.json | 50 +++++++++++++ .../{schema.json => levelschema.json} | 0 config/effects.json | 1 + config/entities.json | 1 + config/items.json | 1 + config/levels.json | 2 +- 9 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/effectschema.json create mode 100644 .github/workflows/entityschema.json create mode 100644 .github/workflows/itemschema.json rename .github/workflows/{schema.json => levelschema.json} (100%) diff --git a/.github/workflows/checkjson.yml b/.github/workflows/checkjson.yml index f359124..87126b2 100644 --- a/.github/workflows/checkjson.yml +++ b/.github/workflows/checkjson.yml @@ -3,12 +3,39 @@ name: Validate JSONs on: [push] jobs: - verify-json-validation: + verify-effects-validation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Validate JSON + - name: Validate Effects JSON uses: docker://orrosenblatt/validate-json-action:latest env: - INPUT_SCHEMA: /.github/workflows/schema.json + INPUT_SCHEMA: /.github/workflows/effectsschema.json + INPUT_JSONS: /config/effects.json + verify-entities-validation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Validate Entity JSON + uses: docker://orrosenblatt/validate-json-action:latest + env: + INPUT_SCHEMA: /.github/workflows/entityschema.json + INPUT_JSONS: /config/entities.json + verify-levels-validation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Validate Levels JSON + uses: docker://orrosenblatt/validate-json-action:latest + env: + INPUT_SCHEMA: /.github/workflows/levelsschema.json INPUT_JSONS: /config/levels.json + verify-items-validation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Validate Items JSON + uses: docker://orrosenblatt/validate-json-action:latest + env: + INPUT_SCHEMA: /.github/workflows/itemsschema.json + INPUT_JSONS: /config/items.json \ No newline at end of file diff --git a/.github/workflows/effectschema.json b/.github/workflows/effectschema.json new file mode 100644 index 0000000..a1229c5 --- /dev/null +++ b/.github/workflows/effectschema.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "patternProperties": { + "^[A-Z].[a-z][0-9]{1,}":{ + "$ref": "#/definitions/Effect" + } + }, + "definitions": { + "Effect":{ + "type":"object", + "properties": { + "name": { + "type": "string", + "description": "Der Name des Effektes" + }, + "descr":{ + "type": "string", + "description": "Die Beschreibung des Effektes" + }, + "etype":{ + "type":"string", + "description": "Der Effekttyp", + "enum": ["good","bad","evil"] + }, + "value":{ + "type":"integer", + "description": "Die Menge die ein Wert durch diesen Effekt beeinfluss wird" + }, + "infl":{ + "type":"string", + "description": "Der Wert der durch diesen Effekt beeinflusst wird" + } + }, + "required": ["name","descr","etype","value","infl"] + } + } +} \ No newline at end of file diff --git a/.github/workflows/entityschema.json b/.github/workflows/entityschema.json new file mode 100644 index 0000000..0b68aed --- /dev/null +++ b/.github/workflows/entityschema.json @@ -0,0 +1,75 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "required": ["Player"], + "properties": { + "Player":{ + "$ref": "#/definitions/Entity" + } + }, + "patternProperties": { + "^[A-Z].[a-z]{1,}":{ + "$ref": "#/definitions/Entity" + } + }, + "definitions": { + "Entity":{ + "type":"object", + "properties": { + "name": { + "type": "string", + "description": "Der Name der Entität ingame", + "minLength": 0, + "maxLength": 30 + }, + "hp":{ + "type": "integer", + "description": "Die Lebenspunkte der Entität", + "minimum": 0, + "maximum": 100 + }, + "wealth":{ + "type":"integer", + "description": "Der Wohlstandswert der Entität", + "minimum": 0, + "maximum": 100 + }, + "inv":{ + "type":"array", + "description": "Eine Liste aller Inventargegenstände der Entität" + }, + "xp":{ + "type":"integer", + "description": "Die Erfahrungspunkte der Entität", + "minimum": 0, + "maximum": 100 + }, + "ptype":{ + "type":"integer", + "description": "Der Typ der Entität (Friendly/Harmfull)" + }, + "geffects":{ + "type":"array", + "description": "Eine Liste aller positiven Effekte(Buffs) auf der Entität" + }, + "beffects":{ + "type":"array", + "description": "Eine Liste aller negativen Effekte(debuffs) auf der Entität" + }, + "eeffects":{ + "type":"array", + "description": "Eine Liste aller negativen Boss Effekte(debuffs) auf der Entität" + }, + "location":{ + "type":"string", + "description": "An welchem Ort Befindet sich die Entität grade" + }, + "level":{ + "type":"integer", + "description": "Welche Stufe hat die Entität" + } + }, + "required": ["name","hp","wealth","inv","xp","ptype","geffects","beffects","eeffects","location","level"] + } + } +} \ No newline at end of file diff --git a/.github/workflows/itemschema.json b/.github/workflows/itemschema.json new file mode 100644 index 0000000..ec7515b --- /dev/null +++ b/.github/workflows/itemschema.json @@ -0,0 +1,50 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "type": "object", + "patternProperties": { + "^[A-Z].[a-z]{1,}":{ + "$ref": "#/definitions/Item" + } + }, + "definitions": { + "Item":{ + "type":"object", + "properties": { + "type": { + "type": "string", + "description": "Der Itemtyp", + "enum": ["weapon","tool","potion","misc"] + }, + "dmg":{ + "type": "integer", + "description": "Der Schaden des Items", + "minimum": 0, + "maximum": 100 + }, + "condition":{ + "type":"integer", + "description": "Der Zustand des Items", + "minimum": 0, + "maximum": 100 + }, + "effects":{ + "type":"array", + "description": "Eine Liste aller Special Effekte auf dem Item" + }, + "useable":{ + "type":"boolean", + "description": "Ist das Item benutzbar?" + }, + "equipable":{ + "type":"boolean", + "description": "Ist das Item ausrüstbar?" + }, + "questitem":{ + "type":"boolean", + "description": "Ist das Item ein Questitem" + } + }, + "required": ["type","dmg","condition","effects","useable","equipable","questitem"] + } + } +} \ No newline at end of file diff --git a/.github/workflows/schema.json b/.github/workflows/levelschema.json similarity index 100% rename from .github/workflows/schema.json rename to .github/workflows/levelschema.json diff --git a/config/effects.json b/config/effects.json index 5905300..4fbe014 100644 --- a/config/effects.json +++ b/config/effects.json @@ -1,4 +1,5 @@ { + "$schema": "../.github/workflows/effectschema.json", "Kopfschmerz":{ "name":"Kopfschmerz", "descr":"Kopfschmerzen die aus dem hinteren deines Kopfes in die Stirn ziehen.\nZiemlich unangenehm.", diff --git a/config/entities.json b/config/entities.json index 31903c7..a6236f1 100644 --- a/config/entities.json +++ b/config/entities.json @@ -1,4 +1,5 @@ { + "$schema": "../.github/workflows/entityschema.json", "Player":{ "name": "Player", "hp": 0, diff --git a/config/items.json b/config/items.json index 13905d1..ed533e9 100644 --- a/config/items.json +++ b/config/items.json @@ -1,4 +1,5 @@ { + "$schema": "../.github/workflows/itemschema.json", "Sword" : { "type": "weapon", "dmg": 10, diff --git a/config/levels.json b/config/levels.json index 89db7dd..d38ac25 100644 --- a/config/levels.json +++ b/config/levels.json @@ -1,5 +1,5 @@ { - "$schema": "../.github/workflows/schema.json", + "$schema": "../.github/workflows/levelschema.json", "Menu":{ "text": [ [ From a82ca004c8d9cce81461f1449d844c0b1389e503 Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:41:52 +0100 Subject: [PATCH 2/7] Edited Workflow Fixed Schema File spelling issues --- .github/workflows/checkjson.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checkjson.yml b/.github/workflows/checkjson.yml index 87126b2..52f565a 100644 --- a/.github/workflows/checkjson.yml +++ b/.github/workflows/checkjson.yml @@ -10,7 +10,7 @@ jobs: - name: Validate Effects JSON uses: docker://orrosenblatt/validate-json-action:latest env: - INPUT_SCHEMA: /.github/workflows/effectsschema.json + INPUT_SCHEMA: /.github/workflows/effectschema.json INPUT_JSONS: /config/effects.json verify-entities-validation: runs-on: ubuntu-latest @@ -28,7 +28,7 @@ jobs: - name: Validate Levels JSON uses: docker://orrosenblatt/validate-json-action:latest env: - INPUT_SCHEMA: /.github/workflows/levelsschema.json + INPUT_SCHEMA: /.github/workflows/levelschema.json INPUT_JSONS: /config/levels.json verify-items-validation: runs-on: ubuntu-latest @@ -37,5 +37,5 @@ jobs: - name: Validate Items JSON uses: docker://orrosenblatt/validate-json-action:latest env: - INPUT_SCHEMA: /.github/workflows/itemsschema.json - INPUT_JSONS: /config/items.json \ No newline at end of file + INPUT_SCHEMA: /.github/workflows/itemschema.json + INPUT_JSONS: /config/items.json From 06204bb09de14a91c6f6653b63edfdd5d8d35fff Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:46:31 +0100 Subject: [PATCH 3/7] Updated Readme with Workflow Status Badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index af88df4..87afd2c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Validate JSONs](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml/badge.svg)](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml) + # Textadventure From 7d46fe0d9306657fa2b5145e5bc50341076ec1cb Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:48:23 +0100 Subject: [PATCH 4/7] Test Workflow --- config/entities.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/entities.json b/config/entities.json index a6236f1..f81f393 100644 --- a/config/entities.json +++ b/config/entities.json @@ -3,7 +3,7 @@ "Player":{ "name": "Player", "hp": 0, - "wealth": 0, + "walth": 0, "inv": [], "xp": 0, "ptype":0, @@ -26,4 +26,4 @@ "location": "", "level": 0 } -} \ No newline at end of file +} From 86b9f18bd7b4f077bb6b8e2f5e31ab6494e66161 Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:50:55 +0100 Subject: [PATCH 5/7] Updated Readme with correct Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 87afd2c..a3cc9c8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Validate JSONs](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml/badge.svg)](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml) +[![Validate JSONs](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml/badge.svg?branch=main)](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml) # Textadventure From 69694256bcb4b84e6094411044602f3d166d9dae Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:51:27 +0100 Subject: [PATCH 6/7] Test Workflow --- config/entities.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/entities.json b/config/entities.json index f81f393..ceb20e9 100644 --- a/config/entities.json +++ b/config/entities.json @@ -3,7 +3,7 @@ "Player":{ "name": "Player", "hp": 0, - "walth": 0, + "wealth": 0, "inv": [], "xp": 0, "ptype":0, From 55c93cdc87593820e5523b4d5e6ef33b8eef2fd2 Mon Sep 17 00:00:00 2001 From: Kartoffel096 Date: Wed, 8 Mar 2023 01:57:07 +0100 Subject: [PATCH 7/7] Updated to fix Badge Caching --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3cc9c8..4c39d2c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Validate JSONs](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml/badge.svg?branch=main)](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml) +[![Validate JSONs](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml/badge.svg?branch=main&kill_cache=1)](https://github.com/HilkopterBob/TA/actions/workflows/checkjson.yml) # Textadventure