From 65310e12dba7d099c0abcceb4dc4b6396b4a7911 Mon Sep 17 00:00:00 2001 From: Mikhail Tseluiko Date: Fri, 29 Jan 2021 09:01:56 +0200 Subject: [PATCH] JSON RE: fix pattern fields handling --- reverse_engineering/helpers/adaptJsonSchema.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reverse_engineering/helpers/adaptJsonSchema.js b/reverse_engineering/helpers/adaptJsonSchema.js index 6ac2978..dd915e5 100644 --- a/reverse_engineering/helpers/adaptJsonSchema.js +++ b/reverse_engineering/helpers/adaptJsonSchema.js @@ -125,10 +125,10 @@ const handleEmptyDefaultInProperties = field => { return { ...properties, [key]: updatedProperty }; } - const complexProperties = ['properties', 'items']; + const complexProperties = ['patternProperties', 'properties', 'items']; const propertyWithChoice = { - ..._.omit(updatedProperty, complexProperties), + ..._.omit(updatedProperty, [ ...complexProperties, 'type' ]), oneOf: updatedProperty.type.map(type => { if (!isComplexType(type)) { return { @@ -138,7 +138,7 @@ const handleEmptyDefaultInProperties = field => { } return { - ..._.omit(updatedProperty, type === 'array' ? 'properties' : 'items'), + ..._.omit(updatedProperty, type === 'array' ? ['patternProperties', 'properties'] : 'items'), type }; })