From 2b41263aa756cf19012ff703bb64904ebbcbdb85 Mon Sep 17 00:00:00 2001 From: Scott Wu Date: Tue, 25 Nov 2025 12:48:47 +0800 Subject: [PATCH] fix: Add $schema property to settings.schema.json (#12763) Co-authored-by: cornmander --- schemas/settings.schema.json | 6 ++++++ scripts/generate-settings-schema.ts | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/schemas/settings.schema.json b/schemas/settings.schema.json index b365112aee..5974be4fe9 100644 --- a/schemas/settings.schema.json +++ b/schemas/settings.schema.json @@ -6,6 +6,12 @@ "type": "object", "additionalProperties": false, "properties": { + "$schema": { + "title": "Schema", + "description": "The URL of the JSON schema for this settings file. Used by editors for validation and autocompletion.", + "type": "string", + "default": "https://raw.githubusercontent.com/google-gemini/gemini-cli/main/schemas/settings.schema.json" + }, "mcpServers": { "title": "MCP Servers", "description": "Configuration for MCP servers.", diff --git a/scripts/generate-settings-schema.ts b/scripts/generate-settings-schema.ts index 392194910b..6ec5d9741c 100644 --- a/scripts/generate-settings-schema.ts +++ b/scripts/generate-settings-schema.ts @@ -120,6 +120,14 @@ function buildSchemaObject(schema: SettingsSchemaType): JsonSchema { properties: {}, }; + root.properties!['$schema'] = { + title: 'Schema', + description: + 'The URL of the JSON schema for this settings file. Used by editors for validation and autocompletion.', + type: 'string', + default: SCHEMA_ID, + }; + for (const [key, definition] of Object.entries(schema)) { root.properties![key] = buildSettingSchema(definition, [key], defs); }