From e4ad94c1b01eddb3315aaa31cfcc1e2f933aceb5 Mon Sep 17 00:00:00 2001 From: Thiago Perrotta Date: Sun, 14 Jul 2024 23:31:49 +0200 Subject: [PATCH] feat: introduce a json schema file for yamlfmt Docs: - https://github.com/google/yamlfmt/blob/main/docs/config-file.md - https://json-schema.org/ - https://json-schema.org/learn/getting-started-step-by-step#create-a-schema-definition Issue #181 --- schema.json | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 schema.json diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..2ae0f53 --- /dev/null +++ b/schema.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/google/yamlfmt/main/schema.json", + "title": "yamlfmt config file", + "description": "The yamlfmt config file. For details, see https://github.com/google/yamlfmt/blob/main/docs/config-file.md.", + "type": "object", + "properties": { + "line_ending": { + "type": "string", + "enum": ["lf", "crlf"], + "default": "lf", + "description": "Parse and write the file with 'lf' or 'crlf' line endings. This global setting will override any formatter line_ending options." + }, + "doublestar": { + "type": "boolean", + "default": false, + "description": "Use doublestar for include and exclude paths. (This was the default before 0.7.0)" + }, + "continue_on_error": { + "type": "boolean", + "default": false, + "description": "Continue formatting and don't exit with code 1 when there is an invalid yaml file found." + }, + "include": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "The paths for the command to include for formatting. See Specifying Paths for more details." + }, + "exclude": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "The paths for the command to exclude from formatting. See Specifying Paths for more details." + }, + "gitignore_excludes": { + "type": "boolean", + "default": false, + "description": "Use gitignore files for exclude paths. This is in addition to the patterns from the exclude option." + }, + "gitignore_path": { + "type": "string", + "default": ".gitignore", + "description": "The path to the gitignore file to use." + }, + "regex_exclude": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "Regex patterns to match file contents for, if the file content matches the regex the file will be excluded. Use Golang regexes." + }, + "extensions": { + "type": "array", + "items": { + "type": "string" + }, + "default": [], + "description": "The extensions to use for standard mode path collection. See Specifying Paths for more details." + }, + "formatter": { + "type": "object", + "default": { + "type": "basic" + }, + "description": "Formatter settings. See Formatter for more details.", + "properties": { + "type": { + "type": "string", + "default": "basic" + } + }, + "additionalProperties": { + "type": "any" + } + }, + "output_format": { + "type": "string", + "enum": ["default", "line"], + "default": "default", + "description": "The output format to use. See Output docs for more details." + } + }, + "additionalProperties": false +}