From f743140bd563cdf9d2c7a6ede00b77892447cd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 5 Oct 2017 16:53:11 +0100 Subject: [PATCH] lint: deduplicate StorageOptionsConf sub-schema Via a definition. Don't do this with the rest, as this is the only sub-config type that appears multiple times and is thus worth the effort. --- lint/schema.go | 108 ++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 68 deletions(-) diff --git a/lint/schema.go b/lint/schema.go index faca3b8bb16..0387e93998a 100644 --- a/lint/schema.go +++ b/lint/schema.go @@ -4,6 +4,44 @@ const confSchema = `{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "additionalProperties": false, +"definitions": { + "StorageOptions": { + "type": ["object", "null"], + "additionalProperties": false, + "properties": { + "database": { + "type": "integer" + }, + "enable_cluster": { + "type": "boolean" + }, + "host": { + "type": "string" + }, + "hosts": { + "type": ["array", "null"] + }, + "optimisation_max_active": { + "type": "integer" + }, + "optimisation_max_idle": { + "type": "integer" + }, + "password": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "type": { + "type": "string" + }, + "username": { + "type": "string" + } + } + } +}, "properties": { "allow_insecure_configs": { "type": "boolean" @@ -105,40 +143,7 @@ const confSchema = `{ "type": "string" }, "cache_storage": { - "type": ["object", "null"], - "additionalProperties": false, - "properties": { - "database": { - "type": "integer" - }, - "enable_cluster": { - "type": "boolean" - }, - "host": { - "type": "string" - }, - "hosts": { - "type": ["array", "null"] - }, - "optimisation_max_active": { - "type": "integer" - }, - "optimisation_max_idle": { - "type": "integer" - }, - "password": { - "type": "string" - }, - "port": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "username": { - "type": "string" - } - } + "$ref": "#/definitions/StorageOptions" }, "close_connections": { "type": "boolean" @@ -526,40 +531,7 @@ const confSchema = `{ "type": "string" }, "storage": { - "type": ["object", "null"], - "additionalProperties": false, - "properties": { - "database": { - "type": "integer" - }, - "enable_cluster": { - "type": "boolean" - }, - "host": { - "type": "string" - }, - "hosts": { - "type": ["array", "null"] - }, - "optimisation_max_active": { - "type": "integer" - }, - "optimisation_max_idle": { - "type": "integer" - }, - "password": { - "type": "string" - }, - "port": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "username": { - "type": "string" - } - } + "$ref": "#/definitions/StorageOptions" }, "suppress_default_org_store": { "type": "boolean"