From 48e783212d8460e67c3fa0438e6b6774c1640f79 Mon Sep 17 00:00:00 2001 From: "Matthew J. Martin" Date: Wed, 17 Jun 2020 21:40:27 +0700 Subject: [PATCH] fix accepted options for mapping --- lib/options.schema.json | 66 ++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/lib/options.schema.json b/lib/options.schema.json index 7dd0773..838e030 100644 --- a/lib/options.schema.json +++ b/lib/options.schema.json @@ -33,34 +33,7 @@ "properties": {}, "patternProperties": { ".*": { - "oneOf": [{ - "description": "Output key to map value onto within destination object", - "type": "string" - }, { - "description": "List of outputs within destination object", - "type": "array", - "items": { - "oneOf": [{ - "description": "Output key to map value onto within destination object", - "type": "string" - }, { - "type": "object", - "additionalProperties": true, - "properties": { - "key": { - "description": "Output key to map value onto within destination object", - "type": "string" - }, - "transform": { - "description": "Function to transform the output value; see also: https://github.com/wankdanker/node-object-mapper", - "type": "object", - "additionalProperties": true - } - }, - "required": ["key"] - }] - } - }] + "$ref": "#/definitions/PropertyMappingItem" } } }, @@ -87,5 +60,42 @@ "additionalProperties": true }] } + }, + "definitions": { + "PropertyMappingItem": { + "oneOf": [{ + "description": "Output key to map value onto within destination object", + "type": "string" + }, { + "description": "List of outputs within destination object", + "type": "array", + "items": { + "oneOf": [{ + "description": "Output key to map value onto within destination object", + "type": "string" + }, { + "$ref": "#/definitions/PropertyMappingObject" + }] + } + }, { + "$ref": "#/definitions/PropertyMappingObject" + }] + }, + "PropertyMappingObject": { + "type": "object", + "additionalProperties": true, + "properties": { + "key": { + "description": "Output key to map value onto within destination object", + "type": "string" + }, + "transform": { + "description": "Function to transform the output value; see also: https://github.com/wankdanker/node-object-mapper", + "type": "object", + "additionalProperties": true + } + }, + "required": ["key"] + } } }