From db44ed79947f4676aa76c3e41f91fefa70109ca0 Mon Sep 17 00:00:00 2001 From: Fabien BERNARD Date: Wed, 31 Mar 2021 15:51:37 +0200 Subject: [PATCH] Deal with multiline prop values --- src/scripts/import-open-api.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/import-open-api.ts b/src/scripts/import-open-api.ts index c9ef88b..925b8ca 100644 --- a/src/scripts/import-open-api.ts +++ b/src/scripts/import-open-api.ts @@ -269,7 +269,12 @@ const importSpecs = (data: string, extension: "yaml" | "json"): Promise value.replace(/^{(.*)}$/, "$1"); +export const reactPropsValueToObjectValue = (value: string) => { + if (value.startsWith("{") && value.endsWith("}")) { + return value.slice(1, -1); + } + return value; +}; /** * Generate a restful-react component from openapi operation specs