Fix for issue 20256: Bug Report: converting circular structure to JSON error

Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
bnechyporenko
2024-01-27 22:59:17 +01:00
parent 920715f98b
commit 4131bd2724
3 changed files with 8 additions and 5 deletions
+1
View File
@@ -66,6 +66,7 @@
"@types/json-schema": "^7.0.9",
"@types/react": "^16.13.1 || ^17.0.0",
"classnames": "^2.2.6",
"flatted": "3.2.9",
"humanize-duration": "^3.25.1",
"immer": "^9.0.1",
"json-schema": "^0.4.0",
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { JsonObject } from '@backstage/types';
import { stringify, parse } from 'flatted';
import { FieldValidation, UiSchema } from '@rjsf/utils';
function isObject(value: unknown): value is JsonObject {
@@ -123,7 +124,7 @@ export const extractSchemaFromStep = (
inputStep: JsonObject,
): { uiSchema: UiSchema; schema: JsonObject } => {
const uiSchema: UiSchema = {};
const returnSchema: JsonObject = JSON.parse(JSON.stringify(inputStep));
const returnSchema: JsonObject = parse(stringify(inputStep));
extractUiSchema(returnSchema, uiSchema);
return { uiSchema, schema: returnSchema };
};
+5 -4
View File
@@ -8420,6 +8420,7 @@ __metadata:
"@types/luxon": ^3.0.0
"@types/react": ^16.13.1 || ^17.0.0
classnames: ^2.2.6
flatted: 3.2.9
humanize-duration: ^3.25.1
immer: ^9.0.1
json-schema: ^0.4.0
@@ -27530,10 +27531,10 @@ __metadata:
languageName: node
linkType: hard
"flatted@npm:^3.1.0":
version: 3.1.1
resolution: "flatted@npm:3.1.1"
checksum: 508935e3366d95444131f0aaa801a4301f24ea5bcb900d12764e7335b46b910730cc1b5bcfcfb8eccb7c8db261ba0671c6a7ca30d10870ff7a7756dc7e731a7a
"flatted@npm:3.2.9, flatted@npm:^3.1.0":
version: 3.2.9
resolution: "flatted@npm:3.2.9"
checksum: f14167fbe26a9d20f6fca8d998e8f1f41df72c8e81f9f2c9d61ed2bea058248f5e1cbd05e7f88c0e5087a6a0b822a1e5e2b446e879f3cfbe0b07ba2d7f80b026
languageName: node
linkType: hard