From d9d7ab50c55fe913ec0460b88c6bb927c317858a Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Wed, 13 Nov 2024 11:18:11 +0100 Subject: [PATCH] docs(config): create json schema --- example.json | 65 ------------ schema.json | 198 ++++++++++++++++++++++++++++++++++++ templates/page/index.gohtml | 6 +- 3 files changed, 201 insertions(+), 68 deletions(-) delete mode 100644 example.json create mode 100644 schema.json diff --git a/example.json b/example.json deleted file mode 100644 index f36ae27..0000000 --- a/example.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "image": "wallpaper.jpg", - "description": "Sem magna a dui labore et cursus nibh ipsum nulla. Sem magna a dui labore et cursus nibh ipsum nulla. Blandit adipiscing nulla diam dolore ultricies ornare sed risus faucibus. Lobortis mi sed dui risus nulla ultrices vulputate at enim.", - "person": { - "name": "Anhgelus Morhtuuzh", - "pronouns": "he/his - some basic things though", - "image": "pfp.webp" - }, - "font": "serif", - "colors": { - "text": "#fff", - "background": { - "type": "linear", - "angle": 243, - "colors": [ - { - "color": "#020024", - "position": 0 - }, - { - "color": "#090979", - "position": 40 - }, - { - "color": "#00d4ff", - "position": 100 - } - ] - } - }, - "links": [ - { - "link": "https://discord.gg/minecraft", - "content": "Minecraft's Discord", - "color": "#800080", - "text_color": "#fff", - "color_hover": "#680c68", - "text_color_hover": "#eee" - }, - { - "link": "https://github.com/anhgelus", - "content": "GitHub", - "color": "#800080FF", - "text_color": "#fff", - "color_hover": "#680c68", - "text_color_hover": "#eee" - }, - { - "link": "https://youtube.com/@anhgelus", - "content": "YouTube", - "color": "#800080FF", - "text_color": "#fff", - "color_hover": "#680c68", - "text_color_hover": "#eee" - } - ], - "legal": { - "legal_information_link": "https://www.anhgelus.world/legal/", - "images_source": [ - "Profile picture: John Smith for example.org", - "Background: John Smith 2 for another.example.org" - ], - "font_source": "serif by ?" - } -} \ No newline at end of file diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..1ef362b --- /dev/null +++ b/schema.json @@ -0,0 +1,198 @@ +{ + "type": "object", + "properties": { + "colors": { + "type": "object", + "properties": { + "background": { + "type": "object", + "properties": { + "angle": { + "type": "integer", + "format": "int32", + "minimum": 0, + "maximum": 359 + }, + "colors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "position": { + "type": "integer", + "format": "int32", + "minimum": 0, + "maximum": 100 + } + }, + "additionalProperties": false, + "required": [ + "color", + "position" + ] + } + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "type", + "angle", + "colors" + ] + }, + "buttons": { + "type": "object", + "properties": { + "background": { + "type": "string" + }, + "background_hover": { + "type": "string" + }, + "text": { + "type": "string" + }, + "text_hover": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text", + "text_hover", + "background", + "background_hover" + ] + }, + "text": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "background", + "buttons", + "text" + ] + }, + "description": { + "type": "string" + }, + "image": { + "type": "string" + }, + "legal": { + "type": "object", + "properties": { + "font_source": { + "type": "string" + }, + "images_source": { + "type": "array", + "items": { + "type": "string" + } + }, + "legal_information_link": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "legal_information_link", + "images_source", + "font_source" + ] + }, + "links": { + "type": "array", + "items": { + "type": "object", + "properties": { + "color": { + "type": "string" + }, + "color_hover": { + "type": "string" + }, + "content": { + "type": "string" + }, + "link": { + "type": "string" + }, + "text_color": { + "type": "string" + }, + "text_color_hover": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "link", + "content", + "color", + "text_color", + "color_hover", + "text_color_hover" + ] + } + }, + "person": { + "type": "object", + "properties": { + "image": { + "type": "string" + }, + "name": { + "type": "string" + }, + "pronouns": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "description" + ] + } + } + }, + "additionalProperties": false, + "required": [ + "name", + "pronouns", + "image", + "tags" + ] + } + }, + "additionalProperties": false, + "required": [ + "image", + "description", + "person", + "colors", + "links", + "legal" + ] +} diff --git a/templates/page/index.gohtml b/templates/page/index.gohtml index 9bef33a..dee6782 100644 --- a/templates/page/index.gohtml +++ b/templates/page/index.gohtml @@ -14,9 +14,9 @@