From d9b41b2f59c65c2bb7a6a31f053623270039fea1 Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Thu, 19 Jun 2025 16:06:53 +0800 Subject: [PATCH] =?UTF-8?q?parameters=E5=8F=82=E6=95=B0=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzezhong --- compiler/src/userIntents_parser/intentType.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/src/userIntents_parser/intentType.ts b/compiler/src/userIntents_parser/intentType.ts index a29d16a24..9ac1f7fdf 100644 --- a/compiler/src/userIntents_parser/intentType.ts +++ b/compiler/src/userIntents_parser/intentType.ts @@ -16,6 +16,7 @@ import ts from 'typescript'; import parseIntent from './parseUserIntents'; import Ajv from 'ajv'; +import json5 from 'json5'; const ajv = new Ajv({allErrors: true}); @@ -125,7 +126,7 @@ function validateParameters(v: ts.Expression): boolean { const initializer = ts.isIdentifier(v) ? parseIntent.checker.getSymbolAtLocation(v)?.valueDeclaration?.initializer : v; - return ts.isObjectLiteralExpression(initializer) && ajv.compile(JSON.parse(initializer.getText())); + return ts.isObjectLiteralExpression(initializer) && ajv.compile(json5.parse(initializer.getText())); } catch { return false; } -- Gitee