You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3c87849
Browse filesBrowse the repository at this point in the historyBrowse files
fix(workflows): stop flagging whole-field references in JSON fields and correct the quoting advice (#8837)
* fix(workflows): stop flagging whole-field references in JSON fields and correct the quoting advice
* fix(workflows): name JSON control characters in the quoting advice
@@ -784,7 +797,9 @@ function unquotedJsonReferenceTokens(json: string): string[] {
784
797
* Outside Function code a reference is replaced by its raw text, so
785
798
* `{"id": <start.order_id>}` becomes `{"id": ord-1}` and the block fails to
786
799
* parse it at run time, while lint, deploy, and every earlier run of a draft
787
-
* that never reached the block stay clean. Only references whose declared
800
+
* that never reached the block stay clean. No JSON-aware escaping exists
801
+
* outside Function code, so quoting is only safe for text that can never hold a
802
+
* quote, backslash, or control character. Only references whose declared
788
803
* output type is `string` are reported: numbers, booleans, and objects already
789
804
* resolve to JSON values, and an undeclared type cannot be judged here.
790
805
*/
@@ -835,7 +850,7 @@ export function collectUnquotedJsonStringReferences(
835
850
field,
836
851
value,
837
852
kind: 'block-output',
838
-
reason: `unquoted-json-string: these references resolve to text, which is inserted without quotes, so the field is not valid JSON at run time unless the text is itself JSON. Quote each one, e.g. "${value[0]}".`,
853
+
reason: `unquoted-json-string: these references resolve to text, which is inserted raw, so the field is not valid JSON at run time unless the text is itself JSON. Quoting, e.g. "${value[0]}", works only for text that never contains a double quote, backslash, line break, or other control character, such as an id. For free text such as a model reply, build the JSON in a Function block, which reads references as values, and set this field to only that block's result reference.`,
0 commit comments