The structured output JSON comes embedded inside the API response, which is also a JSON. Since we have to parse the response to process it, any control characters inside the structured output are unescaped into regular characters, leading to invalid JSON and breaking during parsing. This change adds a retry mechanism that escapes the string again if parsing fails, preventing the parser from breaking on malformed input and working around this issue. For example: ``` original = '{ "a": "{\\"key\\":\\"value with \\n newline\\"}" }' JSON.parse(original) => { "a" => "{\"key\":\"value with \n newline\"}" } # At this point, the inner JSON string contains an actual newline. ``` |
||
---|---|---|
.. | ||
configuration | ||
db/migrate | ||
fabricators | ||
fixtures | ||
jobs | ||
lib | ||
models | ||
reports | ||
requests | ||
serializers | ||
services | ||
shared | ||
support | ||
system | ||
tasks | ||
plugin_helper.rb | ||
plugin_spec.rb |