From 68e559cf7692d467ad5f4291bf025d572d9b58a0 Mon Sep 17 00:00:00 2001 From: Michael Kriese <michael.kriese@visualon.de> Date: Wed, 3 Feb 2021 16:10:41 +0100 Subject: [PATCH] fix: allow strings in json schema (#8524) --- bin/create-json-schema.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/create-json-schema.js b/bin/create-json-schema.js index 1dde387f1d..827785bd91 100644 --- a/bin/create-json-schema.js +++ b/bin/create-json-schema.js @@ -34,6 +34,12 @@ function createSingleConfig(option) { temp.items.enum = option.allowedValues; } } + if (option.subType == 'string' && option.allowString === true) { + const items = temp.items; + delete temp.items; + delete temp.type; + temp.oneOf = [{ type: 'array', items }, { ...items }]; + } } else { if (option.format) { temp.format = option.format; -- GitLab