From 7dcc6c490ac5cecd7d16960df5daa1633dcc7193 Mon Sep 17 00:00:00 2001 From: cethien Date: Sun, 3 Nov 2024 20:06:10 +0100 Subject: [PATCH] docs: add schema.json --- website/docs/setup/configuration.mdx | 1 + website/static/schema.json | 153 +++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 website/static/schema.json diff --git a/website/docs/setup/configuration.mdx b/website/docs/setup/configuration.mdx index 89d6791..d3632c6 100644 --- a/website/docs/setup/configuration.mdx +++ b/website/docs/setup/configuration.mdx @@ -22,6 +22,7 @@ The custom location can be a local file, or a URL pointing to a remote config. ## Example ```yaml +# yaml-language-server: $schema=https://aliae.dev/schema.json alias: - name: a value: aliae diff --git a/website/static/schema.json b/website/static/schema.json new file mode 100644 index 0000000..3c74a57 --- /dev/null +++ b/website/static/schema.json @@ -0,0 +1,153 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "if": { + "type": "string", + "description": "golang template (https://golang.org/pkg/text/template/) conditional statement, see if (https://aliae.dev/docs/setup/if)" + } + }, + "type": "object", + "properties": { + "alias": { + "type": "array", + "description": "alias definitions (https://aliae.dev/docs/setup/alias)", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "the alias name" + }, + "value": { + "type": "string", + "description": "the command(s) you want to execute, supports templating (https://aliae.dev/docs/setup/templates)" + }, + "type": { + "type": "string", + "oneOf": [ + { + "const": "command", + "description": "a regular alias, value is a one-liner (default)" + }, + { + "const": "function", + "description": "a code block to be placed inside a function" + }, + { + "const": "git", + "description": "a git alias definition" + } + ] + }, + "if": { + "$ref": "#/definitions/if" + } + }, + "required": [ + "name", + "value" + ] + } + }, + "env": { + "type": "array", + "description": "environment variable definitions (https://aliae.dev/docs/setup/env)", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "the variable name" + }, + "value": { + "type": "string", + "description": "the variable value, supports templating (https://aliae.dev/docs/setup/templates)" + }, + "delimiter": { + "type": "string", + "description": "if you want to join an array of string values (separated by newlines), supports templating (https://aliae.dev/docs/setup/templates)" + }, + "if": { + "$ref": "#/definitions/if" + }, + "persist": { + "type": "boolean", + "description": "if you want to persist the environment variable into the registry for the current user (Windows only)" + }, + "type": { + "type": "string", + "description": "type to export to", + "enum": [ + "string", + "array" + ] + } + } + } + }, + "path": { + "type": "array", + "description": "PATH entry definitions (https://aliae.dev/docs/setup/path)", + "items": { + "type": "object", + "properties": { + "value": { + "type": "string", + "description": "the path entires you want to add, separated by a newline. Supports templating (https://aliae.dev/docs/setup/templates)" + }, + "if": { + "$ref": "#/definitions/if" + }, + "persist": { + "type": "boolean", + "description": "if you want to persist the environment variable into the registry for the current user (Windows only)" + }, + "force": { + "type": "boolean", + "description": "if you want to always export the path even if it already exists in your current shell" + } + } + } + }, + "script": { + "type": "array", + "description": "script definitions (https://aliae.dev/docs/setup/script)", + "items": { + "type": "object", + "properties": { + "value": { + "type": "string", + "description": "the script you want to load. Supports templating (https://aliae.dev/docs/setup/templates)" + }, + "if": { + "$ref": "#/definitions/if" + } + } + } + }, + "link": { + "type": "array", + "description": "symbolic link definitions (https://aliae.dev/docs/setup/link)", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "the link file/folder to create, supports templating (https://aliae.dev/docs/setup/templates)" + }, + "target": { + "type": "string", + "description": "the target file/folder, supports templating (https://aliae.dev/docs/setup/templates)" + }, + "if": { + "$ref": "#/definitions/if" + }, + "mkdir": { + "type": "boolean", + "description": "if you want to create name's parent directory if it doesn't exist" + } + } + } + } + } +}